Documentation
¶
Index ¶
- Constants
- Variables
- func CanonicalizeNextTraceAPIProvider(provider string) string
- func IsNextTraceAPIProvider(provider string) bool
- func LtdCodeToCountryOrAreaName(Code string) string
- func NextTraceAPIV4TokenConfigured() bool
- func PrepareNextTraceAPIV4FastIP(ctx context.Context, enableOutput bool) error
- type IPDBOneClient
- type IPDBOneConfig
- type IPDBOneTokenCache
- type IPGeoData
- func Chunzhen(ip string, timeout time.Duration, _ string, _ bool) (*IPGeoData, error)
- func DN42(ip string, _ time.Duration, _ string, _ bool) (*IPGeoData, error)
- func Filter(ip string) (*IPGeoData, bool)
- func IPApiCom(ip string, timeout time.Duration, _ string, _ bool) (*IPGeoData, error)
- func IPDBOne(ip string, timeout time.Duration, lang string, _ bool) (*IPGeoData, error)
- func IPInSight(ip string, timeout time.Duration, _ string, _ bool) (*IPGeoData, error)
- func IPInfo(ip string, timeout time.Duration, _ string, _ bool) (*IPGeoData, error)
- func IPInfoLocal(ip string, _ time.Duration, _ string, _ bool) (*IPGeoData, error)
- func IPSB(ip string, timeout time.Duration, _ string, _ bool) (*IPGeoData, error)
- func LeoIP(ip string, timeout time.Duration, lang string, maptrace bool) (*IPGeoData, error)
- func LeoIPNextTraceAPIV4HTTP(ip string, timeout time.Duration, lang string, maptrace bool) (*IPGeoData, error)
- func NextTraceAPIV3GeoIP(ip string, timeout time.Duration, lang string, maptrace bool) (*IPGeoData, error)
- func NextTraceAPIV4GeoIP(ip string, timeout time.Duration, lang string, maptrace bool) (*IPGeoData, error)
- type IPPool
- type NextTraceAPIV4Client
- type NextTraceAPIV4Quota
- type Source
Constants ¶
const NextTraceAPIProvider = "NextTrace-API"
NextTraceAPIProvider is the canonical data-provider value for the official API.
const (
NextTraceAPIV4TokenPageURL = "https://api.nxtrace.org/v4/api-tokens"
)
Variables ¶
var IPPools = IPPool{ // contains filtered or unexported fields }
var LangMap = map[string]string{
"en": "en",
"cn": "zh",
}
LangMap shows language mapping for IPDB.One API
Functions ¶
func CanonicalizeNextTraceAPIProvider ¶ added in v1.7.3
CanonicalizeNextTraceAPIProvider maps current and legacy official API names to the canonical value.
func IsNextTraceAPIProvider ¶ added in v1.7.3
IsNextTraceAPIProvider reports whether provider names the official API or a legacy alias.
func NextTraceAPIV4TokenConfigured ¶ added in v1.7.0
func NextTraceAPIV4TokenConfigured() bool
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
type IPDBOneConfig ¶ added in v1.4.1
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
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 IPDBOne ¶ added in v1.4.1
IPDBOne looks up IP information from IPDB.One (maintains backward compatibility)
func IPInfoLocal ¶
func LeoIPNextTraceAPIV4HTTP ¶ added in v1.7.0
func LeoIPNextTraceAPIV4HTTP(ip string, timeout time.Duration, lang string, maptrace bool) (*IPGeoData, error)
LeoIPNextTraceAPIV4HTTP is kept for source compatibility. Deprecated: use NextTraceAPIV4GeoIP.
type IPPool ¶
type IPPool struct {
// contains filtered or unexported fields
}
IPPool IP 查询池 map - ip - ip channel
type NextTraceAPIV4Client ¶ added in v1.7.0
type NextTraceAPIV4Client struct {
// contains filtered or unexported fields
}
func NewNextTraceAPIV4Client ¶ added in v1.7.0
func NewNextTraceAPIV4Client(endpoint string, token string, httpClient *http.Client) *NextTraceAPIV4Client
func (*NextTraceAPIV4Client) Lookup ¶ added in v1.7.0
func (c *NextTraceAPIV4Client) Lookup(ctx context.Context, ip string) (*IPGeoData, NextTraceAPIV4Quota, error)
type NextTraceAPIV4Quota ¶ added in v1.7.0
type Source ¶
type Source = func(ip string, timeout time.Duration, lang string, maptrace bool) (*IPGeoData, error)
func GetSourceWithGeoDNS ¶ added in v1.5.2
func LeoMoeAPISource ¶ added in v1.7.0
func LeoMoeAPISource() Source
LeoMoeAPISource is kept for source compatibility. Deprecated: use NextTraceAPISource.
func NextTraceAPISource ¶ added in v1.7.3
func NextTraceAPISource() Source
NextTraceAPISource selects v4 when a token is configured and otherwise uses v3.