Documentation
¶
Index ¶
- Variables
- type Config
- type Firewall
- func (f *Firewall) AllowBlockRequest(gossipMsg *network.GossipMessage) network.PropagationPolicy
- func (f *Firewall) AllowConsensusRequest(gossipMsg *network.GossipMessage) network.PropagationPolicy
- func (f *Firewall) AllowTransactionRequest(_ *network.GossipMessage) network.PropagationPolicy
- func (f *Firewall) IsBannedAddress(remoteAddr string) bool
- func (f *Firewall) OpenGossipBundle(data []byte, from peer.ID) (*bundle.Bundle, error)
- func (f *Firewall) OpenStreamBundle(r io.Reader, from peer.ID) (*bundle.Bundle, error)
- type PeerBannedError
- type RateLimit
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrGossipMessage = errors.New("receive stream message as gossip message")
ErrGossipMessage is returned when a stream message sends as gossip message.
View Source
var ErrMisMatchConsensusHeight = errors.New("bundle and message consensus height mismatch")
ErrMisMatchConsensusHeight is returned when the bundle height mismatches with the message consensus height.
View Source
var ErrNetworkMismatch = errors.New("bundle is not for this network")
ErrNetworkMismatch is returned when the bundle doesn't belong to this network.
View Source
var ErrStreamMessage = errors.New("receive gossip message as stream message")
ErrStreamMessage is returned when a gossip message sends as stream message.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
BannedNets []string `toml:"banned_nets"`
RateLimit RateLimit `toml:"rate_limit"`
}
func DefaultConfig ¶
func DefaultConfig() *Config
func (*Config) BasicCheck ¶
BasicCheck performs basic checks on the configuration.
type Firewall ¶
type Firewall struct {
// contains filtered or unexported fields
}
Firewall check packets before passing them to sync module.
func NewFirewall ¶
func (*Firewall) AllowBlockRequest ¶
func (f *Firewall) AllowBlockRequest(gossipMsg *network.GossipMessage) network.PropagationPolicy
func (*Firewall) AllowConsensusRequest ¶
func (f *Firewall) AllowConsensusRequest(gossipMsg *network.GossipMessage) network.PropagationPolicy
func (*Firewall) AllowTransactionRequest ¶
func (f *Firewall) AllowTransactionRequest(_ *network.GossipMessage) network.PropagationPolicy
func (*Firewall) IsBannedAddress ¶
IsBannedAddress checks if the remote IP address is banned.
func (*Firewall) OpenGossipBundle ¶
type PeerBannedError ¶
PeerBannedError is returned when a message received from a banned peer-id or banned address.
func (PeerBannedError) Error ¶
func (e PeerBannedError) Error() string
Click to show internal directories.
Click to hide internal directories.