Documentation ¶
Index ¶
- type City
- type ConnectionType
- type Continent
- type Country
- type Domain
- type ISP
- type Location
- type Postal
- type Reader
- func (r *Reader) City(ipAddress net.IP) (*City, error)
- func (r *Reader) Close()
- func (r *Reader) ConnectionType(ipAddress net.IP) (*ConnectionType, error)
- func (r *Reader) Country(ipAddress net.IP) (*Country, error)
- func (r *Reader) Domain(ipAddress net.IP) (*Domain, error)
- func (r *Reader) ISP(ipAddress net.IP) (*ISP, error)
- func (mj *Reader) MarshalJSON() ([]byte, error)
- func (mj *Reader) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- type RegisteredCountry
- type RepresentedCountry
- type Subdivision
- type TheCity
- type TheCountry
- type Traits
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type City ¶
type City struct { City TheCity `maxminddb:"city"` Continent Continent `maxminddb:"continent"` Country TheCountry `maxminddb:"country"` Location Location `maxminddb:"location"` Postal Postal `maxminddb:"postal"` RegisteredCountry RegisteredCountry `maxminddb:"registered_country"` RepresentedCountry RepresentedCountry `maxminddb:"represented_country"` Subdivisions []Subdivision `maxminddb:"subdivisions"` Traits Traits `maxminddb:"traits"` }
The City structure corresponds to the data in the GeoIP2/GeoLite2 City databases.
func (*City) MarshalJSON ¶
func (*City) MarshalJSONBuf ¶
func (mj *City) MarshalJSONBuf(buf fflib.EncodingBuffer) error
type ConnectionType ¶
type ConnectionType struct {
ConnectionType string `maxminddb:"connection_type"`
}
The ConnectionType structure corresponds to the data in the GeoIP2 Connection-Type database.
func (*ConnectionType) MarshalJSON ¶
func (mj *ConnectionType) MarshalJSON() ([]byte, error)
func (*ConnectionType) MarshalJSONBuf ¶
func (mj *ConnectionType) MarshalJSONBuf(buf fflib.EncodingBuffer) error
type Continent ¶
type Continent struct { Code string `maxminddb:"code"` GeoNameID uint `maxminddb:"geoname_id"` Names map[string]string `maxminddb:"names"` }
func (*Continent) MarshalJSON ¶
func (*Continent) MarshalJSONBuf ¶
func (mj *Continent) MarshalJSONBuf(buf fflib.EncodingBuffer) error
type Country ¶
type Country struct { Continent Continent `maxminddb:"continent"` Country TheCountry `maxminddb:"country"` RegisteredCountry RegisteredCountry `maxminddb:"registered_country"` RepresentedCountry RepresentedCountry `maxminddb:"represented_country"` Subdivisions []Subdivision `maxminddb:"subdivisions"` Traits Traits `maxminddb:"traits"` }
The Country structure corresponds to the data in the GeoIP2/GeoLite2 Country databases.
func (*Country) MarshalJSON ¶
func (*Country) MarshalJSONBuf ¶
func (mj *Country) MarshalJSONBuf(buf fflib.EncodingBuffer) error
type Domain ¶
type Domain struct {
Domain string `maxminddb:"domain"`
}
The Domain structure corresponds to the data in the GeoIP2 Domain database.
func (*Domain) MarshalJSON ¶
func (*Domain) MarshalJSONBuf ¶
func (mj *Domain) MarshalJSONBuf(buf fflib.EncodingBuffer) error
type ISP ¶
type ISP struct { AutonomousSystemNumber uint `maxminddb:"autonomous_system_number"` AutonomousSystemOrganization string `maxminddb:"autonomous_system_organization"` ISP string `maxminddb:"isp"` Organization string `maxminddb:"organization"` }
The ISP structure corresponds to the data in the GeoIP2 ISP database.
func (*ISP) MarshalJSON ¶
func (*ISP) MarshalJSONBuf ¶
func (mj *ISP) MarshalJSONBuf(buf fflib.EncodingBuffer) error
type Location ¶
type Location struct { Latitude float64 `maxminddb:"latitude"` Longitude float64 `maxminddb:"longitude"` MetroCode uint `maxminddb:"metro_code"` TimeZone string `maxminddb:"time_zone"` }
func (*Location) MarshalJSON ¶
func (*Location) MarshalJSONBuf ¶
func (mj *Location) MarshalJSONBuf(buf fflib.EncodingBuffer) error
type Postal ¶
type Postal struct {
Code string `maxminddb:"code"`
}
func (*Postal) MarshalJSON ¶
func (*Postal) MarshalJSONBuf ¶
func (mj *Postal) MarshalJSONBuf(buf fflib.EncodingBuffer) error
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader holds the maxminddb.Reader structure. It should be created using the Open function.
func FromBytes ¶
FromBytes takes a byte slice corresponding to a GeoIP2/GeoLite2 database file and returns a Reader structure or an error.
func Open ¶
Open takes a string path to a file and returns a Reader structure or an error. The database file is opened using a memory map. Use the Close method on the Reader object to return the resources to the system.
func (*Reader) City ¶
City takes an IP address as a net.IP struct and returns a City struct and/or an error. Although this can be used with other databases, this method generally should be used with the GeoIP2 or GeoLite2 City databases.
func (*Reader) Close ¶
func (r *Reader) Close()
Close unmaps the database file from virtual memory and returns the resources to the system.
func (*Reader) ConnectionType ¶
func (r *Reader) ConnectionType(ipAddress net.IP) (*ConnectionType, error)
ConnectionType takes an IP address as a net.IP struct and returns a ConnectionType struct and/or an error
func (*Reader) Country ¶
Country takes an IP address as a net.IP struct and returns a Country struct and/or an error. Although this can be used with other databases, this method generally should be used with the GeoIP2 or GeoLite2 Country databases.
func (*Reader) Domain ¶
Domain takes an IP address as a net.IP struct and returns a Domain struct and/or an error
func (*Reader) ISP ¶
ISP takes an IP address as a net.IP struct and returns a ISP struct and/or an error
func (*Reader) MarshalJSON ¶
func (*Reader) MarshalJSONBuf ¶
func (mj *Reader) MarshalJSONBuf(buf fflib.EncodingBuffer) error
type RegisteredCountry ¶
type RegisteredCountry struct { GeoNameID uint `maxminddb:"geoname_id"` IsoCode string `maxminddb:"iso_code"` Names map[string]string `maxminddb:"names"` }
func (*RegisteredCountry) MarshalJSON ¶
func (mj *RegisteredCountry) MarshalJSON() ([]byte, error)
func (*RegisteredCountry) MarshalJSONBuf ¶
func (mj *RegisteredCountry) MarshalJSONBuf(buf fflib.EncodingBuffer) error
type RepresentedCountry ¶
type RepresentedCountry struct { GeoNameID uint `maxminddb:"geoname_id"` IsoCode string `maxminddb:"iso_code"` Names map[string]string `maxminddb:"names"` Type string `maxminddb:"type"` }
func (*RepresentedCountry) MarshalJSON ¶
func (mj *RepresentedCountry) MarshalJSON() ([]byte, error)
func (*RepresentedCountry) MarshalJSONBuf ¶
func (mj *RepresentedCountry) MarshalJSONBuf(buf fflib.EncodingBuffer) error
type Subdivision ¶
type Subdivision struct { GeoNameID uint `maxminddb:"geoname_id"` IsoCode string `maxminddb:"iso_code"` Names map[string]string `maxminddb:"names"` }
func (*Subdivision) MarshalJSON ¶
func (mj *Subdivision) MarshalJSON() ([]byte, error)
func (*Subdivision) MarshalJSONBuf ¶
func (mj *Subdivision) MarshalJSONBuf(buf fflib.EncodingBuffer) error
type TheCity ¶
type TheCity struct { GeoNameID uint `maxminddb:"geoname_id"` Names map[string]string `maxminddb:"names"` }
func (*TheCity) MarshalJSON ¶
func (*TheCity) MarshalJSONBuf ¶
func (mj *TheCity) MarshalJSONBuf(buf fflib.EncodingBuffer) error
type TheCountry ¶
type TheCountry struct { GeoNameID uint `maxminddb:"geoname_id"` IsoCode string `maxminddb:"iso_code"` Names map[string]string `maxminddb:"names"` }
func (*TheCountry) MarshalJSON ¶
func (mj *TheCountry) MarshalJSON() ([]byte, error)
func (*TheCountry) MarshalJSONBuf ¶
func (mj *TheCountry) MarshalJSONBuf(buf fflib.EncodingBuffer) error
type Traits ¶
type Traits struct { IsAnonymousProxy bool `maxminddb:"is_anonymous_proxy"` IsSatelliteProvider bool `maxminddb:"is_satellite_provider"` }
func (*Traits) MarshalJSON ¶
func (*Traits) MarshalJSONBuf ¶
func (mj *Traits) MarshalJSONBuf(buf fflib.EncodingBuffer) error