ipdata

package
v0.0.0-...-683df53 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ASN

type ASN struct {
	Number       uint64 `maxminddb:"autonomous_system_number"`
	Organization string `maxminddb:"autonomous_system_organization"`
}

ASN is the query response for ASN lookups

type City

type City struct {
	Continent struct {
		Names map[string]string `maxminddb:"names"`
	} `maxminddb:"continent"`
	Country struct {
		ISOCode string            `maxminddb:"iso_code"`
		Names   map[string]string `maxminddb:"names"`
	} `maxminddb:"country"`
	Region []struct {
		ISOCode string            `maxminddb:"iso_code"`
		Names   map[string]string `maxminddb:"names"`
	} `maxminddb:"subdivisions"`
	City struct {
		Names map[string]string `maxminddb:"names"`
	} `maxminddb:"city"`
	Location struct {
		Latitude  float64 `maxminddb:"latitude"`
		Longitude float64 `maxminddb:"longitude"`
		MetroCode uint    `maxminddb:"metro_code"`
		TimeZone  string  `maxminddb:"time_zone"`
	} `maxminddb:"location"`
	Postal struct {
		Code string `maxminddb:"code"`
	} `maxminddb:"postal"`
}

City is the default query used for database lookups.

type Client

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

Client contains the databases needed to get info on a particular IP address

func NewClient

func NewClient(cityPath, asnPath string) (*Client, error)

NewClient creates and returns a fully populated ipdata Client

func (*Client) Close

func (c *Client) Close()

Close performs the final task of closing the maxminddb Readers

func (*Client) Lookup

func (c *Client) Lookup(ipStr string) *IPData

Lookup performs the task of retrieving and returning the users IP address info

type IPData

type IPData struct {
	IPAddress   string  `json:"ip_address,omitempty"`
	Hostname    string  `json:"hostname,omitempty"`
	ISP         string  `json:"isp,omitempty"`
	CountryCode string  `json:"country_code,omitempty"`
	CountryName string  `json:"country_name,omitempty"`
	RegionCode  string  `json:"region_code,omitempty"`
	RegionName  string  `json:"region_name,omitempty"`
	City        string  `json:"city,omitempty"`
	ZipCode     string  `json:"zip_code,omitempty"`
	TimeZone    string  `json:"time_zone,omitempty"`
	GeoHash     string  `json:"geohash,omitempty"`
	Latitude    float64 `json:"latitude,omitempty"`
	Longitude   float64 `json:"longitude,omitempty"`
	MetroCode   uint    `json:"metro_code,omitempty"`
}

IPData is a struct that contains information about a particular IP address

Jump to

Keyboard shortcuts

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