ipapicom

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ProURL = "https://pro.ip-api.com"

Pro URL.

View Source
const StandardURL = "http://ip-api.com"

Primary URL.

Variables

View Source
var (
	ErrReservedRange = errors.New("reserved range")
	ErrPrivateRange  = errors.New("private range")
)

Functions

This section is empty.

Types

type Client

type Client interface {
	GetLocationForIP(ctx context.Context, ip string) (*Location, error)
}

func NewClient

func NewClient() Client

func NewClientWithAPIKey

func NewClientWithAPIKey(apiKey string) Client

type Location

type Location struct {
	As          string  `json:"as"`
	City        string  `json:"city"`
	Country     string  `json:"country"`
	CountryCode string  `json:"countryCode"`
	Isp         string  `json:"isp"`
	Lat         float32 `json:"lat"`
	Lon         float32 `json:"lon"`
	Message     string  `json:"message"`
	Org         string  `json:"org"`
	Query       string  `json:"query"`
	Region      string  `json:"region"`
	RegionName  string  `json:"regionName"`
	Status      string  `json:"status"`
	Timezone    string  `json:"timezone"`
	Zip         string  `json:"zip"`
}

Location contains all the relevant data for an IP.

Jump to

Keyboard shortcuts

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