Versions in this module Expand all Collapse all v1 v1.1.0 Jul 2, 2026 Changes in this version type Client + func (c *Client) LookupAddr(ctx context.Context, addr netip.Addr, opts ...LookupOption) (*IPInfo, error) + func (c *Client) LookupBatchAddr(ctx context.Context, addrs []netip.Addr, opts ...LookupOption) (*IPInfoList, error) v1.0.0 Jul 2, 2026 Changes in this version + const DefaultBaseURL + const DefaultMaxBatchSize + const Version + func IsBot(userAgent string) bool + type APIError struct + Code string + ErrorCode ErrorCode + Message string + Resolution string + func (e *APIError) Error() string + type Cache interface + Get func(key string) (*IPInfo, bool) + Invalidate func(key string) + InvalidateAll func() + Set func(key string, value *IPInfo) + type CacheOption func(*InMemoryCache) + func WithMaxSize(n int) CacheOption + func WithTTL(d time.Duration) CacheOption + type Carrier struct + MCC string + MNC string + Name string + type Client struct + func New(apiKey string, opts ...Option) *Client + func (c *Client) Cache() Cache + func (c *Client) Close() error + func (c *Client) Lookup(ctx context.Context, ip string, opts ...LookupOption) (*IPInfo, error) + func (c *Client) LookupBatch(ctx context.Context, ips []string, opts ...LookupOption) (*IPInfoList, error) + func (c *Client) LookupOrigin(ctx context.Context, opts ...LookupOption) (*RequesterIPInfo, error) + func (c *Client) ParseUserAgents(ctx context.Context, userAgents ...string) (*UserAgentList, error) + type ClientError struct + Err error + Message string + func (e *ClientError) Error() string + func (e *ClientError) Unwrap() error + type Company struct + Domain string + Name string + Type CompanyType + type CompanyType string + const CompanyTypeBusiness + const CompanyTypeEducation + const CompanyTypeGovernment + const CompanyTypeHosting + const CompanyTypeISP + type Connection struct + ASN *int64 + Domain string + Organization string + Route string + Type ConnectionType + type ConnectionType string + const ConnectionTypeBusiness + const ConnectionTypeEducation + const ConnectionTypeGovernment + const ConnectionTypeHosting + const ConnectionTypeISP + const ConnectionTypeInactive + type Continent struct + Code string + Name string + type Country struct + Area float64 + Borders []string + CallingCode string + Capital string + Code string + Flag Flag + Languages []Language + Name string + Population int + PopulationDensity float64 + TLD string + type Currency struct + Code string + Format CurrencyFormat + Name string + NameNative string + Plural string + PluralNative string + Symbol string + SymbolNative string + type CurrencyFormat struct + DecimalSeparator string + GroupSeparator string + Negative CurrencyFormatAffix + Positive CurrencyFormatAffix + type CurrencyFormatAffix struct + Prefix string + Suffix string + type ErrorCode string + const ErrorCodeBadRequest + const ErrorCodeDisabledAPIKey + const ErrorCodeForbiddenIP + const ErrorCodeForbiddenIPOrigin + const ErrorCodeForbiddenOrigin + const ErrorCodeInsufficientCredits + const ErrorCodeInternal + const ErrorCodeInvalidAPIKey + const ErrorCodeInvalidASN + const ErrorCodeInvalidFilterSyntax + const ErrorCodeInvalidIPAddress + const ErrorCodeMissingAPIKey + const ErrorCodeReservedASN + const ErrorCodeReservedIPAddress + const ErrorCodeTooManyASNs + const ErrorCodeTooManyIPs + const ErrorCodeTooManyRequests + const ErrorCodeTooManyUserAgents + const ErrorCodeUnknownASN + func ParseErrorCode(raw string) ErrorCode + type Flag struct + Emoji string + EmojiUnicode string + Emojitwo string + Noto string + Twemoji string + Wikimedia string + type IPInfo struct + Carrier Carrier + Company Company + Connection Connection + Currency Currency + Hostname string + IP string + Location Location + Security Security + TimeZone TimeZone + Type IPType + type IPInfoList struct + Results []IPInfoResult + func (l *IPInfoList) All() iter.Seq2[*IPInfo, error] + func (l *IPInfoList) At(i int) (*IPInfo, error) + func (l *IPInfoList) Len() int + func (l *IPInfoList) UnmarshalJSON(data []byte) error + type IPInfoResult struct + Err *APIError + Info *IPInfo + type IPType string + const IPTypeIPv4 + const IPTypeIPv6 + const IPTypeUnknown + type InMemoryCache struct + func NewInMemoryCache(opts ...CacheOption) *InMemoryCache + func (c *InMemoryCache) Get(key string) (*IPInfo, bool) + func (c *InMemoryCache) Invalidate(key string) + func (c *InMemoryCache) InvalidateAll() + func (c *InMemoryCache) Len() int + func (c *InMemoryCache) Set(key string, value *IPInfo) + type Language struct + Code string + Name string + NativeName string + type Location struct + City string + Continent Continent + Country Country + InEU bool + Language Language + Latitude *float64 + Longitude *float64 + Postal string + Region Region + type LookupOption interface + func WithFields(expression string) LookupOption + func WithHostname(enabled bool) LookupOption + func WithParam(name, value string) LookupOption + type Option func(*Client) + func WithBaseURL(baseURL string) Option + func WithBatchConcurrency(n int) Option + func WithCache(cache Cache) Option + func WithHTTPClient(httpClient *http.Client) Option + func WithMaxBatchSize(n int) Option + func WithMaxRetries(n int) Option + func WithRetryInterval(d time.Duration) Option + func WithRetryOnServerError(enabled bool) Option + func WithRetryOnTooManyRequests(enabled bool) Option + func WithTimeout(d time.Duration) Option + func WithUserAgent(ua string) Option + type Region struct + Code string + Name string + type RequesterIPInfo struct + UserAgent *UserAgent + type Security struct + IsAbuser bool + IsAnonymous bool + IsAttacker bool + IsBogon bool + IsCloudProvider bool + IsProxy bool + IsRelay bool + IsThreat bool + IsTor bool + IsTorExit bool + IsVPN bool + type TimeZone struct + Abbreviation string + CurrentTime string + ID string + InDaylightSaving bool + Name string + Offset int + type UserAgent struct + Device UserAgentDevice + Engine UserAgentEngine + Header string + Name string + OperatingSystem UserAgentOperatingSystem + Type string + Version string + VersionMajor string + type UserAgentDevice struct + Brand string + Name string + Type string + type UserAgentEngine struct + Name string + Type string + Version string + VersionMajor string + type UserAgentList struct + Results []UserAgentResult + func (l *UserAgentList) All() iter.Seq2[*UserAgent, error] + func (l *UserAgentList) At(i int) (*UserAgent, error) + func (l *UserAgentList) Len() int + func (l *UserAgentList) UnmarshalJSON(data []byte) error + type UserAgentOperatingSystem struct + Name string + Type string + Version string + type UserAgentResult struct + Err *APIError + UserAgent *UserAgent