-
Notifications
You must be signed in to change notification settings - Fork 199
/
antiflood.go
71 lines (55 loc) · 1.74 KB
/
antiflood.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package disabled
import (
"time"
"github.com/ElrondNetwork/elrond-go-core/core"
"github.com/ElrondNetwork/elrond-go/consensus"
"github.com/ElrondNetwork/elrond-go/p2p"
"github.com/ElrondNetwork/elrond-go/process"
)
var _ consensus.P2PAntifloodHandler = (*AntiFlood)(nil)
// AntiFlood is a mock implementation of the antiflood interface
type AntiFlood struct {
}
// ResetForTopic won't do anything
func (af *AntiFlood) ResetForTopic(_ string) {
}
// SetMaxMessagesForTopic won't do anything
func (af *AntiFlood) SetMaxMessagesForTopic(_ string, _ uint32) {
}
// CanProcessMessage will always return nil
func (af *AntiFlood) CanProcessMessage(_ p2p.MessageP2P, _ core.PeerID) error {
return nil
}
// IsOriginatorEligibleForTopic will always return nil
func (af *AntiFlood) IsOriginatorEligibleForTopic(_ core.PeerID, _ string) error {
return nil
}
// SetTopicsForAll does nothing
func (af *AntiFlood) SetTopicsForAll(_ ...string) {
}
// SetPeerValidatorMapper does nothing
func (af *AntiFlood) SetPeerValidatorMapper(_ process.PeerValidatorMapper) error {
return nil
}
// CanProcessMessagesOnTopic will always return nil
func (af *AntiFlood) CanProcessMessagesOnTopic(_ core.PeerID, _ string, _ uint32, _ uint64, _ []byte) error {
return nil
}
// ApplyConsensusSize does nothing
func (af *AntiFlood) ApplyConsensusSize(_ int) {
}
// SetDebugger returns nil
func (af *AntiFlood) SetDebugger(_ process.AntifloodDebugger) error {
return nil
}
// BlacklistPeer does nothing
func (af *AntiFlood) BlacklistPeer(_ core.PeerID, _ string, _ time.Duration) {
}
// Close does nothing
func (af *AntiFlood) Close() error {
return nil
}
// IsInterfaceNil return true if there is no value under the interface
func (af *AntiFlood) IsInterfaceNil() bool {
return af == nil
}