list

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const BanReleaseDuration = time.Hour * 24 * 730
View Source
const BanThreshold = 5

BanThreshold is number of events to ban address or peerid

View Source
const BanValidDuration = time.Minute * 30

Variables

View Source
var (
	NotFoundError = errors.New("ban status not found")
	UndefinedTime = time.Unix(0, 0)
	FarawayFuture = time.Date(99999, 1, 1, 0, 0, 0, 0, time.UTC)
)

variables that are used internally

View Source
var BanDurations = []time.Duration{
	0,
	0,
	time.Minute,
	time.Minute * 3,
	time.Minute * 10,
	time.Hour,
	time.Hour * 24,
	time.Hour * 24 * 30,
	time.Hour * 24 * 3650,
}

Functions

func NewListManager

func NewListManager(conf *config.AuthConfig, authDir string, chainAcc types.ChainAccessor, prm p2pcommon.PeerRoleManager, logger *log.Logger, publicNet bool) p2pcommon.ListManager

Types

type BanEvent

type BanEvent interface {
	When() time.Time
	Why() string
}

type BanStatus

type BanStatus interface {
	// ID is ip address or peer id
	ID() string

	// BanUntil show when this ban items is expired.
	BanUntil() time.Time
	Banned(refTime time.Time) bool
	Events() []BanEvent
	PruneOldEvents(pruneTime time.Time) int
}

BanStatus keep kickout logs and decide how long the ban duration is

Jump to

Keyboard shortcuts

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