Feature: add source ipcidr condition for all rules

This commit is contained in:
yaling888
2021-08-31 21:46:04 +08:00
parent 83c9664c17
commit 4cc16e0136
14 changed files with 155 additions and 93 deletions

View File

@ -15,7 +15,7 @@ type GEOIP struct {
country string
adapter string
noResolveIP bool
network C.NetWork
ruleExtra *C.RuleExtra
geoIPMatcher *router.GeoIPMatcher
}
@ -43,11 +43,11 @@ func (g *GEOIP) ShouldResolveIP() bool {
return !g.noResolveIP
}
func (g *GEOIP) NetWork() C.NetWork {
return g.network
func (g *GEOIP) RuleExtra() *C.RuleExtra {
return g.ruleExtra
}
func NewGEOIP(country string, adapter string, noResolveIP bool, network C.NetWork) (*GEOIP, error) {
func NewGEOIP(country string, adapter string, noResolveIP bool, ruleExtra *C.RuleExtra) (*GEOIP, error) {
geoLoaderName := "standard"
//geoLoaderName := "memconservative"
geoLoader, err := geodata.GetGeoDataLoader(geoLoaderName)
@ -78,7 +78,7 @@ func NewGEOIP(country string, adapter string, noResolveIP bool, network C.NetWor
country: country,
adapter: adapter,
noResolveIP: noResolveIP,
network: network,
ruleExtra: ruleExtra,
geoIPMatcher: geoIPMatcher,
}