blocklist

package
v1.6.1-0...-b16536f Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blocklist

type Blocklist struct {
	Logger Logger
	// contains filtered or unexported fields
}

Blocklist holds a list of IP ranges in a Segment Tree structure for faster lookups.

func New

func New() *Blocklist

New returns a new Blocklist.

func (*Blocklist) Blocked

func (b *Blocklist) Blocked(ip net.IP) bool

Blocked returns true if ip is in Blocklist.

func (*Blocklist) Len

func (b *Blocklist) Len() int

Len returns the number of rules in the Blocklist.

func (*Blocklist) Reload

func (b *Blocklist) Reload(r io.Reader) (int, error)

Reload the segment tree by reading new rules from a io.Reader.

type Logger

type Logger func(format string, v ...interface{})

Directories

Path Synopsis
Package stree implements a segment tree and serial algorithm to query intervals
Package stree implements a segment tree and serial algorithm to query intervals

Jump to

Keyboard shortcuts

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