goip

package
v1.0.185 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	QueryIncorrect = errors.New("ip地址不正确")
)

Functions

func GetInsideIp

func GetInsideIp(ctx context.Context) string

GetInsideIp 内网ip

func GetMacAddr added in v1.0.47

func GetMacAddr(ctx context.Context) (arrays []string)

GetMacAddr 获取Mac地址

func GetOutsideIp

func GetOutsideIp(ctx context.Context) string

GetOutsideIp 外网ip

func Ips

func Ips(ctx context.Context) (map[string]string, error)

Ips 获取全部网卡的全部IP

func IsIp added in v1.0.52

func IsIp(ipStr string) string

IsIp 是否ip

func IsIpConsistent added in v1.0.52

func IsIpConsistent(ipStr1, ipStr2 string) bool

IsIpConsistent 两个ip是否一致

Types

type AnalyseResult added in v1.0.47

type AnalyseResult struct {
	Ip                string  `json:"ip"`                 // ip
	Continent         string  `json:"continent"`          // 大陆
	Country           string  `json:"country"`            // 国家
	Province          string  `json:"province"`           // 省份
	City              string  `json:"city"`               // 城市
	Isp               string  `json:"isp"`                // 运营商
	LocationTimeZone  string  `json:"location_time_zone"` // 位置时区
	LocationLatitude  float64 `json:"location_latitude"`  // 位置纬度
	LocationLongitude float64 `json:"location_longitude"` // 位置经度
}

type Client added in v1.0.47

type Client struct {
	// contains filtered or unexported fields
}

func NewIp added in v1.0.47

func NewIp(config *ClientConfig) (*Client, error)

NewIp 实例化

func (*Client) Analyse added in v1.0.47

func (c *Client) Analyse(item string) AnalyseResult

func (*Client) CheckIpv4 added in v1.0.47

func (c *Client) CheckIpv4(ips string) bool

CheckIpv4 检查数据是不是IPV4

func (*Client) CheckIpv6 added in v1.0.47

func (c *Client) CheckIpv6(ips string) bool

CheckIpv6 检测是不是IPV6

func (*Client) Close added in v1.0.52

func (c *Client) Close()

func (*Client) QueryGeoIp added in v1.0.52

func (c *Client) QueryGeoIp(ipAddress net.IP) (result geoip.QueryCityResult, err error)

QueryGeoIp ip2region https://www.maxmind.com/

func (*Client) QueryIp2Region added in v1.0.52

func (c *Client) QueryIp2Region(ipAddress net.IP) (result ip2region.QueryResult, err error)

QueryIp2Region ip2region https://github.com/lionsoul2014/ip2region

func (*Client) QueryIp2RegionV2 added in v1.0.52

func (c *Client) QueryIp2RegionV2(ipAddress net.IP) (result ip2region_v2.QueryResult, err error)

QueryIp2RegionV2 ip2region https://github.com/lionsoul2014/ip2region

func (*Client) QueryIpv6wry added in v1.0.52

func (c *Client) QueryIpv6wry(ipAddress net.IP) (result ipv6wry.QueryResult, err error)

QueryIpv6wry ip2region https://ip.zxinc.org

func (*Client) QueryQqWry added in v1.0.52

func (c *Client) QueryQqWry(ipAddress net.IP) (result qqwry.QueryResult, err error)

QueryQqWry 纯真IP库 https://www.cz88.net/

type ClientConfig added in v1.0.161

type ClientConfig struct {
	Ip2regionPath    string
	Ip2regionByte    []byte
	Ip2regionV2Path  string
	Ip2regionV2Byte  []byte
	QqwryPath        string
	QqwryByte        []byte
	Ipv6wryPath      string
	Ipv6wryByte      []byte
	GeoipAsnPath     string
	GeoipAsnByte     []byte
	GeoipCityPath    string
	GeoipCityByte    []byte
	GeoipCountryPath string
	GeoipCountryByte []byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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