mirror of https://github.com/Dreamacro/clash.git
Change: remove InboundPort because already have OriginDst
This commit is contained in:
parent
c0e51f8556
commit
7c89301586
|
@ -21,7 +21,6 @@ func NewHTTP(target socks5.Addr, source net.Addr, originTarget net.Addr, conn ne
|
||||||
if originTarget != nil {
|
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
|
||||||
metadata.InboundPort = addrPort.Port()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return context.NewConnContext(conn, metadata)
|
return context.NewConnContext(conn, metadata)
|
||||||
|
|
|
@ -19,7 +19,6 @@ func NewHTTPS(request *http.Request, conn net.Conn) *context.ConnContext {
|
||||||
}
|
}
|
||||||
if addrPort, err := netip.ParseAddrPort(conn.LocalAddr().String()); err == nil {
|
if addrPort, err := netip.ParseAddrPort(conn.LocalAddr().String()); err == nil {
|
||||||
metadata.OriginDst = addrPort
|
metadata.OriginDst = addrPort
|
||||||
metadata.InboundPort = addrPort.Port()
|
|
||||||
}
|
}
|
||||||
return context.NewConnContext(conn, metadata)
|
return context.NewConnContext(conn, metadata)
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ func NewSocket(target socks5.Addr, conn net.Conn, source C.Type) *context.ConnCo
|
||||||
}
|
}
|
||||||
if addrPort, err := netip.ParseAddrPort(conn.LocalAddr().String()); err == nil {
|
if addrPort, err := netip.ParseAddrPort(conn.LocalAddr().String()); err == nil {
|
||||||
metadata.OriginDst = addrPort
|
metadata.OriginDst = addrPort
|
||||||
metadata.InboundPort = addrPort.Port()
|
|
||||||
}
|
}
|
||||||
return context.NewConnContext(conn, metadata)
|
return context.NewConnContext(conn, metadata)
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,6 @@ type Metadata struct {
|
||||||
DstIP net.IP `json:"destinationIP"`
|
DstIP net.IP `json:"destinationIP"`
|
||||||
SrcPort Port `json:"sourcePort"`
|
SrcPort Port `json:"sourcePort"`
|
||||||
DstPort Port `json:"destinationPort"`
|
DstPort Port `json:"destinationPort"`
|
||||||
InboundPort uint16 `json:"inboundPort"`
|
|
||||||
Host string `json:"host"`
|
Host string `json:"host"`
|
||||||
DNSMode DNSMode `json:"dnsMode"`
|
DNSMode DNSMode `json:"dnsMode"`
|
||||||
ProcessPath string `json:"processPath"`
|
ProcessPath string `json:"processPath"`
|
||||||
|
|
|
@ -41,7 +41,7 @@ func (p *Port) Match(metadata *C.Metadata) bool {
|
||||||
case PortTypeDest:
|
case PortTypeDest:
|
||||||
return metadata.DstPort == p.port
|
return metadata.DstPort == p.port
|
||||||
case PortTypeInbound:
|
case PortTypeInbound:
|
||||||
return metadata.InboundPort == uint16(p.port)
|
return metadata.OriginDst.Port() == uint16(p.port)
|
||||||
default:
|
default:
|
||||||
panic(fmt.Errorf("unknown port type: %v", p.portType))
|
panic(fmt.Errorf("unknown port type: %v", p.portType))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue