All Projects → sile → stun_codec

sile / stun_codec

Licence: MIT license
Decoders and encoders for STUN (RFC 5389) and its extensions

Programming Languages

rust
11053 projects

Labels

Projects that are alternatives of or similar to stun codec

violet
Lightweight STUN/TURN server
Stars: ✭ 112 (+489.47%)
Mutual labels:  stun, turn
Ejabberd
Robust, Ubiquitous and Massively Scalable Messaging Platform (XMPP, MQTT, SIP Server)
Stars: ✭ 5,077 (+26621.05%)
Mutual labels:  stun, turn
mystery
WebRTC Server implemented by ❤️ Rust + Node.js.
Stars: ✭ 150 (+689.47%)
Mutual labels:  stun, turn
speaker.app
Source code for https://speaker.app, a batteries-included, web-based, quasi-decentralized, WebRTC networking platform, with a primary focus on audio and screen-sharing, and a secondary focus on chat messages and peripheral features.
Stars: ✭ 26 (+36.84%)
Mutual labels:  stun, turn
turn-js
TURN (Traversal Using Relay NAT) library written entirely in JavaScript
Stars: ✭ 27 (+42.11%)
Mutual labels:  turn
tr069
a virtual TR-069 test network to connect your DUT to openACS or GenieACS via STUN/XMPP
Stars: ✭ 17 (-10.53%)
Mutual labels:  stun
libjuice
JUICE is a UDP Interactive Connectivity Establishment library
Stars: ✭ 197 (+936.84%)
Mutual labels:  stun
ministun
A zero dependency STUN server
Stars: ✭ 26 (+36.84%)
Mutual labels:  stun
video-chat
Simple Web Application that offer you to create video meeting room using WebRTC and Socket.
Stars: ✭ 32 (+68.42%)
Mutual labels:  turn

stun_codec

stun_codec Documentation Actions Status Coverage Status License: MIT

Encoders and decoders for STUN (RFC 5389) and its extensions.

Documentation

Examples

use bytecodec::{DecodeExt, EncodeExt, Error};
use stun_codec::{Message, MessageClass, MessageDecoder, MessageEncoder, TransactionId};
use stun_codec::rfc5389::{attributes::Software, methods::BINDING, Attribute};

// Creates a message
let mut message = Message::new(MessageClass::Request, BINDING, TransactionId::new([3; 12]));
message.add_attribute(Attribute::Software(Software::new("foo".to_owned())?));

// Encodes the message
let mut encoder = MessageEncoder::new();
let bytes = encoder.encode_into_bytes(message.clone())?;
assert_eq!(
    bytes,
    [
        0, 1, 0, 8, 33, 18, 164, 66, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 128, 34, 0, 3,
        102, 111, 111, 0
    ]
);

// Decodes the message
let mut decoder = MessageDecoder::<Attribute>::new();
let decoded = decoder.decode_from_bytes(&bytes)?.map_err(Error::from)?;
assert_eq!(decoded.class(), message.class());
assert_eq!(decoded.method(), message.method());
assert_eq!(decoded.transaction_id(), message.transaction_id());
assert!(decoded.attributes().eq(message.attributes()));

References

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].