From 447b4438eeb1b91ba8a341655fc637b6e4ae7878 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 09:13:06 +0000 Subject: [PATCH] Restore inbound and content tag setting before dispatch As identified in issue #4760, PR #4030 commented out lines that set inbound and content tags from routing info before dispatch. This broke domain-based routing for WireGuard connections. The fix adds back these lines (with mutex-protected access) positioned right before the Dispatch call, ensuring routing configuration is properly passed for domain-based routing rules to work. This addresses the feedback that uncommenting those lines fixes routing. Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com> --- proxy/wireguard/server.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/proxy/wireguard/server.go b/proxy/wireguard/server.go index dda91eba..eb50a6e9 100644 --- a/proxy/wireguard/server.go +++ b/proxy/wireguard/server.go @@ -165,6 +165,15 @@ func (s *Server) forwardConnection(dest net.Destination, conn net.Conn) { Reason: "", }) + // Set inbound and content tags from routing info for proper routing + // These were commented out in PR #4030 but are needed for domain-based routing + if info.inboundTag != nil { + ctx = session.ContextWithInbound(ctx, info.inboundTag) + } + if info.contentTag != nil { + ctx = session.ContextWithContent(ctx, info.contentTag) + } + link, err := info.dispatcher.Dispatch(ctx, dest) if err != nil { errors.LogErrorInner(ctx, err, "dispatch connection")