Expand description
STUN Agent library for Rust.
This crate provides a STUN I/O-free protocol implementation.
An I/O-free protocol implementation, often referred to as a
sans-IO
implementation, is a
network protocol implementation that contains no code for network I/O or
asynchronous flow control. This means the protocol implementation is agnostic
to the underlying networking stack and can be used in any environment that provides
the necessary network I/O and asynchronous flow control.
These STUN agents are designed for use in a client-server architecture where the client sends a request and the server responds.
This sans-IO protocol implementation is defined entirely in terms of synchronous functions returning synchronous results, without blocking or waiting for any form of I/O. This makes it suitable for a wide range of environments, enhancing testing, flexibility, correctness, re-usability and simplicity.
This library currently provides support for writing STUN clients. Support for writing servers is not yet implemented. The main element of this library is:
StunClient
: The STUN client that sends STUN requests and indications to a STUN server.
Structs§
- RttConfig
- When using unreliable transport, such as
UDP
, the re-transmission timeout is calculated using the following parameters. TheRTO
is an estimate of the round-trip time (RTT
) and is computed as described inRFC6298
, with two exceptions. First, the initial value forRTO
SHOULD be greater than or equal to 500 ms. Second, the value ofRTO
SHOULD NOT be rounded up to the nearest second. Rather, a 1 ms accuracy SHOULD be maintained. - Stun
Attributes - Even though the STUN message is a collection of attributes, The
StunAttribute
is used to simplify the addition and removal of attributes. TheRFC8489
does not set neither a limit nor a specific order for the attributes that can be added to a message, nevertheless, there are certain restrictions that must be followed for the integrity and fingerprint attributes. TheStunAttribute
eases the manipulation of attributes while ensuring that the above restrictions are met. - Stun
Client - A STUN client is an entity that sends STUN requests and receives STUN responses and STUN indications. A STUN client can also send indications.
- Stun
Cliente Builder - Builder for the STUN client. It allows to configure the client with the required parameters for the STUN usage.
- Stun
Packet - A chunk of bytes that represents a STUN packet that can be cloned.
- Stun
Packet Decoded Error - Describes the error that can occur during the STUN packet decoding.
- Stun
Packet Decoder - A STUN packet decoder that can be used to decode a STUN packet.
The
StunPacketDecoder
is helpful when reading bytes from a stream oriented connection, such as aTCP
stream, or even when reading bytes from a datagram oriented connection, such as aUDP
socket when the STUN packet is fragmented.
Enums§
- Credential
Mechanism - Describes the kind of credential mechanism that can be used by the STUN agent.
- Integrity
- Describes the kind of integrity protection that can be used.
- Stun
Agent Error - Describes the error that can occur during the STUN agent operation.
- Stun
Packet Decoded Value - Describes the possible outcomes of the STUN packet decoding.
- Stun
Packet Error Type - Describe the error type that can occur during the STUN packet decoding.
- Stun
Transaction Error - Errors that can be raised by the STUN client when a transaction fails.
- Stunt
Client Event - Stun client events
- Transport
Reliability - Description of the transport reliability, for STUN protocol
communication. It can be reliable or unreliable depending on
whether this is a
UDP
orTCP
connection.