maxminddb

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const Type = "maxminddb"

Variables

This section is empty.

Functions

func NewMaxmindDB

func NewMaxmindDB(ctx context.Context, _ adapter.Core, logger log.Logger, tag string, args any) (adapter.PluginMatcher, error)

Types

type Args

type Args struct {
	Path string `json:"path"`
	Type string `json:"type"`
}

type Country

type Country struct {
	Continent struct {
		Names     map[string]string `maxminddb:"names"`
		Code      string            `maxminddb:"code"`
		GeoNameID uint              `maxminddb:"geoname_id"`
	} `maxminddb:"continent"`
	Country struct {
		Names             map[string]string `maxminddb:"names"`
		IsoCode           string            `maxminddb:"iso_code"`
		GeoNameID         uint              `maxminddb:"geoname_id"`
		IsInEuropeanUnion bool              `maxminddb:"is_in_european_union"`
	} `maxminddb:"country"`
	RegisteredCountry struct {
		Names             map[string]string `maxminddb:"names"`
		IsoCode           string            `maxminddb:"iso_code"`
		GeoNameID         uint              `maxminddb:"geoname_id"`
		IsInEuropeanUnion bool              `maxminddb:"is_in_european_union"`
	} `maxminddb:"registered_country"`
	RepresentedCountry struct {
		Names             map[string]string `maxminddb:"names"`
		IsoCode           string            `maxminddb:"iso_code"`
		Type              string            `maxminddb:"type"`
		GeoNameID         uint              `maxminddb:"geoname_id"`
		IsInEuropeanUnion bool              `maxminddb:"is_in_european_union"`
	} `maxminddb:"represented_country"`
	Traits struct {
		IsAnonymousProxy    bool `maxminddb:"is_anonymous_proxy"`
		IsSatelliteProvider bool `maxminddb:"is_satellite_provider"`
	} `maxminddb:"traits"`
}

type MaxmindDB

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

func (*MaxmindDB) APIHandler

func (m *MaxmindDB) APIHandler() chi.Router

func (*MaxmindDB) Close

func (m *MaxmindDB) Close() error

func (*MaxmindDB) LoadRunningArgs

func (m *MaxmindDB) LoadRunningArgs(_ context.Context, args any) (uint16, error)

func (*MaxmindDB) Match

func (m *MaxmindDB) Match(ctx context.Context, dnsCtx *adapter.DNSContext, argsID uint16) (bool, error)

func (*MaxmindDB) Start

func (m *MaxmindDB) Start() error

func (*MaxmindDB) Tag

func (m *MaxmindDB) Tag() string

func (*MaxmindDB) Type

func (m *MaxmindDB) Type() string

type Reader

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

func OpenMaxmindDBReader

func OpenMaxmindDBReader(path string, dataType string) (*Reader, error)

func (*Reader) Clone

func (r *Reader) Clone() *Reader

func (*Reader) Close

func (r *Reader) Close() error

func (*Reader) Lookup

func (r *Reader) Lookup(addr netip.Addr) []string

Jump to

Keyboard shortcuts

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