repository

package
v0.0.0-...-8d8f565 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGeoIPCSVNotReady = fmt.Errorf("geoip csv dump is %w", utils.ErrNotReady)
	ErrGeoIPCSVDisabled = fmt.Errorf("geoip csv dump is %w", utils.ErrDisabled)

	ErrCSVNotSupported = fmt.Errorf("%w: csv format", errors.ErrUnsupported)
	ErrDBNotAvailable  = fmt.Errorf("db %w", utils.ErrNotAvailable)
)

Functions

This section is empty.

Types

type DumpFormat

type DumpFormat string
const (
	DumpFormatCSV        DumpFormat = "csv"
	DumpFormatGzippedCSV DumpFormat = "csv.gz"
	DumpFormatMMDB       DumpFormat = "mmdb"
)

type GeoIPRepository

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

func NewGeoIPRepository

func NewGeoIPRepository(dbCityPath, dbISPPath string, csvDirPath string) *GeoIPRepository

func (*GeoIPRepository) City

func (r *GeoIPRepository) City(ctx context.Context, ip net.IP, includeISP bool) (*entity.City, error)

func (*GeoIPRepository) CityLite

func (r *GeoIPRepository) CityLite(ctx context.Context, ip net.IP, lang string) (*entity.CityLite, error)

func (*GeoIPRepository) Country

func (r *GeoIPRepository) Country(ctx context.Context, ip net.IP) (*entity.Country, error)

func (*GeoIPRepository) Database

func (r *GeoIPRepository) Database(ctx context.Context, dbType MaxmindDBType, format DumpFormat) (*entity.Database, error)

func (*GeoIPRepository) MetaData

func (r *GeoIPRepository) MetaData(ctx context.Context, dbType MaxmindDBType) (*entity.MetaData, error)

type GeoNameRepository

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

func NewGeoNamesRepository

func NewGeoNamesRepository(storage geonames.Storage) *GeoNameRepository

func (*GeoNameRepository) Cities

func (*GeoNameRepository) Continents

func (*GeoNameRepository) Countries

func (*GeoNameRepository) Dump

func (r *GeoNameRepository) Dump(ctx context.Context, format DumpFormat) ([]byte, error)

func (*GeoNameRepository) Subdivisions

type MaxmindDBType

type MaxmindDBType string
const (
	MaxmindDBTypeCity MaxmindDBType = "city"
	MaxmindDBTypeISP  MaxmindDBType = "isp"
)

Jump to

Keyboard shortcuts

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