Expand description
§turn-client-proto
turn-client-proto provides a sans-IO API for a TURN client communicating with a TURN server.
Relevant standards:
- RFC5766: Traversal Using Relays around NAT (TURN).
- RFC6062: Traversal Using Relays around NAT (TURN) Extensions for TCP Allocations
- RFC6156: Traversal Using Relays around NAT (TURN) Extension for IPv6
- RFC8656: Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT (STUN)
§Getting Started
The entry point for starting with a TURN client implementation depends on the transport
protocol that you are looking to use. For UDP connections, you should start in the udp
module, for TCP connections, the tcp module. (D)TLS functionality is contained within
extension crates. e.g.
- For TLS connections over TCP, the
turn-client-rustls, orturn-client-opensslcrates are available. - For DTLS connections over UDP, the
turn-client-dimplorturn-client-opensslcrates are available.
From there, the api module provides the interface that all of the TURN clients implement and
the client module can be used to combine one of the above options into a single value for
selection based on the underlying TURN client.
§Examples
use turn_client_proto::udp::TurnClientUdp;
use turn_client_proto::api::TurnConfig;
let turn_server_address = "127.0.0.1:3478".parse().unwrap();
let local_address = "127.0.0.1:1000".parse().unwrap();
let credentials = turn_types::TurnCredentials::new("username", "password");
let config = TurnConfig::new(credentials);
let client = TurnClientUdp::allocate(
local_address,
turn_server_address,
config,
);Re-exports§
pub use stun_proto as stun;pub use turn_types as types;
Modules§
Macros§
- impl_
client - Implement an enum over a list of TURN client implementations.