From 8f653eeea9c53f576bc291a73848ef1ceffb94ca Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Sun, 17 Aug 2025 10:35:55 -0400 Subject: [PATCH] Add notes for source address --- proxy/wireguard/server.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/proxy/wireguard/server.go b/proxy/wireguard/server.go index cf351201..6144f5c7 100644 --- a/proxy/wireguard/server.go +++ b/proxy/wireguard/server.go @@ -135,8 +135,11 @@ func (s *Server) forwardConnection(dest net.Destination, conn net.Conn) { } inbound.Name = "wireguard" inbound.CanSpliceCopy = 3 - inbound.Source = net.DestinationFromAddr(conn.RemoteAddr()) - inbound.Gateway = net.DestinationFromAddr(conn.LocalAddr()) + + // overwrite the source to use the tun address for each sub context. + // Since gvisor.ForwarderRequest doesn't provide any info to associate the sub-context with the Parent context + // Currently we have no way to link to the original source address + inbound.Source = net.DestinationFromAddr(conn.RemoteAddr()) ctx = session.ContextWithInbound(ctx, &inbound) if s.info.contentTag != nil { ctx = session.ContextWithContent(ctx, s.info.contentTag)