Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // GetLocation gets the location for the given ip GetLocation(ctx context.Context, ip string) (*WorldLocation, error) }
Client is a client for the locator service.
type GetLocationFunc ¶
type GetLocationFunc func(ctx context.Context, ip string) (*WorldLocation, error)
GetLocationFunc mocks the GetIPLocation method.
type Mock ¶
type Mock struct {
// contains filtered or unexported fields
}
Mock implementation of the locator client.
func (*Mock) AddGetLocationFunc ¶
func (m *Mock) AddGetLocationFunc(f GetLocationFunc)
AddGetIPLocationFunc adds f to the mocked call sequence.
func (*Mock) GetLocation ¶
GetLocation implements the Client interface.
func (*Mock) SetGetLocationFunc ¶
func (m *Mock) SetGetLocationFunc(f GetLocationFunc)
SetGetIPLocationFunc sets f for all calls to the mocked method.
type WorldLocation ¶
type WorldLocation struct { // Lat is the latitude of the location. Lat float64 // Long is the longitude of the location. Long float64 // City is the city of the location. City string // Region is the region/state of the location. Region string // Country is the country of the location. Country string }
WorldLocation represents the location for the given IP address.
Click to show internal directories.
Click to hide internal directories.