mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 16:58:34 +00:00
Refactor: *net.UDPAddr -> *net.Destination
https://t.me/projectXray/111998
This commit is contained in:
parent
6bcac6cb10
commit
13ad3fddf6
8 changed files with 59 additions and 50 deletions
|
@ -81,8 +81,8 @@ func (s *Server) handlerUDPPayload(ctx context.Context, conn internet.Connection
|
|||
if payload.UDP != nil {
|
||||
request = &protocol.RequestHeader{
|
||||
User: request.User,
|
||||
Address: net.IPAddress(payload.UDP.IP),
|
||||
Port: net.Port(payload.UDP.Port),
|
||||
Address: payload.UDP.Address,
|
||||
Port: payload.UDP.Port,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,25 +128,24 @@ func (s *Server) handlerUDPPayload(ctx context.Context, conn internet.Connection
|
|||
continue
|
||||
}
|
||||
|
||||
destination := request.Destination()
|
||||
|
||||
currentPacketCtx := ctx
|
||||
if inbound.Source.IsValid() {
|
||||
currentPacketCtx = log.ContextWithAccessMessage(ctx, &log.AccessMessage{
|
||||
From: inbound.Source,
|
||||
To: request.Destination(),
|
||||
To: destination,
|
||||
Status: log.AccessAccepted,
|
||||
Reason: "",
|
||||
Email: request.User.Email,
|
||||
})
|
||||
}
|
||||
newError("tunnelling request to ", request.Destination()).WriteToLog(session.ExportIDToError(currentPacketCtx))
|
||||
newError("tunnelling request to ", destination).WriteToLog(session.ExportIDToError(currentPacketCtx))
|
||||
|
||||
data.UDP = &net.UDPAddr{
|
||||
IP: request.Address.IP(),
|
||||
Port: int(request.Port),
|
||||
}
|
||||
data.UDP = &destination
|
||||
|
||||
if dest.Network == 0 {
|
||||
dest = request.Destination() // JUST FOLLOW THE FIREST PACKET
|
||||
dest = request.Destination() // JUST FOLLOW THE FIRST PACKET
|
||||
}
|
||||
|
||||
currentPacketCtx = protocol.ContextWithRequestHeader(currentPacketCtx, request)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue