Skip to main content

Module manager

Module manager 

Source
Expand description

Top-level orchestrator. QuickTunnelManager::start() runs:

  1. POST /tunnelapi::request_tunnel
  2. Edge discovery → edge::discover
  3. QUIC dial + register → connect_cycle (helper)
  4. Spawn reactor task → owns the QUIC connection, runs the supervisor, and reconnects on edge drop.
  5. Return handle holding url + shutdown channel.

The reactor task is the long-lived owner: it cycles between “supervise current connection” and “reconnect with backoff + replace_existing=true” until the operator signals shutdown or the reconnect attempt count exhausts.

Structs§

QuickTunnelHandle
QuickTunnelManager
TunnelMetrics

Constants§

CLIENT_VERSION
Crate version, baked into ConnectionOptions.client.version.
DEFAULT_GRACE_PERIOD
Default budget for the unregisterConnection RPC on shutdown.
DEFAULT_HANDSHAKE_TIMEOUT
Default budget for POST + discovery + handshake + register.
DEFAULT_HA_CONNECTIONS
How many parallel QUIC connections to register, each on a distinct conn_index. Higher = more resilient to a single edge POP dropping. cloudflared uses 4 for named tunnels and 1 for quick tunnels; 2 is a happy middle that masks a single-POP reconnect (~5s gap) without doubling traffic to localhost.
MAX_HA_CONNECTIONS
Hard ceiling — matches cloudflared. Going higher hits diminishing returns and the edge may rate-limit registrations from one source.
MAX_RECONNECT_ATTEMPTS
Hard cap on consecutive reconnect failures before the reactor gives up. Each failure widens the backoff (1s → 30s, exponential with a cap), so 10 attempts spans roughly 90s of trying.