Skip to content

Proxies and WARP

David Reed edited this page Nov 20, 2026 · 2 revisions

By default holyWisp resolves the name a client asks for, checks every address against the egress policy, and dials the remote itself. This page covers the keys that change where an outbound stream goes: an upstream SOCKS5 or HTTP CONNECT proxy, the split between proxied and direct TCP, socket marks for WARP tunnels, and the resolver. Configuration lists every key; Security-and-limits covers the egress policy itself.

The order for each stream is fixed:

  1. With a proxy and proxy-udp = refuse, a UDP stream is closed 0x48.
  2. Host and port filters (allow-host, block-host, allow-port, block-port) on the name as the client sent it.
  3. The name is resolved, and each address is checked against the egress policy. A name whose every address is refused is closed 0x48.
  4. The route: through the proxy, or dialled here. A stream dialled here may get a WARP mark.
  5. The per-destination limits run on each address before it is dialled.

A proxy never widens what the policy allows: the check in step 3 runs whether or not the stream then takes the proxy.

Upstream proxy

proxy = socks5://127.0.0.1:1080
URL Protocol Default port
socks5://[user[:pass]@]host[:port] SOCKS5 (RFC 1928), username/password (RFC 1929) 1080
socks5h://... The same as socks5:// 1080
http://[user[:pass]@]host[:port] HTTP CONNECT, Proxy-Authorization: Basic when there is a user 80
https://... Refused: the server does not speak TLS to a proxy

The URL may not have a path, query or fragment; an IPv6 host goes in brackets. Only TCP streams use the proxy. The proxy's host is resolved once, when the server starts: a name that does not resolve stops the start (and fails --check-config), and a proxy that moves to another address needs a restart. An error message about proxy never repeats its value, because the URL may hold a password.

holywisp: configuration refused: proxy: https:// proxies need TLS, which this server does not speak
holywisp: configuration refused: proxy: URL may not have a path, query or fragment
holywisp: configuration refused: proxy: its host does not resolve

What the proxy is given

The proxy gets the hostname the client asked for, not the address holyWisp resolved: SOCKS5 address type 3 (domain name), or CONNECT host:port HTTP/1.1. A classifying or geo-routing proxy can then resolve the name itself. Only a literal IP in the client's CONNECT is sent as an address. This is what a small SOCKS5 proxy on loopback logged for two streams, one by name and one by address:

methods=[0] user=None atyp=3 host=localhost port=5589
methods=[0] user=None atyp=1 host=127.0.0.1 port=5589

With a user name (from the URL, or a client key, below) the greeting offers both "no authentication" and username/password, so a proxy that takes no credentials can still pick "none".

A stream has one try at the proxy, with no fallback to another address. Connecting to the proxy and its handshake each get connect-timeout-ms (15000); a proxy that accepts the connection and then says nothing closes the stream 0x43. The proxy's answer becomes the stream's close reason:

Proxy answer Close reason
SOCKS5 REP 2 (not allowed by ruleset), no acceptable auth method, auth rejected 0x48 blocked
SOCKS5 REP 3 or 4 (network or host unreachable) 0x42 unreachable
SOCKS5 REP 5 (connection refused) 0x44 refused
SOCKS5 REP 6 (TTL expired) 0x43 no response
Any other SOCKS5 failure, a malformed reply 0x03 network error
HTTP 2xx connected
HTTP 403 or 407 0x48 blocked
Any other HTTP status 0x42 unreachable

UDP and the proxy

SOCKS5 UDP ASSOCIATE is not implemented, so with a proxy set, UDP streams are refused (0x48) unless you say otherwise:

proxy-udp = direct   # relay UDP from this host, around the proxy

direct sends UDP from this host on purpose. It never happens by default.

Proxy only some TCP: proxy-only-to

proxy = socks5://127.0.0.1:1080
proxy-only-to = 192.0.2.1

proxy-only-to takes an address or CIDR and is repeatable (up to 64). Without it, every TCP stream takes the proxy. With it, a TCP stream goes through the proxy only when one of its resolved addresses is on the list; every other TCP stream is dialled here. A stream that matches is still handed to the proxy by name. 192.0.2.1 is a documentation address.

