Documentation ¶
Index ¶
Constants ¶
View Source
const Null = "N/A"
Variables ¶
View Source
var (
ErrInvalidIp = errors.New("invalid ip format")
)
Functions ¶
Types ¶
type LocationInfo ¶
type LocationInfo struct { Country string `json:"country"` Region string `json:"region"` City string `json:"city"` Isp string `json:"isp"` Ip string `json:"ip"` }
func Find ¶
func Find(ipstr string) (*LocationInfo, error)
Find locationInfo by ip string It will return err when ipstr is not a valid format
type Locator ¶
type Locator struct {
// contains filtered or unexported fields
}
func NewLocator ¶
New locator with dataFile
func (*Locator) Find ¶
func (loc *Locator) Find(ipstr string) (info *LocationInfo, err error)
Find locationInfo by ip string It will return err when ipstr is not a valid format
func (*Locator) FindByUint ¶
func (loc *Locator) FindByUint(ip uint32) (info *LocationInfo)
Find locationInfo by uint32
Click to show internal directories.
Click to hide internal directories.