Skip to content

redirect ​

The redirect inbound: TCP connections that netfilter's redirect/dnat brought to it; the destination is SO_ORIGINAL_DST (IP6T_SO_ORIGINAL_DST for IPv6).

Crateours-mod-redirect, modules/protocols/redirect
Binary featureredirect
Crate featuresnone

requires ​

Nothing.

provides ​

  • Provide::Inbound { key: "redirect" } — the options are ListenOptions, as in sing-box.
  • Provide::Schema { name: "inbounds.redirect" }.

Syntax: redirect.

Design ​

src/lib.rs: a listener on every shard (SO_REUSEPORT with several), socket hand-over on reload, as in tproxy; an accepted connection goes to the least loaded shard.

Limitations ​

detour and listening in a netns are rejected at build time.

Tests ​

tests/e2e/netns/tun.sh (the redirect part).

GPL-3.0-or-later