Chore: embed the RuleExtra into Base

This commit is contained in:
yaling888
2022-03-13 01:21:23 +08:00
parent 8fbf93ccc8
commit 46b9a1092d
47 changed files with 1995 additions and 471 deletions

View File

@ -8,10 +8,10 @@ import (
)
type GEOIP struct {
*Base
country string
adapter string
noResolveIP bool
ruleExtra *C.RuleExtra
}
func (g *GEOIP) RuleType() C.RuleType {
@ -48,21 +48,19 @@ func (g *GEOIP) ShouldResolveIP() bool {
return !g.noResolveIP
}
func (g *GEOIP) RuleExtra() *C.RuleExtra {
return g.ruleExtra
}
func (g *GEOIP) GetCountry() string {
return g.country
}
func NewGEOIP(country string, adapter string, noResolveIP bool, ruleExtra *C.RuleExtra) (*GEOIP, error) {
func NewGEOIP(country string, adapter string, noResolveIP bool) *GEOIP {
geoip := &GEOIP{
Base: &Base{},
country: country,
adapter: adapter,
noResolveIP: noResolveIP,
ruleExtra: ruleExtra,
}
return geoip, nil
return geoip
}
var _ C.Rule = (*GEOIP)(nil)