maxmind

package
v0.119.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

README

MaxMind GeoIP Provider

Use of MaxMind and other geolocation databases are subject to applicable licenses and terms governing the databases. Consult the database provider for the latest applicable terms.

This package provides a MaxMind GeoIP provider for use with the OpenTelemetry GeoIP processor. It leverages the geoip2-golang package to query geographical information associated with IP addresses from MaxMind databases. See recommended clients: https://dev.maxmind.com/geoip/docs/databases#api-clients

Features

  • Supports GeoIP2-City and GeoLite2-City database types.
  • Retrieves and returns geographical metadata for a given IP address. The generated attributes follow the internal Geo conventions.

Configuration

The following configuration must be provided:

  • database_path: local file path to a GeoIP2-City or GeoLite2-City database.

Documentation

Index

Constants

View Source
const (
	// TypeStr the value of "type" key in configuration.
	TypeStr = "maxmind"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// DatabasePath section allows specifying a local GeoIP database
	// file to retrieve the geographical metadata from.
	DatabasePath string `mapstructure:"database_path"`
}

Config defines configuration for MaxMind provider.

func (*Config) Validate

func (c *Config) Validate() error

Validate implements provider.Config.

type Factory added in v0.105.0

type Factory struct{}

Factory is the Factory for the MaxMind GeoIP provider.

func (*Factory) CreateDefaultConfig added in v0.105.0

func (f *Factory) CreateDefaultConfig() provider.Config

CreateDefaultConfig creates the default configuration for the Provider.

func (*Factory) CreateGeoIPProvider added in v0.105.0

func (f *Factory) CreateGeoIPProvider(_ context.Context, _ processor.Settings, cfg provider.Config) (provider.GeoIPProvider, error)

CreateGeoIPProvider creates a provider based on this config.

Jump to

Keyboard shortcuts

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