From 3e7002d24c4ede6158fd4267914553bb98348c61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E6=89=87=E6=BB=91=E7=BF=94=E7=BF=BC?= Date: Fri, 6 Dec 2024 22:10:50 +0800 Subject: [PATCH] WireGuard inbound: Add missing inbound session information back (#4126) Fixes https://github.com/XTLS/Xray-core/issues/4121 --- proxy/wireguard/server.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/proxy/wireguard/server.go b/proxy/wireguard/server.go index 8ab84fe4..bdf27568 100644 --- a/proxy/wireguard/server.go +++ b/proxy/wireguard/server.go @@ -144,14 +144,15 @@ func (s *Server) forwardConnection(dest net.Destination, conn net.Conn) { Reason: "", }) + if s.info.inboundTag != nil { + ctx = session.ContextWithInbound(ctx, s.info.inboundTag) + } + // what's this? // Session information should not be shared between different connections // why reuse them in server level? This will cause incorrect destoverride and unexpected routing behavior. // Disable it temporarily. Maybe s.info should be removed. - // if s.info.inboundTag != nil { - // ctx = session.ContextWithInbound(ctx, s.info.inboundTag) - // } // if s.info.outboundTag != nil { // ctx = session.ContextWithOutbounds(ctx, []*session.Outbound{s.info.outboundTag}) // }