Skip to content
Edit this page

Chained Proxies and Pinned Outbounds

Setting outbound on any Wind inbound pins that listener directly to a declared outbound and bypasses the router. Combining tunnel inbounds with socks outbounds lets you assemble multi-hop transports (such as carrying TUIC's QUIC packets over an upstream SOCKS5 UDP proxy) without modifying protocol implementations.

Pinned Outbound Semantics

  • When an inbound specifies outbound: <tag>, all flows accepted by that inbound are dispatched straight to that outbound without calling the router.
  • If the referenced tag does not exist, Wind fails at configuration resolution and never silently falls back to the default outbound.
  • When outbound is omitted, normal routing applies (forwarding to the first declared outbound in standalone wind).

Prerequisites for Manual Chaining

Keep two operational details in mind when wiring multi-hop chains manually:

  1. Use a fixed loopback port: Although tunnel permits port 0 (ephemeral OS allocation), downstream outbounds in standalone wind (such as tuic.server_addr) require a concrete port, so assign a fixed loopback port (e.g. 127.0.0.1:10900).
  2. Deferred domain resolution: tunnel.remote_addr accepts a domain, IPv4, or bracketed IPv6 with a non-zero port. Domains are not resolved by tunnel; they are handed verbatim to the pinned outbound (such as an upstream SOCKS5 server).

Example: Carrying TUIC over a SOCKS5 Upstream

The following standalone wind configuration routes local SOCKS5 traffic through tuic, while carrying tuic's QUIC UDP datagrams through a local UDP tunnel into an upstream SOCKS5 server supporting UDP ASSOCIATE. Replace all placeholder addresses and credentials before use:

inbounds:
  - type: socks
    tag: local
    listen_addr: "127.0.0.1:1080"
    outbound: tuic

  - type: tunnel
    tag: tuic-transport
    listen_addr: "127.0.0.1:10900"
    remote_addr: "tuic.example.com:8443"
    network: udp
    outbound: socks-upstream

outbounds:
  - type: socks
    tag: socks-upstream
    server_addr: "socks.example.com:1080"
    allow_udp: true
    udp:
      timeout: 8s
      buffer_size: 2048
      reconnect: true
      initial_backoff: 500ms
      max_backoff: 30s

  - type: tuic
    tag: tuic
    server_addr: "127.0.0.1:10900"
    sni: "tuic.example.com"
    uuid: "00000000-0000-4000-8000-000000000001"
    password: "change-this-password"
[[inbounds]]
type = "socks"
tag = "local"
listen_addr = "127.0.0.1:1080"
outbound = "tuic"

[[inbounds]]
type = "tunnel"
tag = "tuic-transport"
listen_addr = "127.0.0.1:10900"
remote_addr = "tuic.example.com:8443"
network = "udp"
outbound = "socks-upstream"

[[outbounds]]
type = "socks"
tag = "socks-upstream"
server_addr = "socks.example.com:1080"
allow_udp = true

[outbounds.udp]
timeout = "8s"
buffer_size = 2048
reconnect = true
initial_backoff = "500ms"
max_backoff = "30s"

[[outbounds]]
type = "tuic"
tag = "tuic"
server_addr = "127.0.0.1:10900"
sni = "tuic.example.com"
uuid = "00000000-0000-4000-8000-000000000001"
password = "change-this-password"

Startup Sequence and Security Notes

  • Pin the local listener: Because socks-upstream appears first in outbounds, local must explicitly pin outbound: tuic; otherwise unpinned traffic would go straight to socks-upstream.
  • Staged startup: Wind builds socks-upstream and launches the pinned tuic-transport UDP tunnel first, then establishes the tuic QUIC session, and finally opens local. If startup is cancelled or fails midway, the early UDP socket is automatically released.
  • Unchanged TLS verification: Even though tuic transmits UDP datagrams to 127.0.0.1:10900, TLS SNI and certificate verification still target tuic.example.com.
  • Reconnect behavior: With udp.reconnect: true, a dropped SOCKS5 control connection triggers exponential backoff from initial_backoff up to max_backoff. Datagrams arriving during reconnection are dropped and recovered by the inner QUIC transport.

Relation to tuic-client

tuic-client's upstream proxy configuration automates this chain for both Quinn and Quiche backends. Unlike manual standalone wind configs, tuic-client holds an OS-assigned ephemeral loopback port and restricts its internal tunnel to the pre-bound local TUIC socket, whereas a generic tunnel inbound accepts multiple local peers.