Documentation
¶
Overview ¶
Package dbip provides columns for the DBIP database.
Package dbip provides utilities to download DB-IP datasets from an OCI registry.
Index ¶
- Constants
- Variables
- func CityColumn(t *GeoColumnFactory) schema.EventColumn
- func ContinentColumn(t *GeoColumnFactory) schema.EventColumn
- func CountryColumn(t *GeoColumnFactory) schema.EventColumn
- func GeoColumns(provider LookupProvider, cacheConfig CacheConfig) []schema.EventColumn
- func RegionColumn(t *GeoColumnFactory) schema.EventColumn
- func WithDestination(destinationDirectory string) managerOption
- func WithDownloadTimeout(timeout time.Duration) managerOption
- func WithDownloader(downloader Downloader) managerOption
- func WithEnabled(enabled bool) managerOption
- func WithRefreshInterval(interval time.Duration) managerOption
- type CacheConfig
- type Downloader
- type GeoColumnFactory
- type LookupProvider
- type LookupResult
- type ManagedLookupProvider
- type OCIRegistryCreds
- type Runner
Constants ¶
const IntervalNever = time.Duration(0)
IntervalNever disables remote DBIP refreshes.
Variables ¶
ErrUnavailable means DBIP geolocation is not currently available.
Functions ¶
func CityColumn ¶
func CityColumn(t *GeoColumnFactory) schema.EventColumn
CityColumn creates a city column from a MMDB path.
func ContinentColumn ¶
func ContinentColumn(t *GeoColumnFactory) schema.EventColumn
ContinentColumn creates a continent column from a MMDB path.
func CountryColumn ¶
func CountryColumn(t *GeoColumnFactory) schema.EventColumn
CountryColumn creates a country column from a MMDB path.
func GeoColumns ¶
func GeoColumns(provider LookupProvider, cacheConfig CacheConfig) []schema.EventColumn
GeoColumns creates a set of geo columns backed by the provided lookup provider.
func RegionColumn ¶
func RegionColumn(t *GeoColumnFactory) schema.EventColumn
RegionColumn creates a region column from a MMDB path.
func WithDestination ¶ added in v0.47.0
func WithDestination(destinationDirectory string) managerOption
WithDestination configures DBIP files destination directory.
func WithDownloadTimeout ¶ added in v0.47.0
WithDownloadTimeout configures DBIP remote download timeout.
func WithDownloader ¶ added in v0.47.0
func WithDownloader(downloader Downloader) managerOption
WithDownloader configures DBIP downloader.
func WithEnabled ¶ added in v0.47.0
func WithEnabled(enabled bool) managerOption
WithEnabled configures whether DBIP manager is active.
func WithRefreshInterval ¶ added in v0.47.0
WithRefreshInterval configures remote DBIP refresh interval.
Types ¶
type CacheConfig ¶ added in v0.7.0
CacheConfig is the configuration for the cache.
type Downloader ¶
type Downloader interface {
// Download obtains the MMDB city database and returns the path to the downloaded file
Download(ctx context.Context, artifactName, tag, destinationDir string) (string, error)
}
Downloader downloads an MMDB city database and returns the saved file path.
func NewExtensionBasedOCIDownloader ¶
func NewExtensionBasedOCIDownloader(creds OCIRegistryCreds, extension string) Downloader
NewExtensionBasedOCIDownloader creates a new MMDBCityDatabaseDownloader backed by an OCI registry
type GeoColumnFactory ¶ added in v0.7.0
type GeoColumnFactory struct {
// contains filtered or unexported fields
}
GeoColumnFactory is a template for creating geo columns.
func NewGeoColumnFactory ¶ added in v0.7.0
func NewGeoColumnFactory(provider LookupProvider, cacheConfig CacheConfig) (*GeoColumnFactory, error)
NewGeoColumnFactory creates a new GeoColumnTemplate.
func (*GeoColumnFactory) Column ¶ added in v0.7.0
func (t *GeoColumnFactory) Column( column schema.InterfaceID, field *arrow.Field, getValue func(event *schema.Event, record *LookupResult) (any, schema.D8AColumnWriteError), options ...columns.EventColumnOptions, ) schema.EventColumn
Column creates a new event column from a GeoColumnTemplate.
type LookupProvider ¶ added in v0.47.0
type LookupProvider interface {
Lookup(ip netip.Addr) (*LookupResult, error)
}
LookupProvider returns geolocation values for IP addresses.
func NewStaticLookupProvider ¶ added in v0.47.0
func NewStaticLookupProvider(result *LookupResult, err error) LookupProvider
NewStaticLookupProvider returns a provider with deterministic behavior for tests.
func NewUnavailableLookupProvider ¶ added in v0.47.0
func NewUnavailableLookupProvider() LookupProvider
NewUnavailableLookupProvider always reports unavailable lookups.
type LookupResult ¶ added in v0.47.0
LookupResult stores normalized geolocation values extracted from DBIP.
type ManagedLookupProvider ¶ added in v0.47.0
type ManagedLookupProvider interface {
LookupProvider
Runner
Close() error
}
ManagedLookupProvider combines lookup and refresh lifecycle.
func NewManagedLookupProvider ¶ added in v0.47.0
func NewManagedLookupProvider(options ...managerOption) ManagedLookupProvider
NewManagedLookupProvider creates a DBIP lookup provider with optional background refresh.