geoip2xl

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package geoip2xl provides a xlistd.List implementation that uses a geoip database for checks.

This means that the RBL can check if an ip is in a list of countries. It only allows IPv4 resources.

This package is a work in progress and makes no API stability promises.

Index

Constants

View Source
const ComponentClass = "geoip2"

ComponentClass registered.

Variables

This section is empty.

Functions

func Builder

func Builder(defaultCfg Config) xlistd.BuildListFn

Builder returns a builder function.

Types

type Config

type Config struct {
	// Countries is a list of country codes
	Countries []string
	// Reverse the matching of the rule
	Reverse bool
	// Common options
	ForceValidation bool
	Reason          string
}

Config options.

func (Config) Copy

func (src Config) Copy() Config

Copy configuration.

type List

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

List implements an RBL that uses a geoip database for checks.

func New

func New(id, database string, cfg Config, logger yalogi.Logger) *List

New constructs a new List with dbpath as database and config for logic.

func (*List) Check

func (l *List) Check(ctx context.Context, name string, resource xlist.Resource) (xlist.Response, error)

Check implements xlist.Checker interface.

func (*List) Class

func (l *List) Class() string

Class implements xlistd.List interface.

func (*List) Close

func (l *List) Close()

Close closes the database file.

func (*List) ID

func (l *List) ID() string

ID implements xlistd.List interface.

func (*List) Open

func (l *List) Open() error

Open opens database file.

func (*List) Ping

func (l *List) Ping() error

Ping implements xlist.Checker interface.

func (*List) Resources

func (l *List) Resources(ctx context.Context) ([]xlist.Resource, error)

Resources implements xlist.Checker interface.

Jump to

Keyboard shortcuts

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