Crate stun_types

Source
Expand description

§stun-types

An implementation of parsing and writing STUN messages and attributes based on trait implementations.

This is based on the following standards:

  • RFC8489 - ‘Session Traversal Utilities for NAT (STUN)’
  • RFC5389 - ‘Session Traversal Utilities for NAT (STUN)’
  • RFC3489 - ‘STUN - Simple Traversal of User Datagram Protocol (UDP) Through Network Address Translators (NATs)’

§Message

§Message Parsing

Message parsing is zerocopy by default through the RawAttribute struct. Converting to a concrete attribute implementation (such as Software) may incur a copy depending on the attribute implementation.

§Message writing

The destination for a written Message is completely customizable through the MessageWrite trait. It is therefore possible to write directly into network provided buffers for increased performance and throughput.

MessageWriteVec provides a simple implementation of message writing that will write into a newly allocated Vec<u8>.

§Attribute

An Attribute implementation can be implemented entirely outside of this crate and used exactly the same as an Attribute implemented within this crate. Look at attribute module level documentation for an example of defining your own Attribute.

For TURN-related attributes, have a look at the turn-types crate which uses this crate to implement STUN attributes for TURN.

§Examples

See the message and attribute module documentation for examples of use.

Modules§

attribute
STUN Attributes
data
Data handling
message
STUN Messages
prelude
Prelude module for traits

Macros§

attribute_display
Implement an AttributeDisplay closure for an Attribute from a RawAttribute and calls add_display_impl with the generated closure.

Enums§

ParseTransportTypeError
Errors when parsing a TransportType
TransportType
The transport family