client

package
v0.0.0-...-5f57c41 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	GeoIPClient
	GeoNameClient
}

func NewClient

func NewClient(addrs ...string) (Client, error)

func NewClientWithOpt

func NewClientWithOpt(addrs []string, opts ...Opt) (Client, error)

type GeoIPClient

type GeoIPClient interface {
	Country(ctx context.Context, address string) (*entity.Country, error)
	City(ctx context.Context, address string, includeISP bool) (*entity.City, error)
	CityLite(ctx context.Context, address, lang string) (*entity.CityLite, error)
}

type GeoNameClient

type GeoNameClient interface {
	GeoNameContinents(ctx context.Context) []*entity.GeoNameContinent
	GeoNameCountries(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameCountry, error)
	GeoNameSubdivisions(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameAdminSubdivision, error)
	GeoNameCities(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoName, error)
}

type MultiClient

type MultiClient struct {
	Clients []Client
}

func (*MultiClient) City

func (c *MultiClient) City(ctx context.Context, address string, includeISP bool) (*entity.City, error)

func (*MultiClient) CityLite

func (c *MultiClient) CityLite(ctx context.Context, address, lang string) (*entity.CityLite, error)

func (*MultiClient) Country

func (c *MultiClient) Country(ctx context.Context, address string) (*entity.Country, error)

func (*MultiClient) GeoNameCities

func (c *MultiClient) GeoNameCities(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoName, error)

func (*MultiClient) GeoNameContinents

func (c *MultiClient) GeoNameContinents(ctx context.Context) []*entity.GeoNameContinent

func (*MultiClient) GeoNameCountries

func (c *MultiClient) GeoNameCountries(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameCountry, error)

func (*MultiClient) GeoNameSubdivisions

func (c *MultiClient) GeoNameSubdivisions(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameAdminSubdivision, error)

type Opt

type Opt func(Client)

func WithApiKey

func WithApiKey(apiKey string) Opt

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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