Repository navigation
WebTransport
holyWisp can listen for WebTransport (HTTP/3 over QUIC, on UDP) beside its WebSocket listener. A browser opens new WebTransport("https://host:port/") and speaks Wisp over the session: the same packets, the same egress policy, the same limits and reputation as a WebSocket client. Wisp UDP streams (QUIC, WebRTC) ride QUIC datagrams, so a lost datagram is lost instead of stalling every other stream, and Wisp streams on different lanes do not wait for each other's losses.
QUIC, TLS 1.3 and HTTP/3 are in the tree, used by this listener alone. The WebSocket side still has no TLS; put it behind a reverse proxy as Reverse-proxy describes. The design and its measurements are in docs/webtransport.md.
One key does it:
webtransport = onThe listener binds UDP on webtransport-host (empty: the TCP listener's host) and webtransport-port (0: the same number as port). TCP and UDP ports are separate sockets, so TCP 6001 and UDP 6001 do not collide. The start log says what it got:
[info] wt: new self-signed certificate, sha-256 fyx4neGvW+8AyEF7L+kz9bd+ArVvT1Xnl7M6g6K8xew=, valid 13 days
[info] wt: WebTransport on UDP 127.0.0.1:5539, 32 sockets
[info] server: holywisp 0.5.4 starting
Then:
-
Open the UDP port in the firewall. Nothing proxies UDP to holyWisp: clients reach this port directly.
-
Raise the kernel's UDP buffer ceiling. Each socket asks for 4 MiB (or
socket-buffer-size), and with the stocknet.core.rmem_maxof 208 KiB a burst is dropped and QUIC slows the session. The server warns at start when it gets less than it asked for.sysctl -w net.core.rmem_max=4194304 net.core.wmem_max=4194304
-
To use UDP port 443 under the shipped systemd unit, give the unit
CAP_NET_BIND_SERVICEas its own comment describes (set bothAmbientCapabilities=andCapabilityBoundingSet=to it in a drop-in). Install-and-run has the unit. -
Check the configuration before a restart:
holywisp --config /etc/holywisp/holywisp.conf --check-configloads the certificate files and opens the certificate directory as a start would.
On Linux every worker gets its own UDP socket, and a BPF program steers each datagram to the worker that owns its connection ID. On macOS and Windows there is one socket, on worker 0, which then owns every WebTransport connection.
A browser verifies a WebTransport server in one of two ways: by the Web PKI, as for any HTTPS site, or by pinning a certificate hash it was given (serverCertificateHashes). holyWisp supports both.
With no certificate configured, the server makes an ECDSA P-256 key and a self-signed certificate at start, valid from an hour ago for 13 days, and replaces it every 6 days. Chrome pins only a certificate of 14 days or less, which is why the period is short.
The page learns the hash from GET /webtransport.json on the TCP port (the same port as /health). That reply exists only with webtransport on. Real output:
$ curl -si http://127.0.0.1:5539/webtransport.json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 101
Cache-Control: no-store
Access-Control-Allow-Origin: *
Connection: close
{"url":"","hashes":[{"algorithm":"sha-256","value":"fyx4neGvW+8AyEF7L+kz9bd+ArVvT1Xnl7M6g6K8xew="}]}
After a rotation hashes lists the new certificate and the previous one, so a page that fetched the file just before the change still connects. url is webtransport-url, or "" when it is not set; "" means "the relay's own host and port over https". Set webtransport-url (it must start with https://) when the WebTransport address differs from the origin that serves /webtransport.json, for example a different port.
A page uses it like this (the built-in web client, examples/wisp-webclient.html, does the same):
const cfg = await (await fetch("https://wisp.example.org/webtransport.json", { cache: "no-store" })).json();
const url = cfg.url || "https://wisp.example.org/";
const wt = new WebTransport(url, {
serverCertificateHashes: cfg.hashes.map((h) => ({
algorithm: h.algorithm,
value: Uint8Array.from(atob(h.value), (c) => c.charCodeAt(0)),
})),
protocols: ["wisp-v2"], // any protocol at all asks for Wisp v2
});
await wt.ready;wisp.example.org is an example host. When nginx or another proxy carries the TCP side, it has to pass /webtransport.json through to holyWisp; Reverse-proxy covers it.
webtransport-cert = /etc/holywisp/wt/fullchain.pem
webtransport-key = /etc/holywisp/wt/privkey.pemBoth or neither. The key must be ECDSA P-256, because that is the only signature the TLS layer makes, and it must be the key of the first certificate in the chain. With these files nothing rotates, /webtransport.json lists no hashes ("hashes":[]), and browsers verify the chain by the Web PKI. With certbot, ask for --key-type ecdsa (P-256 is its default curve). The wisp user must be able to read both files.
A wrong pair stops the start, and --check-config reports it:
holywisp: configuration refused: webtransport-key rsa.key: not an ECDSA P-256 private key
holywisp: configuration refused: webtransport-key k2.key: the key is not the key of the first certificate in webtransport-cert op.crt
holywisp: configuration refused: webtransport-cert and webtransport-key must both be set or both be empty
Renewals need no restart. The server looks at both files once a second; when either changes, it waits until neither has changed for one more look (a renewer writes the certificate, then the key), loads the pair with the same checks as at start, and logs the new notAfter and SHA-256 at INFO. New sessions get the new certificate and open ones keep theirs. A pair that does not load is logged as an ERROR and the current certificate stays in use. There is no SIGHUP reload.
webtransport-cert-dir = /etc/holywisp/wt-certsThe directory holds <host>.pem files, each the chain and its P-256 key in one file, named by the host in lower case (wisp.example.org.pem). A client whose SNI is one of those names gets that certificate. Any other name, and a client that sends no SNI (one that connects to an IP address), gets the default certificate: the one from webtransport-cert, or the self-signed one. File names other than a lower-case host name plus .pem are skipped, so a renewer's temporary files and dotfiles are ignored.
The server rescans the directory when it changes (checked once a second) and every file once a minute; a file replaced by rename is picked up at once, and a file younger than a second waits for the next look. A file that does not load is logged and that host gets the default certificate. A directory that cannot be opened stops the start.
With the self-signed default still in place, /webtransport.json lists its hashes; pages that use a name with a file of its own verify that name's certificate by the Web PKI instead.
By default a session is admitted on any path. webtransport-path limits it to the paths you name, typically the same keyed path the WebSocket side is reached on:
webtransport-path = /wisp/<gate-key>
webtransport-path = wisp.example.org /The value is [HOST] /PATH, repeatable up to 32 times. <gate-key> is a placeholder for your own secret path segment.
- A rule matches its path and anything under it:
/wisp/<gate-key>admits/wisp/<gate-key>and/wisp/<gate-key>/x, never/wisp/<gate-key>x. A rule that ends in/matches that path alone, so/admits/and nothing else. - The query string is ignored. The path comparison is case-sensitive.
- A HOST, when given, must equal the host of the request's
:authority(case-insensitive, port and trailing dot ignored).*or no host means any host. - The path may not hold spaces, control bytes,
?or#. A bad rule is refused with a message that does not repeat it, because the path may hold a key.
A session request that no rule admits is answered 404 before anything is counted or charged for it. Any HTTP/3 request that is not a WebTransport CONNECT is answered 421 with alt-svc: clear, so a browser that cached an HTTP/3 alternative for the host goes back to TCP. Real output, with the rule /wisp/example-key:
$ holywisp-client -s https://127.0.0.1:5539/ --pin "$HASH" 127.0.0.1 5589
server answered 404
$ holywisp-client -s https://127.0.0.1:5539/wisp/example-key/sub --pin "$HASH" 127.0.0.1 5589
hi
$ curl -sk --http3-only -i https://127.0.0.1:5539/
HTTP/3 421
alt-svc: clear
The client opens one bidirectional stream, the Wisp stream, and sends Wisp packets on it, each preceded by its length as a u32 little-endian. Those are the packets a WebSocket message would carry, handled by the same code. Protocol describes them.
- v2 is negotiated when the CONNECT carries
wt-available-protocols(any value) andenable-v2is on. The server echoes the first offered token inwt-protocol, as the WebSocket side echoes the subprotocol. Without the header the session is v1. - With
password-requiredon, a session that does not ask for v2 is answered 426. - Datagrams carry DATA for UDP streams only, in both directions, whenever the packet fits one; a larger one goes on the Wisp stream. CONNECT, CLOSE, CONTINUE and TCP DATA always go on a stream. A datagram from the client that is anything but DATA for an open UDP stream is dropped and counted in
/statsaswebTransport.dropped. - Flow control is Wisp's (CONTINUE, and stream credit where the client asks for it) on top of QUIC's. Backpressure toward a slow client works as on a WebSocket, with QUIC's unsent bytes in place of the socket's queue and
ws-write-high-wateras the mark. Bytes toward a WebTransport client are copied and encrypted; the zero-copy splice path is the WebSocket side's alone.
A v2 session may spread its Wisp streams over several QUIC streams, called lanes, so that a loss or a slow reader on one lane holds up only the streams on it. webtransport-lanes (default 8, at most 16; 0 or 1 turns lanes off) is advertised in the server's INFO as extension 0xE1. The client opens each extra lane with a LANE packet, and each Wisp stream stays on the lane its CONNECT came on. Any lane ending ends the session. A lane whose unsent bytes pass ws-write-high-water pauses only its own streams' remotes; past lanes times the mark, every remote on the session pauses. A v1 session never has lanes, and a client that does not ask for them sees the plain protocol.
A v2 client that offers wisp-v2-server-stream among its protocols (after wisp-v2, for servers that do not know it) is answered with that token. The server then opens the Wisp stream itself right after the 200 and sends its INFO and, unless password-required is on, the stream-0 CONTINUE at once, so the client can send its first CONNECT without another round trip. The client's first packet on that stream must be its INFO, or the session is closed with 0x04. In a browser this needs WebTransport.prototype.protocol to tell the page which token came back; the bundled web client checks for it.
A WebTransport session goes through the same connection checks as a WebSocket upgrade, at the CONNECT, after the QUIC handshake. Security-and-limits explains each limit.
The listener answers first, then the admission checks run in this order:
| Check | Answer |
|---|---|
No webtransport-path rule admits the path |
404 |
| The server cannot allocate the connection | 503 |
Origin not on a non-empty allow-origin list |
403 |
Per-IP connect rate (connections-limit-per-ip) |
429 |
| Reputation tier STRICT | 403 |
max-concurrent-connections-per-ip reached |
429 |
max-concurrent-connections reached |
503 |
password-required and the session did not ask for v2 |
426 |
After any of these the QUIC connection is closed once the answer is acknowledged, 2 s after it at most, so a browser sees the status instead of a QUIC error.
The HTTP/3 layer answers three requests on its own and ends only that request's stream, not the connection:
| Request | Answer |
|---|---|
Not a CONNECT (a page load, curl --http3-only) |
421 with alt-svc: clear
|
A CONNECT whose :protocol is not webtransport
|
405 |
| A second WebTransport session on one QUIC connection | 429 |
The client's address is the UDP peer's. No proxy header is read on this listener, whatever trusted-proxy says, because nothing proxies UDP to it.
Before a client's address is validated (its handshake completes, or it returns a Retry token), it costs only what these allow, and the per-IP limiters do not run yet, because a UDP source address can be forged:
| Key | Default | Meaning |
|---|---|---|
webtransport-max-handshakes |
1024 | QUIC handshakes in progress per worker |
webtransport-retry-threshold |
64 | Handshakes in progress per worker past which every new Initial gets a Retry, so the client must prove its address first (0: always) |
On top of those, one source address may have 16 handshakes in progress, and a handshake not done in 10 s is dropped. The server never sends more than 3 times what an unvalidated address sent it, answers Version Negotiation and Retry only to datagrams of 1200 bytes or more, and keeps stateless resets shorter than the datagram they answer.
webtransport-congestion-control chooses how fast QUIC sends toward the client:
| Value | Behaviour |
|---|---|
bbr (default) |
BBR version 1, as Linux's tcp_bbr: paces at the delivery rate it measures and does not slow down for random loss. On a path with 0.3% random loss it keeps the path's speed. |
bbr2 |
The same model with BBR version 3's answer to loss: a round that loses more than 2% of its flight ends startup or a probe and caps the flight where the loss began. For a shallow buffer: in the project's tests it lost 0.5% of its packets where bbr lost 3.5%. Loss under 2% changes nothing. |
newreno |
RFC 9002's NewReno. It halves its window at every loss; on the 0.3% loss path it ran at about a tenth of the same path's TCP. |
bbr stays the default until bbr2 has run on the public edges. Every datagram is sent with don't-fragment set, and the pacer releases at most 32 datagrams per burst on a 100 microsecond tick, so a browser's small UDP receive buffer is not overrun. docs/webtransport.md has the measurements.
webtransport-idle-timeout-s (default 30, 1 to 3600) is QUIC's idle timeout, and it cannot be turned off: without one, a vanished client's state would stay forever. The server sends a keepalive PING after 20 s without sending, which keeps a NAT or conntrack entry with a 30 s UDP timeout alive.
The server closes sessions itself when they end, because Chrome goes silent after a session instead of closing the QUIC connection. A stop (SIGTERM, systemctl stop) sends every open session a close (code 0, "server stopping") before the process exits, and Chrome reports closed within milliseconds.
A process that dies without a stop sends nothing. Its clients learn of it from the next process: their next datagram carries a connection ID the new process does not know, and its stateless reset ends the session, but only if it carries the token the old process gave out. That token comes from the reset key:
webtransport-reset-key-file = /var/lib/holywisp/webtransport-reset.keyThe file holds 64 hex digits. When it is missing (or empty) the server makes it, mode 0600, and logs made a stateless-reset key in <path>. A file that holds anything else is left alone, logged as an ERROR, and the key is then new for that start. With the key file empty (the default in the code), the key is new at each start and the clients of a crashed server wait for their idle timeout. The packaged deploy/holywisp.conf sets the path above. Use one file per server: the key can forge resets for that server's connection IDs. The key is never logged.
- A secure context: the page itself on
https://(orhttp://localhost). WebTransport is not available to plain-HTTP pages. - The UDP port reachable from the browser. A network that blocks UDP leaves the page with the WebSocket; the bundled web client races both and keeps whichever finishes its handshake first.
- Either a Web PKI certificate for the name in the URL, or the hashes from
/webtransport.jsoninserverCertificateHashes. Pinned certificates must be ECDSA P-256 and valid for 14 days or less, which the self-signed default is. - An
Originon theallow-originlist, if you set one.
holywisp-client speaks WebTransport when the server URL is https:// (port 443 when the URL has none). It needs --pin HASH (a value from /webtransport.json, base64 or hex), --pin-key HASH (the SHA-256 of the certificate's public key, which survives renewals that keep the key) or --insecure (any certificate, for loopback tests only). Real runs against a local server and echo services:
$ HASH=$(curl -s http://127.0.0.1:5539/webtransport.json | python3 -c 'import json,sys;print(json.load(sys.stdin)["hashes"][0]["value"])')
$ echo "hello over wt" | holywisp-client -s https://127.0.0.1:5539/ --pin "$HASH" --idle-ms 500 127.0.0.1 5589
hello over wt
$ echo "udp ping" | holywisp-client -s https://127.0.0.1:5539/ --pin "$HASH" -u --idle-ms 500 127.0.0.1 5590
udp ping
$ holywisp-client -s https://127.0.0.1:5539/ --pin "$HASH" --bench 268435456 127.0.0.1 5589
268435456 bytes echoed in 437 ms: 585.8 MiB/s each way, checksum ok
connect 1.8 ms, first byte 1.1 ms after the start
$ holywisp-client -s https://127.0.0.1:5539/ --pin "$HASH" -2 --server-stream --lanes 4 --streams 4 --bench 67108864 127.0.0.1 5589
67108864 bytes echoed in 117 ms: 547.0 MiB/s each way, checksum ok
connect 1.8 ms, first byte 6.4 ms after the start
The UDP echo went by datagram. The figures are one workstation's loopback; yours will differ. For a server reached by name, --connect-to ADDRESS dials an address while the URL's host stays the SNI and :authority, which is how to test one host of a webtransport-cert-dir:
$ holywisp-client -s https://wisp.example.org:5539/ --connect-to 127.0.0.1 --pin-key "$PK" 127.0.0.1 5589
curl --http3-only against the port should get the 421 shown above; that proves the TLS and QUIC layers answer. Client-and-benchmarks has every client option.
In /stats, connections.webTransport counts sessions next to connections.webSocket, and the top-level webTransport object has the listener's counters. From the runs above:
"webTransport": {
"sessions": {"total": 5, "active": 0},
"handshakes": 0, "retries": 0, "refusedHandshakes": 0, "dropped": 0,
"quic": {"sessionsEnded": 5, "packetsSent": 249088, "packetsReceived": 256307,
"packetsLost": 0, "spuriousLost": 0, "bytesSent": 360940157,
"bytesReceived": 361350174, "congestionEvents": 0, "ptos": 0, "srttUsSum": 1126}
}Stats-and-monitoring describes the fields.
Every webtransport-* key, with its default and range, is in the WebTransport table on Configuration. Two keys from elsewhere also apply here: socket-buffer-size, when set, sizes the UDP sockets (4 MiB otherwise), and ws-write-high-water is the unsent mark for sessions and lanes.
| Symptom | Cause and fix |
|---|---|
| The browser never connects, the WebSocket works | UDP blocked on the way, or the firewall has only the TCP port open. Open the UDP port; check with holywisp-client -s https://... from outside. |
TLS handshake failed (alert 42) from the client |
The pin does not match the certificate served. With webtransport-cert-dir, a client that connects by IP gets the default certificate, not the host's. |
| Chrome refuses a pinned hash | The certificate is not ECDSA P-256 or is valid for more than 14 days. Use the self-signed default for pinning, or a Web PKI certificate without pins. |
server answered 404 |
No webtransport-path rule admits the path; remember that a rule ending in / matches only itself. |
| 426 |
password-required is on and the page did not pass protocols. |
| After a crash, browsers hang for 30 s | No webtransport-reset-key-file, so the new process's resets are not believed. |
Warning UDP receive buffer is ... not the 4194304 asked for
|
Raise net.core.rmem_max and wmem_max. |
Troubleshooting covers "Connection lost." in Chrome and the rest.
Checked against commit db9d9e8 on master of Fracital/holyWisp. Where a page and the code disagree, the code is right.
Getting started
Running a server
- Configuration
- Reverse proxy
- Security and limits
- Stats and monitoring
- Running in production
- Troubleshooting
Features
Clients
Releases