Documentation
¶
Index ¶
- Variables
- func GetInsideIp(ctx context.Context) string
- func GetMacAddr(ctx context.Context) (arrays []string)
- func GetOutsideIp(ctx context.Context) string
- func Ips(ctx context.Context) (map[string]string, error)
- func IsIp(ipStr string) string
- func IsIpConsistent(ipStr1, ipStr2 string) bool
- type AnalyseResult
- type Client
- func (c *Client) Analyse(item string) AnalyseResult
- func (c *Client) CheckIpv4(ips string) bool
- func (c *Client) CheckIpv6(ips string) bool
- func (c *Client) Close()
- func (c *Client) QueryGeoIp(ipAddress net.IP) (result geoip.QueryCityResult, err error)
- func (c *Client) QueryIp2Region(ipAddress net.IP) (result ip2region.QueryResult, err error)
- func (c *Client) QueryIp2RegionV2(ipAddress net.IP) (result ip2region_v2.QueryResult, err error)
- func (c *Client) QueryIpv6wry(ipAddress net.IP) (result ipv6wry.QueryResult, err error)
- func (c *Client) QueryQqWry(ipAddress net.IP) (result qqwry.QueryResult, err error)
- type ClientConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var (
QueryIncorrect = errors.New("ip地址不正确")
)
Functions ¶
func GetMacAddr ¶ added in v1.0.47
GetMacAddr 获取Mac地址
func IsIpConsistent ¶ added in v1.0.52
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 (*Client) Analyse ¶ added in v1.0.47
func (c *Client) Analyse(item string) AnalyseResult
func (*Client) QueryGeoIp ¶ added in v1.0.52
QueryGeoIp ip2region https://www.maxmind.com/
func (*Client) QueryIp2Region ¶ added in v1.0.52
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
QueryIpv6wry ip2region https://ip.zxinc.org
func (*Client) QueryQqWry ¶ added in v1.0.52
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
}
Click to show internal directories.
Click to hide internal directories.