Documentation ¶
Index ¶
- Variables
- type Banner
- func (banner *Banner) BanIP(maddr ma.Multiaddr) error
- func (banner *Banner) CheckBandwidthUsage()
- func (banner *Banner) IsAddrBanned(maddr ma.Multiaddr) bool
- func (banner *Banner) ProtectIP(maddr ma.Multiaddr) error
- func (banner *Banner) SetMaxBytesPerSecond(limit float64)
- func (banner *Banner) UnbanIP(maddr ma.Multiaddr) error
- type Config
- Bugs
Constants ¶
This section is empty.
Variables ¶
var ErrProtectedIP = errors.New("cannot ban protected IP address")
Functions ¶
This section is empty.
Types ¶
type Banner ¶
type Banner struct {
// contains filtered or unexported fields
}
func (*Banner) BanIP ¶
BanIP adds the IP address of the given Multiaddr to the blacklist. The node will no longer dial or accept connections from this IP address. However, if the IP address is protected, calling BanIP will not ban the IP address and will instead return errProtectedIP. BanIP does not automatically disconnect from the given multiaddress if there is currently an open connection.
func (*Banner) CheckBandwidthUsage ¶
func (banner *Banner) CheckBandwidthUsage()
CheckBandwidthUsage checks the amount of data sent by each connected peer and bans (via IP address) any peers which have exceeded the bandwidth limit.
func (*Banner) ProtectIP ¶
ProtectIP permanently adds the IP address of the given Multiaddr to a list of protected IP addresses. Protected IPs can never be banned and will not be added to the blacklist. If the IP address is already on the blacklist, it will be removed.
func (*Banner) SetMaxBytesPerSecond ¶
Notes ¶
Bugs ¶
newViolationsTracker currently leaks goroutines due to a limitation of the caching library used under the hood.