This is for a router with a DNS name gate: the gate answers the names the router must handle itself with one fixed address, and holyWisp sends exactly those streams to the router. That address is not a real destination, so a resolved address on the list is not checked against the address classes: the gate may answer with a private address, and the proxy resolves and checks the name itself. Everything else is checked as before: the same address given as a literal IP, UDP to it, and every address not on the list. On loopback, with proxy-only-to = 127.0.0.1/32 and no allow-loopback:

$ echo gate-name | holywisp-client -s ws://127.0.0.1:5539/ -v localhost 5589
[stream 1] DATA 10 bytes
gate-name
$ echo literal | holywisp-client -s ws://127.0.0.1:5539/ -v 127.0.0.1 5589
[stream 1] CLOSE host blocked (0x48)

localhost resolved to the listed address and went to the proxy by name; the literal 127.0.0.1 was refused.

proxy-only-to without proxy is refused at start. /stats counts the split in tcpRoute:

"tcpRoute": {"proxied": 1, "direct": 0}

A key per client: proxy-client-key

proxy-client-key = on
proxy-client-key-secret = <16 or more characters>

Each connection gets a key when it is admitted: 16 lower-case hex digits of BLAKE2b over the secret, a NUL and the client's address (an IPv6 client's /64, inside which privacy addresses change). The address used is the one after the trusted proxy headers. The proxy receives the key as its user name; a password in the proxy URL stays. A router that reads it can choose an exit per client and site instead of per site. The UDP WARP pick (below) uses the same key.

methods=[0, 2] user=cb2114c6738fdfd0 atyp=3 host=localhost port=5589

The address itself is never sent. Without proxy-client-key-secret the secret is random at each start (the start log says so at INFO, without the secret), and a restart then moves every client to another exit. The secret must be at least 16 characters and is never logged. proxy-client-key needs a proxy or udp-warp-marks to give the key to.

What the proxy has to check itself

The proxy resolves the name again, and it may get different addresses than holyWisp did (DNS rebinding). holyWisp cannot close that gap alone. A proxy that can reach private networks has to refuse the private addresses it resolves itself.

WARP marks

On a host with several kernel WARP tunnels (WireGuard devices) and a router that sends each TCP stream out through one of them by a hash of the stream's site, holyWisp can mark its own sockets (SO_MARK) for the tunnel the router would choose. A site's TCP and UDP then leave from the same exit address, and the site does not see one visitor from two places. This is how the abulxt edge fleet behind https://holywisp.fracit.al/ runs; nothing here is needed for an ordinary relay.

Marking needs Linux and CAP_NET_ADMIN. The shipped systemd unit drops every capability, so it needs a drop-in such as:

# /etc/systemd/system/holywisp.service.d/warp.conf
[Service]
AmbientCapabilities=CAP_NET_ADMIN
CapabilityBoundingSet=CAP_NET_ADMIN

The marks only choose a socket's fwmark; the policy routing that sends each mark into its tunnel (ip rule, routing tables) is the host's and outside holyWisp.

Without the capability the server still starts, with an ERROR and marking off:

[error] warp: udp-warp-marks: this process cannot mark sockets (Operation not permitted; it needs CAP_NET_ADMIN), so UDP streams go out unmarked

On macOS and Windows udp-warp-marks is refused at start.

UDP: udp-warp-marks and udp-warp-state

udp-warp-marks = 0x7701,0x7702,0x7703,0x7704
udp-warp-state = /run/warp-router/warp.json
udp-warp-state-max-age-s = 60
udp-warp-fallback = refuse

Both keys or neither. udp-warp-marks lists the fwmarks the state file may choose from: up to 16, each once, 0x hex or decimal (a leading 0 makes a number octal). The path is an example.

The state file is the router's list of healthy tunnels per address family, rewritten in place by rename:

{"v4": [{"name": "warp0", "mark": 30465}, {"name": "warp1", "mark": 30466}],
 "v6": [{"name": "warp0", "mark": 30465}]}
  • name is an interface name, 1 to 15 of A-Z a-z 0-9 _ . -. mark is 1 to 0xFFFFFFFF.
  • A family that is absent has no healthy tunnel. Other keys at either level are ignored.
  • A name or mark listed twice in one family, more than 16 tunnels in one, a file over 64 KiB or anything that is not JSON makes the whole file unusable.
  • A tunnel whose mark is not in udp-warp-marks is dropped with a WARN. Whoever can write the file can still only pick among the marks you configured.

The server looks at the file once a second and reads it again when its inode, size or mtime changed. Each change in what it means is logged:

