Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPToCountry ¶
type IPToCountry interface { Close() error LookupISOCountryCode(address string) (location.CountryCode, error) }
IPToCountry defines an abstraction for resolving the ISO country code given the string representation of an IP address.
type MaxmindDB ¶
type MaxmindDB struct {
// contains filtered or unexported fields
}
MaxmindDB provides access to GeoIP data via the maxmind geoip databases.
func OpenMaxmindDB ¶
OpenMaxmindDB will use the provided filepath to open the target maxmind database.
func (*MaxmindDB) LookupISOCountryCode ¶
func (m *MaxmindDB) LookupISOCountryCode(address string) (location.CountryCode, error)
LookupISOCountryCode accepts an IP address.
type MockIPToCountry ¶
type MockIPToCountry []location.CountryCode
MockIPToCountry provides a mock solution for looking up country codes in testplanet tests. This is done using the last byte of the ip address and mod'ing it into a country code.
func NewMockIPToCountry ¶
func NewMockIPToCountry(countries []string) MockIPToCountry
NewMockIPToCountry creates a mock IPToCountry based on predefined country list.
func (MockIPToCountry) Close ¶
func (m MockIPToCountry) Close() error
Close does nothing for the MockIPToCountry.
func (MockIPToCountry) LookupISOCountryCode ¶
func (m MockIPToCountry) LookupISOCountryCode(address string) (location.CountryCode, error)
LookupISOCountryCode accepts an IP address.