blacklist

package
v0.0.0-...-e9ab6a4 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPBlacklist

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

IPBlacklist is a blacklist that matches IP addresses against a list of networks.

func DefaultIPBlacklist

func DefaultIPBlacklist() *IPBlacklist

DefaultIPBlacklist returns a new IPBlacklist created from the list of reserved networks.

func MakeIPBlacklist

func MakeIPBlacklist(networks []string) (*IPBlacklist, error)

MakeIPBlacklist creates an IPBlacklist from the list of networks given in CIDR notation.

func (*IPBlacklist) Len

func (bl *IPBlacklist) Len() int

func (*IPBlacklist) Less

func (bl *IPBlacklist) Less(a, b int) bool

func (*IPBlacklist) Matches

func (bl *IPBlacklist) Matches(x string) bool

Matches returns true if the given IP address is a member of any of the networks in the blacklist.

func (*IPBlacklist) MatchesIP

func (bl *IPBlacklist) MatchesIP(x net.IP) bool

MatchesIP returns true if the given IP address is a member of any of the networks in the blacklist.

func (*IPBlacklist) Swap

func (bl *IPBlacklist) Swap(a, b int)

type IPBlacklistItem

type IPBlacklistItem struct {
	Network *net.IPNet
	Cnt     int
}

IPBlacklistItem is a blacklist item that matches IP addresses against a network.

type NameBlacklist

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

NameBlacklist is a blacklist that matches host names against a list of NameBlacklistItems.

func DefaultNameBlacklist

func DefaultNameBlacklist() *NameBlacklist

DefaultNameBlacklist returns a new NameBlacklist created from the default list of names.

func MakeNameBlacklist

func MakeNameBlacklist(patterns []string) (*NameBlacklist, error)

MakeNameBlacklist creates a new NameBlacklist from the list of patterns.

func (*NameBlacklist) Len

func (bl *NameBlacklist) Len() int

func (*NameBlacklist) Less

func (bl *NameBlacklist) Less(a, b int) bool

func (*NameBlacklist) Matches

func (bl *NameBlacklist) Matches(x string) bool

Matches returns true if the given string matches any of the patterns in the blacklist.

func (*NameBlacklist) Swap

func (bl *NameBlacklist) Swap(a, b int)

type NameBlacklistItem

type NameBlacklistItem struct {
	Pattern *regexp.Regexp
	Cnt     int64
}

NameBlacklistItem is a blacklist item that matches hostnames.

Jump to

Keyboard shortcuts

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