Skip to content

feat: traceroute support for WireGuard and Tailscale tunnels#4108

Open
xdqi wants to merge 77 commits into
SagerNet:testingfrom
xdqi:feature/mtr-support
Open

feat: traceroute support for WireGuard and Tailscale tunnels#4108
xdqi wants to merge 77 commits into
SagerNet:testingfrom
xdqi:feature/mtr-support

Conversation

@xdqi

@xdqi xdqi commented May 4, 2026

Copy link
Copy Markdown

Add traceroute/mtr support for WireGuard and Tailscale TUN tunnels, enabling ICMP, UDP and TCP traceroute modes to work through proxy tunnels.

Features

  • WireGuard DirectRoute: Enable DirectRoute on WireGuard device stacks to support traceroute through WG tunnels
  • NAT device TTL forwarding: Forward TTL from incoming packets to outbound connections in WireGuard NAT device
  • Configurable hop limit: Add max_traceroute_hop_limit option to TUN inbound configuration
  • Configurable TTL decrement: Add decrement_ttl option for DirectRoute behavior
  • Group outbound support: Selector and URLTest groups propagate DirectRoute and TTL settings to selected outbounds

Dependencies

Changes

  • transport/wireguard/: DirectRoute integration in device_stack and device_nat
  • protocol/direct/outbound.go: Pass TTL to direct outbound connections
  • protocol/group/: Selector and URLTest DirectRoute propagation
  • protocol/tun/inbound.go: Configurable max traceroute hop limit
  • option/tun.go: New TUN option fields
  • route/route.go: DirectRoute connection handling

@nekohasekai nekohasekai force-pushed the testing branch 5 times, most recently from 057f540 to 6b07a22 Compare May 15, 2026 05:29
@nekohasekai nekohasekai force-pushed the testing branch 9 times, most recently from 2141845 to b6c416b Compare May 26, 2026 09:45
@nekohasekai nekohasekai force-pushed the testing branch 3 times, most recently from de161cf to 83b7304 Compare June 3, 2026 05:05
@nekohasekai nekohasekai force-pushed the testing branch 7 times, most recently from 1ed57eb to 8247670 Compare June 13, 2026 15:01
@nekohasekai nekohasekai force-pushed the testing branch 6 times, most recently from 8ea55ff to a9fe3f3 Compare June 17, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants