Help us shape the future of Go! Take the 2026 Go Developer Survey

ipip

package module
v0.0.0-...-1f0b30f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2017 License: MIT Imports: 5 Imported by: 0

README

go-ipip

Build Status

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)

Documentation

Index

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL