init
This commit is contained in:
19
v2data/loader.go
Normal file
19
v2data/loader.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package v2data
|
||||
|
||||
import "google.golang.org/protobuf/proto"
|
||||
|
||||
func LoadGeoSiteList(b []byte) (*GeoSiteList, error) {
|
||||
geoSiteList := new(GeoSiteList)
|
||||
if err := proto.Unmarshal(b, geoSiteList); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return geoSiteList, nil
|
||||
}
|
||||
|
||||
func LoadGeoIPListFromDAT(b []byte) (*GeoIPList, error) {
|
||||
geoIP := new(GeoIPList)
|
||||
if err := proto.Unmarshal(b, geoIP); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return geoIP, nil
|
||||
}
|
||||
Reference in New Issue
Block a user