2021-08-31 21:46:04 +08:00
|
|
|
package constant
|
|
|
|
|
2022-02-23 02:38:50 +08:00
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
|
|
|
|
"github.com/Dreamacro/clash/component/geodata/router"
|
|
|
|
)
|
|
|
|
|
|
|
|
var TunBroadcastAddr = net.IPv4(198, 18, 255, 255)
|
2021-08-31 21:46:04 +08:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
2022-02-23 02:38:50 +08:00
|
|
|
|
|
|
|
type RuleGeoSite interface {
|
|
|
|
GetDomainMatcher() *router.DomainMatcher
|
|
|
|
}
|