goip

package module
v0.0.0-...-3a2e176 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "1.0.51"

Variables

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

Functions

func GetInsideIp

func GetInsideIp(ctx context.Context) string

GetInsideIp 内网ip

func GetMacAddr

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

func IsIp(ipStr string) string

IsIp 是否ip

func IsIpConsistent

func IsIpConsistent(ipStr1, ipStr2 string) bool

IsIpConsistent 两个ip是否一致

Types

type AnalyseResult

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

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

func NewIp

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

NewIp 实例化

func (*Client) Analyse

func (c *Client) Analyse(ip string) (resp AnalyseResult)

func (*Client) CheckIpv4

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

CheckIpv4 检查数据是不是IPV4

func (*Client) CheckIpv6

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

CheckIpv6 检测是不是IPV6

func (*Client) Close

func (c *Client) Close()

func (*Client) GetGeo

func (c *Client) GetGeo() *geoip.Client

func (*Client) GetQqWry

func (c *Client) GetQqWry() *qqwry.Client

func (*Client) QueryGeoIp

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

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

func (*Client) QueryQqWry

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

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

type ClientConfig

type ClientConfig struct {
	GeoipAsnPath     string
	GeoipCityPath    string
	GeoipCountryPath string
	QqwryPath        string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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