Expand description
Per-request stream framing on the edge ↔ tunnel side.
When the edge receives a request bound for our quick-tunnel hostname it opens a new bidi QUIC stream to us and writes:
[ 6-byte protocolSignature ][ 2-byte protocolVersion ][ capnp ConnectRequest ]We respond with the analogous frame carrying a ConnectResponse
(status + headers as metadata), and then the stream becomes a
byte-pumped channel for the HTTP body (or arbitrary TCP, for
ConnectionType::Tcp).
Constants + helpers here mirror
cloudflared/tunnelrpc/quic/protocol.go +
request_server_stream.go. We are the server side of this
framing because the edge is the one opening the stream — even
though “server” is confusing given we initiated the QUIC
connection. cloudflared calls it RequestServerStream for
exactly the same reason.
Structs§
- Connect
Request - Parsed
ConnectRequest.destis a full URL on HTTP/Websocket streams (e.g.https://abc.trycloudflare.com/path?q=1) and ahost:porton TCP streams.
Enums§
- Connection
Type - What kind of payload the edge is asking us to serve on this
stream. Mirror of
quic_metadata_protocol.ConnectionType.
Constants§
- DATA_
STREAM_ SIGNATURE - 6-byte tag the edge writes first to disambiguate stream kinds.
We only ever see
DATA_STREAM_SIGNATUREon per-request streams.RPC_STREAM_SIGNATUREis reserved for the cloudflared-server RPC (session manager / config), which the edge does NOT open against quick tunnels. - HTTP_
HEADER_ KEY - HTTP_
HOST_ KEY - HTTP_
METHOD_ KEY - HTTP_
STATUS_ KEY - PROTOCOL_
V1 - Two ASCII bytes (
"01"). cloudflared treatsreadVersionas a NO-OP for now — kept here verbatim so a future bump shows up loudly. - RPC_
STREAM_ SIGNATURE
Functions§
- read_
connect_ request - Read the preamble (signature + version), assert it’s the data
stream, and decode the capnp
ConnectRequestthat follows. - split
- Wrap a quinn pair into the futures-io halves capnp + our framing code expects.
- write_
connect_ response - Write a
ConnectResponsepreceded by the data-stream preamble.
Type Aliases§
- Meta
Pair - Borrowed key/value pair for write_connect_response.