Skip to content

Fix bound tracker traffic for VPN bypass#11

Merged
ForeverInLaw merged 3 commits into
mainfrom
feat/bind-interface
Jun 1, 2026
Merged

Fix bound tracker traffic for VPN bypass#11
ForeverInLaw merged 3 commits into
mainfrom
feat/bind-interface

Conversation

@ForeverInLaw

Copy link
Copy Markdown
Contributor

Summary

  • bind HTTP tracker announces to the selected NIC, matching UDP tracker behavior
  • keep the selected bind interface visible on both tracker clients
  • add coverage that NewManagerWithBind pins HTTP and UDP bootstrap traffic

Tests

  • go test ./internal/bootstrap ./internal/transport

…INDTODEVICE / IP_BOUND_IF

Adds Config.BindInterface (name or numeric index). When set, the UDP
listener, the UDP tracker client, and LAN multicast send sockets are
pinned to that NIC via the OS-specific socket option, so outbound
traffic skips the routing table.

Resolution rejects loopback and down interfaces and surfaces failures
as MOSS_ERR_CONFIG_INVALID — the caller never silently falls back to
the VPN tunnel.

NAT-PMP/PCP remains routing-table-driven for now (gateway-local).
Default value is empty, behaviour unchanged when unset.

Tests: ResolveBindInterface (empty / unknown / loopback / live NIC),
plus a Windows-only integration test that asserts IP_UNICAST_IF is
flipped on the socket after ApplyBindToUDP.
Bump 3s wait to 5s in TestRelayNodeEnforcesConfiguredBandwidth.
@ForeverInLaw ForeverInLaw merged commit f126c80 into main Jun 1, 2026
0 of 2 checks passed
@ForeverInLaw ForeverInLaw deleted the feat/bind-interface branch June 1, 2026 23:01
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.

1 participant