feat: RESTful API support update Geo file

and can set update url by user, eg.
geox-url:
  geoip: "http://xxxx/gepip.dat"
  mmdb: "http://xxxx/country.mmdb"
  geosite: "http://xxxx/geosite.dat"
This commit is contained in:
adlyq
2022-05-24 15:04:13 +08:00
parent 149b4b5b43
commit 7431001ed6
6 changed files with 160 additions and 12 deletions

View File

@ -21,16 +21,16 @@ func SetLoader(newLoader string) {
geoLoaderName = newLoader
}
func Verify(name string) bool {
func Verify(name string) error {
switch name {
case C.GeositeName:
_, _, err := LoadGeoSiteMatcher("CN")
return err == nil
return err
case C.GeoipName:
_, _, err := LoadGeoIPMatcher("CN")
return err == nil
return err
default:
return false
return fmt.Errorf("not support name")
}
}