fix: geoip mmdb/geodata init

This commit is contained in:
metacubex
2023-01-09 21:07:31 +08:00
parent b4503908df
commit e9a7e104c0
6 changed files with 101 additions and 92 deletions

View File

@ -50,12 +50,9 @@ func (gs *GEOSITE) GetRecodeSize() int {
}
func NewGEOSITE(country string, adapter string) (*GEOSITE, error) {
if !initFlag {
if err := geodata.InitGeoSite(); err != nil {
log.Errorln("can't initial GeoSite: %s", err)
return nil, err
}
initFlag = true
if err := geodata.InitGeoSite(); err != nil {
log.Errorln("can't initial GeoSite: %s", err)
return nil, err
}
matcher, size, err := geodata.LoadGeoSiteMatcher(country)
@ -76,4 +73,4 @@ func NewGEOSITE(country string, adapter string) (*GEOSITE, error) {
return geoSite, nil
}
//var _ C.Rule = (*GEOSITE)(nil)
var _ C.Rule = (*GEOSITE)(nil)