[info] warp: udp-warp-state: UDP goes through 2 IPv4 and 1 IPv6 tunnel
[info] warp: udp-warp-state: UDP goes through 0 IPv4 and 0 IPv6 tunnels

How the tunnel is picked

The pick repeats the router's code to the bit, and the tests check it against vectors generated from the router (tests/warp_vectors.h):

  1. The key is the stream's site: the last two labels of the name, lower-cased, or three under a two-letter TLD whose second level is a public suffix (example.co.uk). For an IP literal, the address as inet_ntop writes it. With proxy-client-key, the key is client-key/site.
  2. Each tunnel healthy for the address's family scores the first 8 bytes of BLAKE2b over key, a NUL and the tunnel's name, read big-endian.
  3. The highest score wins; a tie goes to the greater name.

Every name of a site picks the same tunnel, and a tunnel going down moves only the sites it carried.

When the state cannot be used

Situation UDP stream TCP stream with tcp-warp
A name on warp-bypass-host unmarked unmarked
No capability, or the file missing, unreadable, malformed or older than udp-warp-state-max-age-s unmarked tcp-warp-fallback
The file lists no tunnel for the address's family udp-warp-fallback tcp-warp-fallback
The mark cannot be set on the socket udp-warp-fallback tcp-warp-fallback

Both fallbacks are refuse by default, which closes the stream 0x42 (what the router answers when it cannot dial). direct sends it unmarked. A TCP stream refused this way tries the name's next address first, since the other family may have tunnels up, and is not counted as a failed dial for the SYN-flood signature. A refusal or a direct fallback is logged as a WARN at most once a minute per worker:

[warn] warp: no healthy WARP tunnel for IPv4: UDP streams are refused (udp-warp-fallback refuse)

udp-warp-state-max-age-s (default 60, 0 to 86400; 0 means never too old) is judged by the file's mtime. The router rewrites the file every probe round, so an old file means a dead router.

TCP dialled here: tcp-warp

proxy = socks5://127.0.0.1:1080
proxy-only-to = 192.0.2.1
tcp-warp = on
tcp-warp-fallback = refuse

A router in user space pays for every byte it relays. With tcp-warp, TCP that holyWisp dials itself (no proxy, or not matched by proxy-only-to) gets a mark from the same state and the same pick as UDP, and stays on holyWisp's zero-copy path. TCP that goes through the proxy is never marked here: the router marks it.

tcp-warp needs udp-warp-marks and udp-warp-state (they are its tunnels), and with a proxy it needs proxy-only-to, or no TCP would be dialled here. Unlike UDP, TCP with no usable state follows tcp-warp-fallback, because a dead router is also a dead name gate. With the default tcp-warp-fallback = refuse, a process without CAP_NET_ADMIN refuses every TCP stream it would dial itself; the start log says so in the same ERROR line.

Names kept off WARP: warp-bypass-host

warp-bypass-host = example.com
warp-bypass-host = *.example.com

A listed name is unmarked before any state, capability or fallback is consulted, for UDP and for TCP dialled here. example.com matches that name exactly and *.example.com its subdomains; a * anywhere else is refused, and an IP literal never matches. The key needs udp-warp-marks, and it may also go in a policy-file, which is read again when it changes. Give the router the same list for the TCP it dials, or the site sees two exit addresses again.

Watching it

/stats shows what the workers were given at the last look, and counts every decision. From a run in a network namespace where marking works, after one UDP stream while the file listed tunnels and one after it listed none:

"warpState": {"configured": true, "canMark": true, "usable": true, "state": "ok",
              "ageSeconds": 2, "tunnels": {"v4": 0, "v6": 0}},
"udpWarp": {"marked": 1, "direct": 0, "refused": 1, "bypassed": 0},
"tcpWarp": {"marked": 0, "direct": 0, "refused": 0, "bypassed": 0}

warpState.state is off (not configured), noCapability, ok, missing, unreadable, malformed or stale. Without the capability it reads "configured": true, "canMark": false, "state": "noCapability". warpTunnels has one entry per udp-warp-marks mark, by position, with the router's name for it while the state lists it (null otherwise) and stream counts and connect and first-byte timings for TCP and UDP. Marks themselves are never shown. Stats-and-monitoring has the rest of the fields.

DNS

