geo

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: Apache-2.0, BSD-3-Clause Imports: 5 Imported by: 1

Documentation

Overview

Package geo provides access to the geographic data for IP addresses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Geo

type Geo struct {
	AsName           string  `json:"as_name"`           // The name of the organization associated with AsNumber
	AsNumber         int     `json:"as_number"`         // Autonomous system (AS) number
	AreaCode         int     `json:"area_code"`         // The telephone area code associated with an IP address
	City             string  `json:"city"`              // City or town name
	ConnSpeed        string  `json:"conn_speed"`        // Connection speed
	ConnType         string  `json:"conn_type"`         // Connection type
	ContinentCode    string  `json:"continent"`         // A two-character UN M.49 continent code
	CountryCode      string  `json:"country_code"`      // A two-character ISO 3166-1 country code for the country associated with an IP address
	CountryCode3     string  `json:"country_code3"`     // A three-character ISO 3166-1 alpha-3 country code for the country associated with the IP address
	CountryName      string  `json:"country_name"`      // Country name
	Latitude         float64 `json:"latitude"`          // Latitude, in units of degrees from the equator
	Longitude        float64 `json:"longitude"`         // Longitude, in units of degrees from the IERS Reference Meridian
	MetroCode        int     `json:"metro_code"`        // Metro code, representing designated market areas (DMAs) in the United States
	PostalCode       string  `json:"postal_code"`       // The postal code associated with the IP address
	ProxyDescription string  `json:"proxy_description"` // Client proxy description
	ProxyType        string  `json:"proxy_type"`        // Client proxy type
	Region           string  `json:"region"`            // ISO 3166-2 country subdivision code
	UTCOffset        int     `json:"utc_offset"`        // Time zone offset from coordinated universal time (UTC) for city
}

Geo represents the geographic data for an IP address.

func Lookup

func Lookup(ip net.IP) (*Geo, error)

Lookup returns the geographic data associated with a particular IP address.