Back to godoc.org
github.com/IncSW/geoip2

Package geoip2

v0.1.0
Latest Go to latest

The latest major version is .

Published: Sep 6, 2020 | License: MIT | Module: github.com/IncSW/geoip2

Index

Variables

var ErrNotFound = errors.New("not found")

type ASN

type ASN struct {
	AutonomousSystemNumber       uint32
	AutonomousSystemOrganization string
}

type ASNReader

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

func NewASNReader

func NewASNReader(buffer []byte) (*ASNReader, error)

func NewASNReaderFromFile

func NewASNReaderFromFile(filename string) (*ASNReader, error)

func (*ASNReader) Lookup

func (r *ASNReader) Lookup(ip net.IP) (*ASN, error)

type AnonymousIP

type AnonymousIP struct {
	IsAnonymous       bool
	IsAnonymousVPN    bool
	IsHostingProvider bool
	IsPublicProxy     bool
	IsTorExitNode     bool
}

type AnonymousIPReader

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

func NewAnonymousIPReader

func NewAnonymousIPReader(buffer []byte) (*AnonymousIPReader, error)

func NewAnonymousIPReaderFromFile

func NewAnonymousIPReaderFromFile(filename string) (*AnonymousIPReader, error)

func (*AnonymousIPReader) Lookup

func (r *AnonymousIPReader) Lookup(ip net.IP) (*AnonymousIP, error)

type City

type City struct {
	GeoNameID  uint32
	Names      map[string]string
	Confidence uint16 // Enterprise
}

type CityReader

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

func NewCityReader

func NewCityReader(buffer []byte) (*CityReader, error)

func NewCityReaderFromFile

func NewCityReaderFromFile(filename string) (*CityReader, error)

func NewEnterpriseReader

func NewEnterpriseReader(buffer []byte) (*CityReader, error)

func NewEnterpriseReaderFromFile

func NewEnterpriseReaderFromFile(filename string) (*CityReader, error)

func (*CityReader) Lookup

func (r *CityReader) Lookup(ip net.IP) (*CityResult, error)

type CityResult

type CityResult struct {
	Continent          Continent
	Country            Country
	Subdivisions       []Subdivision
	City               City
	Location           Location
	Postal             Postal
	RegisteredCountry  Country
	RepresentedCountry Country
	Traits             Traits
}

type ConnectionType

type ConnectionType struct {
	ConnectionType string
}

type ConnectionTypeReader

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

func NewConnectionTypeReader

func NewConnectionTypeReader(buffer []byte) (*ConnectionTypeReader, error)

func NewConnectionTypeReaderFromFile

func NewConnectionTypeReaderFromFile(filename string) (*ConnectionTypeReader, error)

func (*ConnectionTypeReader) Lookup

func (r *ConnectionTypeReader) Lookup(ip net.IP) (string, error)

type Continent

type Continent struct {
	GeoNameID uint32
	Code      string
	Names     map[string]string
}

type Country

type Country struct {
	GeoNameID         uint32
	ISOCode           string
	Names             map[string]string
	IsInEuropeanUnion bool
	Type              string // [RepresentedCountry]
	Confidence        uint16 // Enterprise [Country, RegisteredCountry]
}

type CountryReader

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

func NewCountryReader

func NewCountryReader(buffer []byte) (*CountryReader, error)

func NewCountryReaderFromFile

func NewCountryReaderFromFile(filename string) (*CountryReader, error)

func (*CountryReader) Lookup

func (r *CountryReader) Lookup(ip net.IP) (*CountryResult, error)

type CountryResult

type CountryResult struct {
	Continent          Continent
	Country            Country
	RegisteredCountry  Country
	RepresentedCountry Country
	Traits             Traits
}

type Domain

type Domain struct {
	Domain string
}

type DomainReader

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

func NewDomainReader

func NewDomainReader(buffer []byte) (*DomainReader, error)

func NewDomainReaderFromFile

func NewDomainReaderFromFile(filename string) (*DomainReader, error)

func (*DomainReader) Lookup

func (r *DomainReader) Lookup(ip net.IP) (string, error)

type ISP

type ISP struct {
	AutonomousSystemNumber       uint32
	AutonomousSystemOrganization string
	ISP                          string
	Organization                 string
}

type ISPReader

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

func NewISPReader

func NewISPReader(buffer []byte) (*ISPReader, error)

func NewISPReaderFromFile

func NewISPReaderFromFile(filename string) (*ISPReader, error)

func (*ISPReader) Lookup

func (r *ISPReader) Lookup(ip net.IP) (*ISP, error)

type Location

type Location struct {
	AccuracyRadius uint16
	MetroCode      uint16
	Latitude       float64
	Longitude      float64
	TimeZone       string
}

type Metadata

type Metadata struct {
	NodeCount                uint32            // node_count This is an unsigned 32-bit integer indicating the number of nodes in the search tree.
	RecordSize               uint16            // record_size This is an unsigned 16-bit integer. It indicates the number of bits in a record in the search tree. Note that each node consists of two records.
	IPVersion                uint16            // ip_version This is an unsigned 16-bit integer which is always 4 or 6. It indicates whether the database contains IPv4 or IPv6 address data.
	DatabaseType             string            // database_type This is a string that indicates the structure of each data record associated with an IP address. The actual definition of these structures is left up to the database creator. Names starting with “GeoIP” are reserved for use by MaxMind (and “GeoIP” is a trademark anyway).
	Languages                []string          // languages An array of strings, each of which is a locale code. A given record may contain data items that have been localized to some or all of these locales. Records should not contain localized data for locales not included in this array. This is an optional key, as this may not be relevant for all types of data.
	BinaryFormatMajorVersion uint16            // binary_format_major_version This is an unsigned 16-bit integer indicating the major version number for the database’s binary format.
	BinaryFormatMinorVersion uint16            // binary_format_minor_version This is an unsigned 16-bit integer indicating the minor version number for the database’s binary format.
	BuildEpoch               uint64            // build_epoch This is an unsigned 64-bit integer that contains the database build timestamp as a Unix epoch value.
	Description              map[string]string // description This key will always point to a map. The keys of that map will be language codes, and the values will be a description in that language as a UTF-8 string. The codes may include additional information such as script or country identifiers, like “zh-TW” or “mn-Cyrl-MN”. The additional identifiers will be separated by a dash character (“-“).
}

type Postal

type Postal struct {
	Code       string
	Confidence uint16 // Enterprise
}

type Subdivision

type Subdivision struct {
	GeoNameID  uint32
	ISOCode    string
	Names      map[string]string
	Confidence uint16 // Enterprise
}

type Traits

type Traits struct {
	IsAnonymousProxy             bool
	IsSatelliteProvider          bool
	IsLegitimateProxy            bool    // Enterprise
	StaticIPScore                float64 // Enterprise
	AutonomousSystemNumber       uint32  // Enterprise
	AutonomousSystemOrganization string  // Enterprise
	ISP                          string  // Enterprise
	Organization                 string  // Enterprise
	ConnectionType               string  // Enterprise
	Domain                       string  // Enterprise
	UserType                     string  // Enterprise
}

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier