mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 19:56:51 +08:00
26 lines
425 B
Go
26 lines
425 B
Go
|
package constant
|
||
|
|
||
|
import "net"
|
||
|
|
||
|
type RuleExtra struct {
|
||
|
Network NetWork
|
||
|
SourceIPs []*net.IPNet
|
||
|
}
|
||
|
|
||
|
func (re *RuleExtra) NotMatchNetwork(network NetWork) bool {
|
||
|
return re.Network != ALLNet && re.Network != network
|
||
|
}
|
||
|
|
||
|
func (re *RuleExtra) NotMatchSourceIP(srcIP net.IP) bool {
|
||
|
if re.SourceIPs == nil {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
for _, ips := range re.SourceIPs {
|
||
|
if ips.Contains(srcIP) {
|
||
|
return false
|
||
|
}
|
||
|
}
|
||
|
return true
|
||
|
}
|