geoip

package
v1.0.48 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGeoLite2AsnDownloadUrl added in v1.0.32

func GetGeoLite2AsnDownloadUrl(licenseKey string) string

func GetGeoLite2CityDownloadUrl added in v1.0.32

func GetGeoLite2CityDownloadUrl(licenseKey string) string

func GetGeoLite2CountryDownloadUrl added in v1.0.32

func GetGeoLite2CountryDownloadUrl(licenseKey string) string

func OnlineDownload

func OnlineDownload(downloadUrl string, downloadName string)

Types

type Client

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

func New

func New(asnFilepath string, cityFilepath string, countryFilepath string) (*Client, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) QueryCity

func (c *Client) QueryCity(ipAddress string) (result QueryCityResult, err error)

type QueryCityResult

type QueryCityResult struct {
	Ip        string `json:"ip,omitempty"` // ip
	Continent struct {
		Code string `json:"code,omitempty"` // 大陆代码
		Name string `json:"name,omitempty"` // 大陆名称
	} `json:"continent,omitempty"`
	Country struct {
		Code string `json:"code,omitempty"` // 国家代码
		Name string `json:"name,omitempty"` // 国家名称
	} `json:"country,omitempty"`
	Province struct {
		Code string `json:"code,omitempty"` // 省份代码
		Name string `json:"name,omitempty"` // 省份名称
	} `json:"province,omitempty"`
	City struct {
		Name string `json:"name,omitempty"` // 城市名称
	} `json:"city,omitempty"`
	Location struct {
		TimeZone  string  `json:"time_zone,omitempty"` // 位置时区
		Latitude  float64 `json:"latitude,omitempty"`  // 坐标纬度
		Longitude float64 `json:"longitude,omitempty"` // 坐标经度
	} `json:"location,omitempty"`
}

QueryCityResult 返回

Jump to

Keyboard shortcuts

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