Change: use uint16 for Metadata SrcPort and DstPort
This commit is contained in:
@ -3,7 +3,6 @@ package inbound
|
||||
import (
|
||||
"net"
|
||||
"net/netip"
|
||||
"strconv"
|
||||
|
||||
C "github.com/Dreamacro/clash/constant"
|
||||
"github.com/Dreamacro/clash/context"
|
||||
@ -15,14 +14,14 @@ func NewHTTP(target socks5.Addr, source net.Addr, originTarget net.Addr, conn ne
|
||||
metadata := parseSocksAddr(target)
|
||||
metadata.NetWork = C.TCP
|
||||
metadata.Type = C.HTTP
|
||||
if ip, port, err := parseAddr(source.String()); err == nil {
|
||||
if ip, port, err := parseAddr(source); err == nil {
|
||||
metadata.SrcIP = ip
|
||||
metadata.SrcPort = port
|
||||
metadata.SrcPort = C.Port(port)
|
||||
}
|
||||
if originTarget != nil {
|
||||
if addrPort, err := netip.ParseAddrPort(originTarget.String()); err == nil {
|
||||
metadata.OriginDst = addrPort
|
||||
metadata.InboundPort = strconv.Itoa(int(addrPort.Port()))
|
||||
metadata.InboundPort = addrPort.Port()
|
||||
}
|
||||
}
|
||||
return context.NewConnContext(conn, metadata)
|
||||
|
Reference in New Issue
Block a user