Feature: verify mmdb on initial

This commit is contained in:
Dreamacro
2020-04-16 19:12:25 +08:00
parent 5c03613858
commit 84f627f302
2 changed files with 33 additions and 5 deletions

View File

@ -22,6 +22,14 @@ func LoadFromBytes(buffer []byte) {
})
}
func Verify() bool {
instance, err := geoip2.Open(C.Path.MMDB())
if err == nil {
instance.Close()
}
return err == nil
}
func Instance() *geoip2.Reader {
once.Do(func() {
var err error