blacklist

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlackList

type BlackList interface {
	// AddPeer append a peer id to blacklist.
	AddPeer(pid peer.ID)
	// RemovePeer delete a peer id from blacklist.
	// If pid not exist in blacklist, it is a no-op.
	RemovePeer(pid peer.ID)
	// AddIPAndPort append a string contains an ip
	// or a net.Addr string with an ip and a port to blacklist.
	// The string should be in the following format:
	// "192.168.1.2:9000" or "192.168.1.2" or "[::1]:9000" or "[::1]"
	AddIPAndPort(ipAndPort string)
	// RemoveIPAndPort delete a string contains an ip
	// or a net.Addr string with an ip and a port from blacklist.
	// If the string not exist in blacklist, it is a no-op.
	RemoveIPAndPort(ipAndPort string)
	// IsBlack check whether the remote peer id
	// or the remote net address of the connection given exist in blacklist.
	IsBlack(conn network.Conn) bool
	// IsBlackByPid check whether the remote peer id in blacklist
	IsBlackByPid(pid peer.ID) bool
}

BlackList is a blacklist implementation for net addresses or peer ids .

Jump to

Keyboard shortcuts

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