geoip

package module
v1.1.1-0...-b77ff5c Latest Latest
Warning

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

Go to latest
Published: May 15, 2021 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Anonymous

type Anonymous struct {
	// from geoip2-golang.AnonymousIP
	IsAnonymous       bool `json:"is_anonymous"`
	IsAnonymousVPN    bool `json:"is_anonymous_vpn"`
	IsHostingProvider bool `json:"is_hosting_provider"`
	IsPublicProxy     bool `json:"is_public_proxy"`
	IsTorExitNode     bool `json:"is_tor_exit_node"`
}

Anonymous contains information about whether an IP address is anonymous

type City

type City struct {
	Name                   string   `json:"name"`
	Continent              string   `json:"continent"`
	ContinentCode          string   `json:"continent_code"`
	Country                string   `json:"country"`
	CountryCode            string   `json:"country_code"`
	AccuracyRadius         uint16   `json:"accuracy_radius"`
	Latitude               float64  `json:"latitude"`
	Longitude              float64  `json:"longitude"`
	MetroCode              uint     `json:"metro_code"`
	Timezone               string   `json:"timezone"`
	Postcode               string   `json:"postcode"`
	RegisteredCountry      string   `json:"registered_country"`
	RegisteredCountryCode  string   `json:"registered_country_code"`
	RepresentedCountry     string   `json:"represented_country"`
	RepresentedCountryCode string   `json:"represented_country_code"`
	RepresentedCountryType string   `json:"represented_country_type"`
	Subdivisions           []string `json:"subdivisions"`
	IsAnonymousProxy       bool     `json:"is_anonymous_proxy"`
	IsSatelliteProvider    bool     `json:"is_satellite_provider"`
}

City contains geographic data on a city level for a given IP address

type ConnectionType

type ConnectionType struct {
	Type string `json:"connection_type"`
}

ConnectionType denotes the connection type for a given IP address

type Country

type Country struct {
	ContinentCode          string `json:"continent_code"`
	Continent              string `json:"continent"`
	CountryCode            string `json:"country_code"`
	Country                string `json:"country"`
	RegisteredCountryCode  string `json:"registered_country_code"`
	RegisteredCountry      string `json:"registered_country"`
	RepresentedCountryCode string `json:"represented_country_code"`
	RepresentedCountryType string `json:"represented_country_type"`
	RepresentedCountry     string `json:"represented_country"`
	IsAnonymousProxy       bool   `json:"is_anonymous_proxy"`
	IsSatelliteProvider    bool   `json:"is_satellite_provider"`
}

Country contains geographic data on a country level for a given IP address

type Domain

type Domain struct {
	Domain string `json:"domain"`
}

Domain denotes the domain for a given IP address

type GeoIP

type GeoIP struct {
	IP        net.IP    `json:"ip" bson:"ip"`
	Anonymous Anonymous `json:"anonymous" bson:"anon"`
	City      City      `json:"city" bson:"city"`
	Country   Country   `json:"country" bson:"country"`
	Domain    Domain    `json:"domain" bson:"domain"`
	ISP       ISP       `json:"isp" bson:"isp"`
	// contains filtered or unexported fields
}

GeoIP contains metadata for an IP address from the Maxmind GeoIP databases

func NewGeoIP

func NewGeoIP(baseURL string) (*GeoIP, error)

NewGeoIP creates a new GeoIP data structure

func NewGeoIPNoLoad

func NewGeoIPNoLoad() (*GeoIP, error)

NewGeoIPNoLoad creates a new geoip type without loading the data

func (*GeoIP) Close

func (g *GeoIP) Close()

Close closes the GeoIP database

func (*GeoIP) Load

func (g *GeoIP) Load(baseURL string) error

Load loads the GeoIP City Database from Maxmind

func (*GeoIP) Lookup

func (g *GeoIP) Lookup(ipAddr string) error

Lookup performs a geo ip lookup for ipAddr in the maxmind geoip database

func (*GeoIP) LookupIP

func (g *GeoIP) LookupIP(ip string) (*GeoIP, error)

LookupIP looks up the geo ip data for the given IP address

type ISP

type ISP struct {
	AutonomousSystemNumber       uint   `json:"autonomous_system_number"`
	AutonomousSystemOrganization string `json:"autonomous_system_organization"`
	ISP                          string `json:"isp"`
	Organization                 string `json:"organization"`
}

ISP contains information about the autonomous system for the given IP address

Jump to

Keyboard shortcuts

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