README ¶ go-ipip IP数据库 Golang语言解析库 Usage p := NewIpip() if err := p.Load("17monipdb.dat"); err != nil { panic(err) } info, err := p.Find("8.8.8.8") if err != nil { panic(err) } fmt.Printf("Country:%s, Region:%s, City:%s, Isp:%s\n", info.Country, info.Region, info.City, info.Isp) Expand ▾ Collapse ▴ Documentation ¶ Index ¶ Variables type Ipip func NewIpip() *Ipip func (p *Ipip) Find(ipstr string) (*LocationInfo, error) func (p *Ipip) Load(path string) error type LocationInfo Constants ¶ This section is empty. Variables ¶ View Source var ( ErrInvalidIp = errors.New("invalid ip") ErrIpNotFound = errors.New("ip not found") ) Functions ¶ This section is empty. Types ¶ type Ipip ¶ type Ipip struct { // contains filtered or unexported fields } func NewIpip ¶ func NewIpip() *Ipip func (*Ipip) Find ¶ func (p *Ipip) Find(ipstr string) (*LocationInfo, error) func (*Ipip) Load ¶ func (p *Ipip) Load(path string) error type LocationInfo ¶ type LocationInfo struct { Country string Region string City string Isp string } Source Files ¶ View all Source files ipip.go Click to show internal directories. Click to hide internal directories.