Every name is resolved on a pool of resolver-threads (default 4) threads, never on a worker's loop, and the answer is cached.

Key Default Range or values Meaning
dns-server none: the system resolver (getaddrinfo) ADDR, ADDR:PORT, [V6], [V6]:PORT, up to 8 Use the built-in client instead: it asks A and AAAA at once over UDP, server by server
dns-timeout-ms 3000 100 to 60000 Per server, for both questions, with dns-server
dns-ttl-s 120 0 to 604800 Longest a positive answer is cached; a shorter record TTL wins; 0 turns the cache off
dns-negative-ttl-s 10 0 to 604800 How long a failed lookup is cached (temporary failures are not)
dns-order ipv4first ipv4first, ipv6first, verbatim The order addresses are tried in
resolver-threads 4 1 to 256 Threads that run lookups
max-pending-lookups-per-ip 128 0 to 16777216 Lookups one client address may have in the resolver at once; one more is closed 0x49 and counts as a violation (0: no limit)

A dns-server must be an IP address, IPv6 in brackets, with an optional port from 1 to 65535 (53 unless given). Anything else, a name such as dns.google, a bare ::1 or 127.0.0.1:0, is refused at its line: the server does not start and --check-config fails, rather than send the lookups to the system resolver or to the other servers alone:

holywisp: /etc/holywisp/holywisp.conf:40: dns-server: 'dns.google' is not an IP address with an optional port (1.1.1.1, 1.1.1.1:53, [2606:4700:4700::1111]:53)

Answers from getaddrinfo carry no TTL, so they are cached for dns-ttl-s. The resolver's threads go to client addresses in turn, and one address never holds all of them, so a client asking for names that never resolve delays another client's lookup by at most one lookup. A stream that is still resolving when connect-timeout-ms runs out is closed 0x42.

Addresses are then dialled one at a time in dns-order. While an address of the other family is still to be tried, one connect gets at most family-fallback-ms (3000) instead of connect-timeout-ms. Through a proxy there is one dial, to the proxy.

/stats has dnsCacheEntries, throttled.lookups and a timing.resolve histogram.

How the public edge uses this

The public relay at https://holywisp.fracit.al/ runs on the abulxt edge fleet, which uses most of this page:

  • nginx in front terminates TLS and passes WebSocket upgrades to holyWisp. WebTransport, where it is on, reaches holyWisp's UDP port directly.
  • A SOCKS5 router, the edge router, is the proxy. Its DNS name gate answers the names it must handle itself with one address, which is proxy-only-to; those streams go to the router by name.
  • All other TCP is dialled by holyWisp with tcp-warp, and UDP goes proxy-udp = direct with udp-warp-marks. The router publishes the state file, and both sides pick tunnels with the same hash.
  • With proxy-client-key, the router and the UDP pick choose exits per client and site instead of per site.

The edge's addresses, router configuration and host names are not public.

Options

The keys on this page, with their defaults and ranges, are in the Where streams go and DNS tables on Configuration, and the rules between them under Rules across keys.

--check-config checks every rule between these keys (both WARP keys or neither, tcp-warp needs its tunnels, proxy-only-to needs a proxy, the secret's length), every dns-server, and that the proxy's host resolves:

holywisp: configuration refused: tcp-warp marks TCP dialled here, and with a proxy and no proxy-only-to there is none
holywisp: configuration refused: warp-bypass-host needs udp-warp-marks and udp-warp-state: there is no WARP to bypass
holywisp: configuration refused: proxy-client-key needs a proxy or udp-warp-marks to give the key to

When it does not work

Symptom Cause and fix
Every UDP stream closes 0x48 A proxy is set and proxy-udp is refuse. Set proxy-udp = direct if UDP may leave from this host.
Names the router's gate answers close 0x48 The gate's address is not on proxy-only-to, so it was checked as a destination. List it.
Every directly dialled TCP stream closes 0x42 tcp-warp with no usable state and tcp-warp-fallback = refuse: check warpState in /stats for noCapability or stale.
warpState.state is stale The router stopped rewriting the file; look at the router.
WARNs about tunnels "with a mark not in udp-warp-marks ignored" The router's state names marks you did not list. Add them, or fix the router.
A site sees two exit addresses warp-bypass-host differs between holyWisp and the router, or the router and holyWisp disagree on the hash (regenerate the vectors).

Troubleshooting has the close reasons in general.

Clone this wiki locally