This commit is contained in:
HynoR 2024-03-13 10:51:36 +08:00
parent 9349f0a1a3
commit fda93579f0

View File

@ -42,7 +42,7 @@ type compiledRule[O Outbound] struct {
HostMatcher hostMatcher HostMatcher hostMatcher
Protocol Protocol Protocol Protocol
StartPort uint16 StartPort uint16
EndPoint uint16 EndPort uint16
HijackAddress net.IP HijackAddress net.IP
} }
@ -50,7 +50,7 @@ func (r *compiledRule[O]) Match(host HostInfo, proto Protocol, port uint16) bool
if r.Protocol != ProtocolBoth && r.Protocol != proto { if r.Protocol != ProtocolBoth && r.Protocol != proto {
return false return false
} }
if r.StartPort != 0 && (port < r.StartPort || port > r.EndPoint) { if r.StartPort != 0 && (port < r.StartPort || port > r.EndPort) {
return false return false
} }
return r.HostMatcher.Match(host) return r.HostMatcher.Match(host)