MCPcopy Index your code
hub / github.com/MengMengCode/GetRealityDomain / NewGeo

Function NewGeo

types.go:49–58  ·  view source on GitHub ↗

NewGeo 创建新的地理位置查询实例

(dbPath string)

Source from the content-addressed store, hash-verified

47
48// NewGeo 创建新的地理位置查询实例
49func NewGeo(dbPath string) (*Geo, error) {
50 reader, err := geoip2.Open(dbPath)
51 if err != nil {
52 return nil, err
53 }
54
55 return &Geo{
56 geoReader: reader,
57 }, nil
58}
59
60// GetGeo 获取IP的地理位置代码
61func (g *Geo) GetGeo(ip net.IP) string {

Callers 1

scanAddressFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected