v0.1.0 Latest Latest

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

Go to latest
Published: Mar 20, 2018 License: MIT Imports: 5 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Client

type Client struct {
	UserAgent string
	APIKey    string
	// contains filtered or unexported fields

Client represent the wrapper for ipdata.co

func NewClient

func NewClient(httpClient *http.Client) (*Client, error)

NewClient generates a new Client. If nil is passed, http.DefaultClient will be used.

func (*Client) GetIPData

func (c *Client) GetIPData(ip string) (*Data, error)

GetIPData retrieves information about the ip from ipdata.co and returns a valid Data if no error occurs.

func (*Client) GetMyIPData

func (c *Client) GetMyIPData() (*Data, error)

GetMyIPData retrieves information about your public IP address.

type Data

type Data struct {
	IP             string  `json:"ip"`
	City           string  `json:"city"`
	Region         string  `json:"region"`
	CountryName    string  `json:"country_name"`
	CountryCode    string  `json:"country_code"`
	ContinentName  string  `json:"continent_name"`
	ContinentCode  string  `json:"continent_code"`
	Latitude       float32 `json:"latitude"`
	Longitude      float32 `json:"longitude"`
	ASN            string  `json:"asn"`
	Organisation   string  `json:"organisation"`
	Postal         string  `json:"postal"`
	Currency       string  `json:"currency"`
	CurrencySymbol string  `json:"currency_symbol"`
	CallingCode    string  `json:"calling_code"`
	Flag           string  `json:"flag"`
	TimeZone       string  `json:"time_zone"`
	JSON           *string

Data represent the information retrieved from ipdata.com

Jump to

Keyboard shortcuts

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