Skip to main content

Crate rift_nat

Crate rift_nat 

Source
Expand description

NAT traversal helpers (STUN, hole punching, TURN integration).

This module provides:

  • STUN binding discovery for public addresses
  • UDP hole punching between peers
  • TURN relay allocation helpers (via turn module)

Structs§

NatConfig
PeerEndpoint
TurnCandidate
TurnRelay
TurnServerConfig

Enums§

HolePunchError
NatType
StunError
TurnError

Functions§

allocate_turn_relay
attempt_hole_punch
Attempt UDP hole punching with a peer and return the first successful socket.
detect_nat_type
Compare local and public address lists to detect NAT behavior.
gather_local_candidates
Collect local (host) candidates for a given listen port. Loopback, unspecified, and link-local addresses are excluded.
gather_public_addrs
Query STUN servers to discover public-facing addresses.
gather_turn_candidates
Allocate TURN relays and return candidates if successful.
parse_turn_server
Parse a TURN server URI into a config struct.
spawn_keepalive
Spawn periodic keep-alive packets to keep NAT bindings warm.
spawn_turn_keepalive
Periodically send empty datagrams to keep the TURN allocation alive.