rtciv0.5.0

rtci-turn

Sans-I/O TURN client (RFC 8656, RFC 6062 TCP allocations) for WebRTC. 25 public modules, 80 items at 0.5.0.

README

A TURN client: allocations for UDP relayed addresses of either family or both, permissions, channels, refreshes, the long-term credential mechanism, and TCP allocations (Connect, ConnectionAttempt, a data connection per peer). There is no TURN server.

Specifications

  • RFC 8656, Traversal Using Relays around NAT (TURN)
  • RFC 6062, TURN extensions for TCP allocations
  • RFC 8489, STUN, as TURN uses it

Clause-by-clause status, with the test that proves each clause: rfc8656, rfc6062.

Use

client::Client runs allocations against a server; the root crate (rtci) uses it to gather relayed candidates over UDP, TCP, TLS and DTLS, so most applications only configure a turn: / turns: URL on the peer connection.

Sans-I/O

Datagrams in, datagrams out, deadlines polled: the transport to the server (UDP socket, TCP or TLS connection) belongs to the caller. The crate does no I/O and reads no clock: every call that depends on time takes an Instant from the caller.

Licence

Licensed under either of the MIT licence or the Apache License, Version 2.0, at your option.

This crate is part of the rtci workspace, which descends from webrtc-rs/rtc and is developed independently; FORK.md lists what it carries over upstream. Upstream's licence and copyright notices are retained.

rtci_turn

