Documentation ¶
Index ¶
Constants ¶
const ( // ConnCleanupLoopInterval indicates the loop interval for conn cleaning up ConnCleanupLoopInterval = 30 * time.Second )
Variables ¶
var ( // PunishFactors contains factors of punishment. PunishFactors = newFactors(60, 1800, 64) // RechieveFactors contains factors of achievement. RechieveFactors = newFactors(600, 18000, 512) )
Functions ¶
This section is empty.
Types ¶
type DynamicPeerScore ¶
type DynamicPeerScore struct {
// contains filtered or unexported fields
}
DynamicPeerScore provides dynamic ban scores consisting of a punishment, a achievement and a decaying component. The punished score and the achieved score could be utilized to create simple additive banning policies similar to those found in other 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. DynamicPeerScore allows these two approaches to be used in tandem.
baseScore: Values of type DynamicPeerScore are immediately ready for use upon declaration.
func NewDynamicPeerScore ¶
func NewDynamicPeerScore(pid peer.ID) *DynamicPeerScore
NewDynamicPeerScore returns new DynamicPeerScore.
func (*DynamicPeerScore) Record ¶
func (s *DynamicPeerScore) Record(event eventbus.BusEvent)
Record record event