blocklist

package
v1.12.15 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 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 {
	// 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 NewLogger added in v1.12.3

func NewLogger(logger Logger) *Blocklist

NewLogger returns a new Blocklist with a logger that prints error messages during loading.

func (*Blocklist) Blocked

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

Blocked returns true if ip is in Blocklist.

func (*Blocklist) Len added in v0.3.0

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 added in v1.1.2

type Logger func(format string, v ...any)

Logger prints error messages during loading. Arguments are handled in the manner of fmt.Printf.

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