TURN for the Sans-I/O WebRTC stack.

  • modclientThe Sans-I/O TURN client.
  • modprotoThe TURN-specific STUN attributes, methods and ChannelData framing.
  • modrestTime-limited TURN credentials of the "TURN REST API" (draft-uberti-behave-turn-rest-00, section 2.2; coturn's use-auth-secret / static-auth-secret): the username is the credential's expiry as a Unix timestamp, optionally followed by a separator and an application-chosen id (1735689600:alice), and the password is base64(HMAC(secret, username)). A server that checks the timestamp on every …
  • usecrypto

rtci_turn::client

The Sans-I/O TURN client.

  • modbindingChannel bindings, which replace the 36-byte Data indication header with a 4-byte one.
  • moddata_connectionThe data connections of a TCP allocation (RFC 6062).
  • modpermissionPer-peer send permissions, which a relay requires before it will forward to an address.
  • modrelayA live allocation on the server, and sending or receiving through it.
  • modtransactionOutstanding request tracking, with the RFC's retransmission schedule.
  • structAllocateOptionsfrom allocation::AllocateOptionsWhat an Allocate request asks for beyond a UDP relayed address (RFC 8656 §7.1).
  • structCachedCredentialThe realm, nonce and password algorithm a TURN server accepted an authenticated request with, and the user name and password they were used with: what RFC 8489 §9.2.3.2 has a client cache "for subsequent communications with the server". A later client to the same server with the same login starts its Allocate with them (Client::use_cached_credential) instead of an unauthenticated request …
  • structClientClient is a STUN client
  • structClientConfigClientConfig is a bag of config parameters for Client.
  • structErrorResponsefrom error::ErrorResponseAn error response from the server: its code and what a client acts on with it.
  • structRetransmissionConfigThe retransmission timer of the client's requests (RFC 8489 §6.2), the one rtci-stun has (stun::timer). The default is the RFC's.
  • enumEventWhat the client produces in response to inbound datagrams and elapsed time.
  • enumRelayTransportfrom allocation::RelayTransportWhat an allocation relays to and from peers: the REQUESTED-TRANSPORT of its Allocate.
  • enumRequestErrorfrom error::RequestErrorWhy a TURN request did not do what it asked.
  • typePeerAddrThe address of a remote peer the client exchanges data with through the relay.
  • typeReflexiveAddrThe client's own address as seen by the server — its server-reflexive address.
  • typeRelayedAddrThe public address the TURN server allocated on this client's behalf.
  • constDEFAULT_SOFTWAREThe default SOFTWARE of the TURN client's requests (ClientConfig::software).
  • useTryAlternatefrom stun::alternate::TryAlternate

rtci_turn::client::binding

Channel bindings, which replace the 36-byte Data indication header with a 4-byte one.

No public items at its top level.

rtci_turn::client::data_connection

The data connections of a TCP allocation (RFC 6062).

  • structDataConnectionOne client data connection of a TCP allocation: a second TCP (or TLS) connection to the TURN server that, once bound, carries one peer's byte stream as it is (RFC 6062 §4.3 to §4.5).
  • enumDataConnectionEventWhat a DataConnection reports.
  • constCONNECTION_BIND_TIMEOUTHow long the ConnectionBind may go unanswered. The server gives a new peer connection 30 seconds to be bound and then closes it (RFC 6062 §5.2, §5.3), so nothing can answer later.

rtci_turn::client::permission

Per-peer send permissions, which a relay requires before it will forward to an address.

No public items at its top level.

rtci_turn::client::relay

A live allocation on the server, and sending or receiving through it.

  • structRelayA borrowed handle to one live allocation on the TURN server.

rtci_turn::client::transaction

Outstanding request tracking, with the RFC's retransmission schedule.

No public items at its top level.

rtci_turn::proto

The TURN-specific STUN attributes, methods and ChannelData framing.

  • modaddfamilyThe ADDITIONAL-ADDRESS-FAMILY attribute, for asking for an IPv6 relayed address beside the IPv4 one.
  • modaddrAddress helpers and the five-tuple that identifies an allocation.
  • modaddrerrorThe ADDRESS-ERROR-CODE attribute, which says why one of two address families was not allocated.
  • modchandataChannelData messages — the compact 4-byte framing for relayed data.
  • modchannumThe CHANNEL-NUMBER attribute.
  • modconnidThe CONNECTION-ID attribute of TCP allocations (RFC 6062), which names a peer's TCP connection.
  • moddataThe DATA attribute, which carries relayed payloads in Send/Data indications.
  • moddontfragThe DONT-FRAGMENT attribute, asking the server to set DF on relayed packets.
  • modevenportThe EVEN-PORT attribute, requesting an even relayed port (for RTP/RTCP pairs).
  • modicmpThe ICMP attribute, which reports an ICMP error a relayed datagram met.
  • modlifetimeThe LIFETIME attribute, which sets and reports allocation expiry.
  • modpeeraddrThe XOR-PEER-ADDRESS attribute, naming the peer in permission and data messages.
  • modrelayaddrThe XOR-RELAYED-ADDRESS attribute, which reports the allocated public address.
  • modreqfamilyThe REQUESTED-ADDRESS-FAMILY attribute, for asking for an IPv4 or IPv6 allocation.
  • modreqtransThe REQUESTED-TRANSPORT attribute, which selects the relay's transport to peers.
  • modrsrvtokenThe RESERVATION-TOKEN attribute, used to claim a previously reserved port.
  • structProtocolProtocol is IANA assigned protocol number.
  • fnallocate_requestShorthand for allocation request message type.
  • fncreate_permission_requestShorthand for create permission request type.
  • fnrefresh_requestShorthand for refresh request message type.
  • fnsend_indicationShorthand for send indication message type.
  • constDEFAULT_PORTDEFAULT_PORT for TURN is same as STUN.
  • constDEFAULT_TLS_PORTDEFAULT_TLSPORT is for TURN over TLS and is same as STUN.
  • constPROTO_TCPPROTO_TCP is IANA assigned protocol number for TCP.
  • constPROTO_UDPPROTO_UDP is IANA assigned protocol number for UDP.

rtci_turn::proto::addfamily

The ADDITIONAL-ADDRESS-FAMILY attribute, for asking for an IPv6 relayed address beside the IPv4 one.

rtci_turn::proto::addr

Address helpers and the five-tuple that identifies an allocation.

  • structAddrAddr is ip:port.
  • structFiveTupleThe five-tuple that uniquely identifies a TURN allocation.

rtci_turn::proto::addrerror

The ADDRESS-ERROR-CODE attribute, which says why one of two address families was not allocated.

  • structAddressErrorCodeAddressErrorCode represents the ADDRESS-ERROR-CODE attribute as defined in RFC 8656 Section 18.12.
  • constATTR_ADDRESS_ERROR_CODEThe ADDRESS-ERROR-CODE attribute type (0x8001), comprehension-optional.

rtci_turn::proto::chandata

ChannelData messages — the compact 4-byte framing for relayed data.

  • structChannelDataChannelData represents the ChannelData Message defined in RFC 8656 Section 12.4.

rtci_turn::proto::channum

The CHANNEL-NUMBER attribute.

rtci_turn::proto::connid

The CONNECTION-ID attribute of TCP allocations (RFC 6062), which names a peer's TCP connection.

  • structConnectionIdConnectionId represents the CONNECTION-ID attribute as defined in RFC 6062 Section 6.2.1.

rtci_turn::proto::data

The DATA attribute, which carries relayed payloads in Send/Data indications.

  • structDataData represents DATA attribute.

rtci_turn::proto::dontfrag

The DONT-FRAGMENT attribute, asking the server to set DF on relayed packets.

rtci_turn::proto::evenport

The EVEN-PORT attribute, requesting an even relayed port (for RTP/RTCP pairs).

  • structEvenPortEvenPort represents EVEN-PORT attribute.

rtci_turn::proto::icmp

The ICMP attribute, which reports an ICMP error a relayed datagram met.

  • structIcmpIcmp represents the ICMP attribute as defined in RFC 8656 Section 18.13.
  • constATTR_ICMPThe ICMP attribute type (0x8004), comprehension-optional.

rtci_turn::proto::lifetime

The LIFETIME attribute, which sets and reports allocation expiry.

rtci_turn::proto::peeraddr

The XOR-PEER-ADDRESS attribute, naming the peer in permission and data messages.

  • structPeerAddressPeerAddress implements XOR-PEER-ADDRESS attribute.
  • typeXorPeerAddressPeerAddress implements XOR-PEER-ADDRESS attribute.

rtci_turn::proto::relayaddr

The XOR-RELAYED-ADDRESS attribute, which reports the allocated public address.

  • structRelayedAddressRelayedAddress implements XOR-RELAYED-ADDRESS attribute.
  • typeXorRelayedAddressXorRelayedAddress implements XOR-RELAYED-ADDRESS attribute.

rtci_turn::proto::reqfamily

The REQUESTED-ADDRESS-FAMILY attribute, for asking for an IPv4 or IPv6 allocation.

rtci_turn::proto::reqtrans

The REQUESTED-TRANSPORT attribute, which selects the relay's transport to peers.

rtci_turn::proto::rsrvtoken

The RESERVATION-TOKEN attribute, used to claim a previously reserved port.

rtci_turn::rest

Time-limited TURN credentials of the "TURN REST API" (draft-uberti-behave-turn-rest-00, section 2.2; coturn's use-auth-secret / static-auth-secret): the username is the credential's expiry as a Unix timestamp, optionally followed by a separator and an application-chosen id (1735689600:alice), and the password is base64(HMAC(secret, username)). A server that checks the timestamp on every …

  • fnrest_username_expiryWhen the REST username username expires: its leading Unix timestamp, before the first separator (coturn's --rest-api-separator, : by default) or the whole username when it has none. None when that part is not a decimal number of seconds.

Generated from the sources of rtci-turn 0.5.0 at its release tag. Items made by macros and methods are on docs.rs.