tailcat, cmd/tailcat: add exit-node UDP forwarding - #80
Closed
OmarAlaaeldein wants to merge 1 commit into
Closed
Conversation
OnTCPForward already turns a server into a TCP exit node, but NetstackDialUDP panics and the packet filter never admits UDP, so a client TUN cannot send QUIC, DNS, or other datagrams through `tailcat serve exit-node`. Add Server.OnUDPForward, advertise CapExitUDP in the meowed trailer (legacy 5-byte meowed still parses as caps=0), enforce AllowProxy on both TCP and UDP, and copy datagrams in the CLI exit-node handler.
Author
|
Closing in favor of #25, which is the fuller library design (OnUDP/OnUDPForward, idle timeout, SOCKS UDP) and already has maintainer review. The two pieces this PR had that #25 does not:
Happy to send those as a follow-up on top of #25 if useful. |
Author
|
Closing in favor of #25. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Server.OnTCPForwardalready makestailcat serve exit-nodea TCP exit node. UDP is still a dead end:NetstackDialUDPpanics (unreachable from tailcat) andbuildFilternever admitsipproto.UDP, so a client TUN cannot send QUIC, DNS, or other datagrams through the tunnel.AllowProxyis already documented as applying to TCP or UDP, but it was never consulted on the TCP path either.What
Server.OnUDPForwardplusGetUDPHandlerForFlow, same NAT64 unwrap as TCPOnUDPForwardis setNetstackDialUDP→ns.DialContextUDPon both server and clientClient.DialUDP/HasServerCap/ServerCapsCapExitTCP(0x01),CapExitUDP(0x02). Legacy 5-byte meowed still parses as caps=0AllowProxyenforced on both TCP and UDP exit flowsserve exit-nodecopies datagrams (60s idle, 65535-byte buffers)Caller-defined
AllowProxystays the policy hook; this PR does not bake in loopback/metadata denials.Tests
go test .(includesTestMeowedCapsRoundTrip)go test ./cmd/tailcat -run 'TestServeExitNodeUDP|TestAllowProxyRejection|TestServeExitNode$'go vet ./...