ipgeo

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: GPL-3.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IPPools = IPPool{
	// contains filtered or unexported fields
}
View Source
var LangMap = map[string]string{
	"en": "en",
	"cn": "zh",
}

LangMap shows language mapping for IPDB.One API

Functions

func LtdCodeToCountryOrAreaName

func LtdCodeToCountryOrAreaName(Code string) string

Types

type IPDBOneClient added in v1.4.1

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

IPDBOneClient handles communication with IPDB.One API

func NewIPDBOneClient added in v1.4.1

func NewIPDBOneClient() *IPDBOneClient

NewIPDBOneClient creates a new client for IPDB.One with default configuration

func (*IPDBOneClient) LookupIP added in v1.4.1

func (c *IPDBOneClient) LookupIP(ip string, lang string) (*IPGeoData, error)

LookupIP queries the IP information from IPDB.One

type IPDBOneConfig added in v1.4.1

type IPDBOneConfig struct {
	BaseURL string
	ApiID   string
	ApiKey  string
}

IPDBOneConfig holds the configuration for IPDB.One service

func GetDefaultConfig added in v1.4.1

func GetDefaultConfig() *IPDBOneConfig

GetDefaultConfig returns the default configuration with fallback values

type IPDBOneTokenCache added in v1.4.1

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

IPDBOneTokenCache manages the caching of auth tokens

func (*IPDBOneTokenCache) GetToken added in v1.4.1

func (c *IPDBOneTokenCache) GetToken() string

GetToken retrieves cached token if valid, otherwise returns empty string

func (*IPDBOneTokenCache) SetToken added in v1.4.1

func (c *IPDBOneTokenCache) SetToken(token string, expiresIn time.Duration)

SetToken updates the token with its expiration time

type IPGeoData

type IPGeoData struct {
	IP        string              `json:"ip"`
	Asnumber  string              `json:"asnumber"`
	Country   string              `json:"country"`
	CountryEn string              `json:"country_en"`
	Prov      string              `json:"prov"`
	ProvEn    string              `json:"prov_en"`
	City      string              `json:"city"`
	CityEn    string              `json:"city_en"`
	District  string              `json:"district"`
	Owner     string              `json:"owner"`
	Isp       string              `json:"isp"`
	Domain    string              `json:"domain"`
	Whois     string              `json:"whois"`
	Lat       float64             `json:"lat"`
	Lng       float64             `json:"lng"`
	Prefix    string              `json:"prefix"`
	Router    map[string][]string `json:"router"`
	Source    string              `json:"source"`
}

func Chunzhen

func Chunzhen(ip string, timeout time.Duration, _ string, _ bool) (*IPGeoData, error)

func DN42

func DN42(ip string, _ time.Duration, _ string, _ bool) (*IPGeoData, error)

func Filter

func Filter(ip string) (*IPGeoData, bool)

Filter 被选到的返回 geodata, true 否则返回 nil, false

func IPApiCom

func IPApiCom(ip string, timeout time.Duration, _ string, _ bool) (*IPGeoData, error)

func IPDBOne added in v1.4.1

func IPDBOne(ip string, timeout time.Duration, lang string, _ bool) (*IPGeoData, error)

IPDBOne looks up IP information from IPDB.One (maintains backward compatibility)

func IPInSight

func IPInSight(ip string, timeout time.Duration, _ string, _ bool) (*IPGeoData, error)

func IPInfo

func IPInfo(ip string, timeout time.Duration, _ string, _ bool) (*IPGeoData, error)

func IPInfoLocal

func IPInfoLocal(ip string, _ time.Duration, _ string, _ bool) (*IPGeoData, error)

func IPSB

func IPSB(ip string, timeout time.Duration, _ string, _ bool) (*IPGeoData, error)

func LeoIP

func LeoIP(ip string, timeout time.Duration, lang string, maptrace bool) (*IPGeoData, error)

type IPPool

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

IPPool IP 查询池 map - ip - ip channel

type Source

type Source = func(ip string, timeout time.Duration, lang string, maptrace bool) (*IPGeoData, error)

func GetSource

func GetSource(s string) Source

func GetSourceWithGeoDNS added in v1.5.2

func GetSourceWithGeoDNS(s string, dotServer string) Source

Jump to

Keyboard shortcuts

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