geo

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package geo implements geographic functions such as location of an IP address.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type City

type City struct {
	Confidence int               `json:"confidence,omitempty"`
	GeoNameId  int               `json:"geoname_id,omitempty"`
	Names      map[string]string `json:"names,omitempty"`
}

type Continent

type Continent struct {
	Code      string            `json:"code,omitempty"`
	GeoNameId int               `json:"geoname_id,omitempty"`
	Names     map[string]string `json:"names,omitempty"`
}

type Country

type Country struct {
	Confidence int               `json:"confidence,omitempty"`
	GeoNameId  int               `json:"geoname_id,omitempty"`
	IsoCode    string            `json:"iso_code,omitempty"`
	Names      map[string]string `json:"names,omitempty"`
}

type Location

type Location struct {
	AccuracyRadius    string  `json:"accuracy_radius,omitempty"`
	AverageIncome     int     `json:"average_income,omitempty"`
	Latitude          float64 `json:"latitude,omitempty"`
	Longitude         float64 `json:"longitude,omitempty"`
	MetroCode         int     `json:"metro_code,omitempty"`
	PopulationDensity int     `json:"population_density,omitempty"`
	TimeZone          string  `json:"time_zone,omitempty"`
}

type MaxMind

type MaxMind struct {
	QueriesRemaining int `json:"queries_remaining,omitempty"`
}

type Postal

type Postal struct {
	Code       string `json:"code,omitempty"`
	Confidence int    `json:"confidence,omitempty"`
}

type RegisteredCountry

type RegisteredCountry struct {
	GeoNameId int               `json:"geoname_id,omitempty"`
	IsoCode   string            `json:"iso_code,omitempty"`
	Names     map[string]string `json:"names,omitempty"`
}

type RepresentedCountry

type RepresentedCountry struct {
	GeoNameId int               `json:"geoname_id,omitempty"`
	IsoCode   string            `json:"iso_code,omitempty"`
	Names     map[string]string `json:"names,omitempty"`
	Type      string            `json:"type,omitempty"`
}

type Response

type Response struct {
	City               City               `json:"city,omitempty"`
	Continent          Continent          `json:"continent,omitempty"`
	Country            Country            `json:"country,omitempty"`
	Location           Location           `json:"location,omitempty"`
	Postal             Postal             `json:"postal,omitempty"`
	RegisteredCountry  RegisteredCountry  `json:"registered_country,omitempty"`
	RepresentedCountry RepresentedCountry `json:"represented_country,omitempty"`
	Subdivisions       []Subdivision      `json:"subdivisions,omitempty"`
	Traits             Traits             `json:"traits,omitempty"`
	MaxMind            MaxMind            `json:"maxmind,omitempty"`
}

func Locate

func Locate(address string) (*Response, error)

Locate locates an IP address or hostname using MaxMind demo. If a hostname it given, it first resolves to an IP. It is limited to 25 addresses per day.

func (*Response) String

func (r *Response) String() string

type Subdivision

type Subdivision struct {
	Confidence int               `json:"confidence,omitempty"`
	GeoNameId  int               `json:"geoname_id,omitempty"`
	IsoCode    string            `json:"iso_code,omitempty"`
	Names      map[string]string `json:"names,omitempty"`
}

type Traits

type Traits struct {
	AS                  string `json:"autonomous_system_number,omitempty"`
	ASOrg               string `json:"autonomous_system_organization,omitempty"`
	Domain              string `json:"domain,omitempty"`
	IsAnonymousProxy    bool   `json:"is_anonymous_proxy,omitempty"`
	IsSatelliteProvider bool   `json:"is_satellite_provider,omitempty"`
	ISP                 string `json:"isp,omitempty"`
	IP                  string `json:"ip_address,omitempty"`
	Org                 string `json:"organization,omitempty"`
	UserType            string `json:"user_type,omitempty"`
}

Directories

Path Synopsis
GeoIP client.
GeoIP client.

Jump to

Keyboard shortcuts

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