The native TCP transport always performs TLS before sending the bearer token.
Clients verify the configured server name against either system roots or an
explicit custom CA bundle. The server rejects a bad token before creating a
Session or registering services. Token comparison is a single fixed-width
constant-time comparison covering both content and length, so length equality
is not observable through timing, and secret-bearing configuration Debug output
is redacted. Session IDs are redacted too, because a Session ID is a capability
in DataHello.
The server chooses the effective listener address. Service binds are loopback
only unless allow_public_service_binds is explicitly enabled. The server
ignores the client Target as authority; only the client uses its configured
local target after a valid Open.
Embedders can use Server::bind_with_policy for address allowlists, port
ranges, ephemeral-port policy, and a per-session service ceiling. BindPolicy
is evaluated before a listener is bound; a Loopback request resolves to
[::1]:port and is checked against the same address allowlist as an explicit
address request, so a pinned allowlist is never an escape hatch. Authentication
success never grants bind permission by itself.
Each accepted external connection receives a random 128-bit ConnectionId, bound to the current Session and Service, with a 30-second lifetime and single-use consumption. Pending and active connection counts, services, handshakes, and control queues have finite ceilings selected by the validated runtime policy, with conservative defaults. Dynamic registration transactions are likewise bounded (one in flight without negotiated capability 1; up to the command-queue-derived ceiling with it) and generation-scoped: disconnect, cancellation, timeout, and Session replacement fail every pending reply and clear the transaction state, so stale acknowledgements can never enter desired state. DataHello is the final Eggtunnel message on a data stream; following bytes are opaque.
A peer Drain deadline can only shorten local shutdown: with negotiated
capability 2 the effective drain wait is min(peer deadline, local shutdown ceiling) (zero means immediate), and without it receivers keep
local-only timing. Unknown or unnegotiated extension messages fail closed.
Unauthenticated accepted connections are capped at 64 concurrent handshakes.
The server retains a sliding 60-second authentication failure window for at
most 1,024 source IPs, blocks a source after 10 failures, and applies a 100 ms
delay after each failed token check. A blocked source and a bad token are
indistinguishable to the peer: both leave through one path that applies the
same delay and the same Error frame, so blocklist state cannot be probed.
Once the bounded limiter table is full, further sources are left untracked
rather than blocked, so the table cannot be filled with spoofed addresses to
lock out a legitimate new peer. This is a process-local, per-source throttle;
deployments behind a shared NAT should account for the shared source address.
The optional mtls feature adds Server::bind_mtls and
Client::start_with_mtls. This profile requires both a trusted client
certificate and the existing bearer token. The server maps a leaf certificate
to a Principal using SHA-256 of its DER bytes and requires that identity to
match on data connections. Trust roots are supplied explicitly to the server;
the client still validates the server name and either system or configured
roots. No enrollment or revocation service is included. Client private-key
buffers are redacted and zeroized on drop on a best-effort basis.
The ordinary TLS profile uses Eggress 1.0.8. Its public configuration builders install the Rustls ring provider as the process default if no provider has been set; Eggtunnel does not install a runtime or tracing subscriber.
The optional QUIC profile uses Eggress 1.0.8 with platform certificate roots
and verified SNI. The adapter currently has no custom-root or client-certificate
configuration, so QUIC rejects custom CA and mTLS settings instead of ignoring
them. QUIC still requires the bearer token inside its encrypted control stream.
Pre-session UDP/TLS handshake work runs inside the eggress-transport-quic
adapter before Eggtunnel's authenticated-session semaphore is acquired.
Eggress bounds its per-connection task fan-out at
MAX_CONCURRENT_CONNECTION_TASKS=1024 and per-stream tasks at
MAX_CONCURRENT_STREAM_TASKS=4096. Eggtunnel further bounds accepted
unauthenticated handshake tasks at MAX_HANDSHAKES=64. The combined behavior is documented; no replacement or
vendoring of the adapter is required to keep the residual pre-session
admission risk observable. The per-session stream_admission semaphore caps
active data streams at MAX_ACTIVE_CONNECTIONS_PER_SESSION=128, with the
admission saturating, recovering, and rejecting additional streams as
qualified by stream-saturation tests. QUIC transport-specific
wrong-session, stale-session, replay, and half-close correlation cases are
qualified end-to-end.
The optional WebSocket profile establishes verified TLS before the WebSocket upgrade and uses binary messages with a 1 MiB message limit. It is intended for non-browser tunnel clients; the adapter does not validate Origin and makes no browser cross-site security claim. Its close operation closes the WebSocket connection as a whole, so TCP half-close equivalence is not promised. Peer close during an active relay terminates the underlying TCP connection promptly without leaving relay halves dangling, and that multi-frame bounded backpressure round-trips within the configured 1 MiB caps.
Outbound proxy chains are client-side only. Eggtunnel TLS and server-name
verification run over the established proxy path, protecting authentication
from a proxy that only forwards CONNECT or SOCKS traffic. Proxy credentials
should be placed in the environment variable named by outbound_proxy_env
and are redacted from Eggtunnel diagnostics and the public Snapshot view.
Proxy traversal with QUIC or mTLS is rejected. The client does not silently
fall back to direct networking when a proxy path fails; refusal, handshake
timeout, and cancellation paths produce typed termination categories. HTTP
CONNECT Basic authentication and SOCKS5 username/password authentication are
qualified as supported when the corresponding URI userinfo is supplied.
Two-hop chains using the canonical __-separated pproxy URI syntax are
qualified by one end-to-end SOCKS5+HTTP CONNECT integration test.
Dynamic Service registration accepts only the caller-supplied typed
ClientService; it does not accept server-directed targets. Desired state is
updated only after an acknowledgement from the current Session generation.
Library tracing uses coarse event fields and does not format tokens, proxy
chains, TLS identities, or full configuration objects. The embedder controls
subscriber filters and storage.
The protocol decoder retains its deterministic 10,000-input hostile-byte
unit guard. A separate, development-only fuzz/ workspace targets the public
bounded eggtunnel_proto::decode_frame API with arbitrary bytes and a small
seed corpus of valid and malformed frames. The fuzz dependency graph is not
part of the production workspace. A bounded local fuzz run adds evidence for
decoder robustness; it does not establish exhaustive parser safety. The
checked-in corpus contains protocol bytes only and must never contain
credentials or captured production traffic.