mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 17:38:41 +00:00
Refactor: Shadowsocks & Trojan UDP FullCone NAT
https://t.me/projectXray/95704
This commit is contained in:
parent
4140ed7ab0
commit
8f8f7dd66f
10 changed files with 234 additions and 44 deletions
|
@ -256,6 +256,8 @@ func (s *Server) handleUDPPayload(ctx context.Context, clientReader *PacketReade
|
|||
inbound := session.InboundFromContext(ctx)
|
||||
user := inbound.User
|
||||
|
||||
var dest net.Destination
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
|
@ -278,8 +280,12 @@ func (s *Server) handleUDPPayload(ctx context.Context, clientReader *PacketReade
|
|||
})
|
||||
newError("tunnelling request to ", p.Target).WriteToLog(session.ExportIDToError(ctx))
|
||||
|
||||
if dest.Network == 0 {
|
||||
dest = p.Target // JUST FOLLOW THE FIREST PACKET
|
||||
}
|
||||
|
||||
for _, b := range p.Buffer {
|
||||
udpServer.Dispatch(ctx, p.Target, b)
|
||||
udpServer.Dispatch(ctx, dest, b)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue