Skip to main content

Crate seyd_nat

Crate seyd_nat 

Source
Expand description

Reachability for the Seyd agent.

The pilot is always the initiator, so Seyd’s traversal problem is the narrow one: make the agent reachable as a server. In descending order of reliability that is an installed router port mapping, global IPv6, a STUN-reflexive address plus hole punching, and a manually forwarded port. Port-restricted and symmetric NAT are unreachable by construction while the pilot is a browser (PROTOTYPE.md, “NAT traversal — why this is not ICE”). There is no relay: what this crate cannot make reachable is reported in NatReport so the pilot can tell the operator how to fix the network.

Everything runs on the UDP sockets the QUIC server will later own (bind_sockets) — STUN in particular has to see the same NAT mapping QUIC will use, so the sockets are bound once and never rebound.

Re-exports§

pub use addr::format_host;
pub use addr::is_global;
pub use gather::gather;
pub use gather::Candidate;
pub use gather::GatherOpts;
pub use gather::Gathered;
pub use gather::Hint;
pub use gather::NatReport;
pub use portmap::map_port;
pub use portmap::renew;
pub use portmap::MapProtocol;
pub use portmap::PortMapping;
pub use socket::bind_sockets;
pub use stun::discover;
pub use stun::NatDiscovery;
pub use stun::NatType;

Modules§

addr
Address classification.
gather
Candidate gathering and the NatReport.
ifaces
Local addresses worth advertising.
portmap
Router port mapping — PCP (RFC 6887), NAT-PMP (RFC 6886), UPnP-IGD.
socket
Binding the UDP sockets the QUIC server will own.
stun
STUN client (RFC 5389) on a socket we own, plus NAT classification.

Structs§

NetworkWatch
Network-change notifications.

Functions§

watch_network_changes
Watch for interface-address changes by polling ifaces::interfaces every 10 s. Polling rather than netlink/SCDynamicStore keeps it portable; a 10 s detection delay is negligible against QUIC’s idle timeout. Callers treat a message as “re-run gather() on the same sockets”.
watch_network_changes_with
Test seam: same watcher with an injected address provider and period.