Documentation ¶
Index ¶
- Variables
- type DumpFormat
- type GeoIPRepository
- func (r *GeoIPRepository) City(ctx context.Context, ip net.IP, includeISP bool) (*entity.City, error)
- func (r *GeoIPRepository) CityLite(ctx context.Context, ip net.IP, lang string) (*entity.CityLite, error)
- func (r *GeoIPRepository) Country(ctx context.Context, ip net.IP) (*entity.Country, error)
- func (r *GeoIPRepository) Database(ctx context.Context, dbType MaxmindDBType, format DumpFormat) (*entity.Database, error)
- func (r *GeoIPRepository) MetaData(ctx context.Context, dbType MaxmindDBType) (*entity.MetaData, error)
- type GeoNameRepository
- func (r *GeoNameRepository) Cities(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoName, error)
- func (r *GeoNameRepository) Continents(ctx context.Context) []*entity.GeoNameContinent
- func (r *GeoNameRepository) Countries(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameCountry, error)
- func (r *GeoNameRepository) Dump(ctx context.Context, format DumpFormat) ([]byte, error)
- func (r *GeoNameRepository) Subdivisions(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameAdminSubdivision, error)
- type MaxmindDBType
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) 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 (r *GeoNameRepository) Cities(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoName, error)
func (*GeoNameRepository) Continents ¶
func (r *GeoNameRepository) Continents(ctx context.Context) []*entity.GeoNameContinent
func (*GeoNameRepository) Countries ¶
func (r *GeoNameRepository) Countries(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameCountry, error)
func (*GeoNameRepository) Dump ¶
func (r *GeoNameRepository) Dump(ctx context.Context, format DumpFormat) ([]byte, error)
func (*GeoNameRepository) Subdivisions ¶
func (r *GeoNameRepository) Subdivisions(ctx context.Context, filter entity.GeoNameFilter) ([]*entity.GeoNameAdminSubdivision, error)
type MaxmindDBType ¶
type MaxmindDBType string
const ( MaxmindDBTypeCity MaxmindDBType = "city" MaxmindDBTypeISP MaxmindDBType = "isp" )
Click to show internal directories.
Click to hide internal directories.