Documentation ¶
Index ¶
Constants ¶
const ( // Halflife defines the time (in seconds) by which the transient part // of the ban score decays to one half of it's original value. Halflife = 60 // Lifetime defines the maximum age of the transient part of the ban // score to be considered a non-zero score (in seconds). Lifetime = 1800 )
const ( LevelMsgIllegal = 0x01 LevelConnException = 0x02 )
Variables ¶
var (
ErrConnectBannedPeer = errors.New("connect banned peer")
)
Functions ¶
This section is empty.
Types ¶
type Blacklist ¶
type Blacklist struct {
// contains filtered or unexported fields
}
func NewBlacklist ¶
type DynamicBanScore ¶
type DynamicBanScore struct {
// contains filtered or unexported fields
}
DynamicBanScore provides dynamic ban scores consisting of a persistent and a decaying component. The persistent score could be utilized to create simple additive banning policies similar to those found in other bitcoin node implementations.
The decaying score enables the creation of evasive logic which handles misbehaving peers (especially application layer DoS attacks) gracefully by disconnecting and banning peers attempting various kinds of flooding. DynamicBanScore allows these two approaches to be used in tandem.
Zero value: Values of type DynamicBanScore are immediately ready for use upon declaration.
func (*DynamicBanScore) Increase ¶
func (s *DynamicBanScore) Increase(persistent, transient uint32) uint32
Increase increases both the persistent and decaying scores by the values passed as parameters. The resulting score is returned.
This function is safe for concurrent access.
func (*DynamicBanScore) Int ¶
func (s *DynamicBanScore) Int() uint32
Int returns the current ban score, the sum of the persistent and decaying scores.
This function is safe for concurrent access.
func (*DynamicBanScore) Reset ¶
func (s *DynamicBanScore) Reset()
Reset set both persistent and decaying scores to zero.
This function is safe for concurrent access.
func (*DynamicBanScore) String ¶
func (s *DynamicBanScore) String() string
String returns the ban score as a human-readable string.
type PeerFilter ¶
type PeerFilter struct {
// contains filtered or unexported fields
}
func NewPeerFilter ¶
func NewPeerFilter() *PeerFilter
type PeersBanScore ¶
type PeersBanScore struct {
// contains filtered or unexported fields
}
func NewPeersScore ¶
func NewPeersScore() *PeersBanScore
func (*PeersBanScore) DelPeer ¶
func (ps *PeersBanScore) DelPeer(ip string)
type Security ¶
type Security struct {
// contains filtered or unexported fields
}