How onlinedi-vision/od-nat-piercer works
Online Division NAT Piercer is a Rust UDP NAT-traversal and relay prototype with a separate WebSocket CONTROL channel. The main workflow is a client joining a signaling channel, discovering peers and NAT conditions, attempting direct UDP paths, then using participant or server relays when needed; clients can also register for channel-scoped CONTROL broadcasts and acknowledge processing. The graph preserves protocol, path monitoring, and relay coordination stages. Some subsystem links rely on README descriptions because their implementation excerpts were not provided.
Main entry points: client.rs Client CLI · signaling_server.rs Signaling server · handlers.rs UDP handlers · networking.rs UDP networking
Components 23
Client runtime
- Client CLI
src/bin/client.rs - Peer state
src/client/structures.rs - UDP handlers
src/client/handlers.rs - UDP networking
src/client/networking.rs - Data routing
src/client/routing.rs - Path health
src/client/path_health.rs - Control plane
src/client/control_plane.rs
Signaling and relay
- Signaling server
src/bin/signaling_server.rs - Membership state
src/signaling/structures.rs - Join handling
src/signaling/handlers/connect.rs - Signaling handlers
src/signaling/handlers - Heartbeat monitor
src/signaling/heartbeat.rs - Participant relay
src/client/handlers.rs - Server relay
src/signaling/handlers/request_relay.rs
CONTROL channel
- CONTROL client
src/control/client.rs - CONTROL server
src/control/server.rs - Recipient queues
src/control/recipient.rs - Delivery reliability
src/control/reliability.rs - CONTROL messages
src/control/messages.rs
Transport protocol
- UDP wire protocol
src/proto/packet.rs - Routed data
src/proto/routed_data.rs - Text commands
src/proto/control_text.rs
Other components
- Participant
Connections 29
- Participant → Client CLI: starts
- Client CLI → Signaling server: joins channel
- Signaling server → Join handling: dispatches join
- Join handling → Membership state: updates membership
- Signaling server → Signaling handlers: dispatches requests
- Signaling server → Heartbeat monitor: monitors liveness
- Heartbeat monitor → Membership state: checks registrations
src/signaling/heartbeat.rs - Signaling server → Client CLI: shares peer addresses
- Client CLI → UDP networking: runs UDP workers
src/bin/client.rs - UDP networking → UDP handlers: processes datagrams
src/client/networking.rs - UDP handlers → Peer state: updates peer state
src/client/handlers.rs - UDP networking → Data routing: routes DATA
src/client/networking.rs - Data routing → Routed data: parses and encodes
src/client/routing.rs - UDP handlers → Participant relay: forwards peer traffic
src/client/handlers.rs - UDP handlers → Server relay: requests fallback
src/client/handlers.rs - Signaling handlers → Server relay: selects fallback
- Client CLI → Path health: monitors paths
- Client CLI → Control plane: starts CONTROL
- Control plane → CONTROL client: runs connection
- CONTROL client → CONTROL server: registers and broadcasts
- CONTROL server → Recipient queues: enqueues recipients
src/control/server.rs - CONTROL client → Delivery reliability: confirms delivery
src/control/client.rs - CONTROL server → Delivery reliability: bounds delivery
src/control/server.rs - CONTROL client → CONTROL messages: encodes messages
src/control/client.rs - CONTROL server → CONTROL messages: handles messages
src/control/server.rs - UDP networking → Text commands: uses commands
src/client/networking.rs - Signaling handlers → Text commands: handles commands
src/signaling/handlers/message.rs - Routed data → Text commands: uses DATA tokens
src/proto/routed_data.rs - Client CLI → UDP wire protocol: future packet format