firewall

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

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 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 added in v0.15.0

func (conf *Config) BasicCheck() error

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 NewFirewall(conf *Config, net network.Network, peerSet *peerset.PeerSet, st state.Facade,
	log *logger.SubLogger,
) (*Firewall, error)

func (*Firewall) AllowBlockRequest added in v1.1.8

func (f *Firewall) AllowBlockRequest() bool

func (*Firewall) AllowConsensusRequest added in v1.1.8

func (f *Firewall) AllowConsensusRequest() bool

func (*Firewall) AllowTransactionRequest added in v1.1.8

func (f *Firewall) AllowTransactionRequest() bool

func (*Firewall) IsBannedAddress added in v1.2.0

func (f *Firewall) IsBannedAddress(remoteAddr string) bool

IsBannedAddress checks if the remote IP address is banned.

func (*Firewall) OpenGossipBundle

func (f *Firewall) OpenGossipBundle(data []byte, from peer.ID) (*bundle.Bundle, error)

func (*Firewall) OpenStreamBundle

func (f *Firewall) OpenStreamBundle(r io.Reader, from peer.ID) (*bundle.Bundle, error)

type PeerBannedError added in v1.4.0

type PeerBannedError struct {
	PeerID  lp2pcore.PeerID
	Address string
}

PeerBannedError is returned when a message received from a banned peer-id or banned address.

func (PeerBannedError) Error added in v1.4.0

func (e PeerBannedError) Error() string

type RateLimit added in v1.1.8

type RateLimit struct {
	BlockTopic       int `toml:"block_topic"`
	TransactionTopic int `toml:"transaction_topic"`
	ConsensusTopic   int `toml:"consensus_topic"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL