ip

package
v0.0.0-...-512269d Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExternalIP

func ExternalIP() (res []string)

ExternalIP get external ip.

func InetAtoN

func InetAtoN(s string) (sum uint32)

InetAtoN conver ip addr to uint32.

func InetNtoA

func InetNtoA(sum uint32) string

InetNtoA conver uint32 to ip addr.

func InternalIP

func InternalIP() string

InternalIP get internal ip.

func ZoneID

func ZoneID(country, province, city string) (zoneid int64)

ZoneID make zoneid by country Name、province Name、city Name

Types

type IP

type IP struct {
	Begin        uint32
	End          uint32
	ISPCode      int
	ISP          string
	CountryCode  int
	Country      string
	ProvinceCode int
	Province     string
	CityCode     int
	City         string
	DistrictCode int
	District     string
	Latitude     float64
	Longitude    float64
}

IP ip struct info.

type List

type List struct {
	IPs []*IP
}

List struct info list.

func New

func New(path string) (list *List, err error)

New create Xip instance and return.

func (*List) All

func (l *List) All() []*IP

All return ipInfos.

func (*List) IP

func (l *List) IP(ipStr string) (ip *IP)

IP ip zone info by ip

func (*List) Zone

func (l *List) Zone(addr string) (zone *Zone)

Zone get ip info from ip

type Zone

type Zone struct {
	ID          int64   `json:"id"`
	Addr        string  `json:"addr"`
	ISP         string  `json:"isp"`
	Country     string  `json:"country"`
	Province    string  `json:"province"`
	City        string  `json:"city"`
	Latitude    float64 `json:"latitude"`
	Longitude   float64 `json:"longitude"`
	CountryCode int     `json:"country_code,omitempty"`
}

Zone ip struct info.

Jump to

Keyboard shortcuts

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