Skip to main content

Module network

Module network 

Source

Modules§

behavior
events
protocol
Wire protocol for room discovery and message broadcast.
server
Client connector to the centralized huddle-server.

Structs§

NetworkHandle

Enums§

NetworkCommand
NetworkMode
How the network discovers peers.

Functions§

start_network
start_network_disabled
huddle 0.8: build a NetworkHandle with no libp2p swarm — the onion-relay-only (NetworkMode::Server) path. We still hand back a fully-functional handle so the rest of the app is oblivious: room subscribe/unsubscribe/publish mirror to the attached ServerClient exactly as before, while the libp2p-specific commands (dial, announce, accept/reject, …) are simply drained and dropped. A tiny task consumes cmd_rx so the bounded channel never fills and send().await never blocks; it exits on Shutdown.
start_network_with
Start the network task with explicit mode, TCP listen port, and any pre-configured relay multiaddrs. listen_port = 0 requests a random port. Relays are dialed on startup; once Identify lands from a relay peer, we call listen_on("<relay>/p2p-circuit") to register a reservation so peers behind NAT can dial us through it.