Fix: should check originDst is nil (#2797)
This commit is contained in:
parent
31fe77ee69
commit
295b0da0e5
@ -18,8 +18,10 @@ func NewHTTP(target socks5.Addr, source net.Addr, originTarget net.Addr, conn ne
|
|||||||
metadata.SrcIP = ip
|
metadata.SrcIP = ip
|
||||||
metadata.SrcPort = port
|
metadata.SrcPort = port
|
||||||
}
|
}
|
||||||
|
if originTarget != nil {
|
||||||
if addrPort, err := netip.ParseAddrPort(originTarget.String()); err == nil {
|
if addrPort, err := netip.ParseAddrPort(originTarget.String()); err == nil {
|
||||||
metadata.OriginDst = addrPort
|
metadata.OriginDst = addrPort
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return context.NewConnContext(conn, metadata)
|
return context.NewConnContext(conn, metadata)
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,11 @@ func NewPacket(target socks5.Addr, originTarget net.Addr, packet C.UDPPacket, so
|
|||||||
metadata.SrcIP = ip
|
metadata.SrcIP = ip
|
||||||
metadata.SrcPort = port
|
metadata.SrcPort = port
|
||||||
}
|
}
|
||||||
|
if originTarget != nil {
|
||||||
if addrPort, err := netip.ParseAddrPort(originTarget.String()); err == nil {
|
if addrPort, err := netip.ParseAddrPort(originTarget.String()); err == nil {
|
||||||
metadata.OriginDst = addrPort
|
metadata.OriginDst = addrPort
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return &PacketAdapter{
|
return &PacketAdapter{
|
||||||
UDPPacket: packet,
|
UDPPacket: packet,
|
||||||
metadata: metadata,
|
metadata: metadata,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user