gating

package
v1.5.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT, MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockingConnectionGater

type BlockingConnectionGater interface {
	connmgr.ConnectionGater

	// BlockPeer adds a peer to the set of blocked peers.
	// Note: active connections to the peer are not automatically closed.
	BlockPeer(p peer.ID) error
	UnblockPeer(p peer.ID) error
	ListBlockedPeers() []peer.ID

	// BlockAddr adds an IP address to the set of blocked addresses.
	// Note: active connections to the IP address are not automatically closed.
	BlockAddr(ip net.IP) error
	UnblockAddr(ip net.IP) error
	ListBlockedAddrs() []net.IP

	// BlockSubnet adds an IP subnet to the set of blocked addresses.
	// Note: active connections to the IP subnet are not automatically closed.
	BlockSubnet(ipnet *net.IPNet) error
	UnblockSubnet(ipnet *net.IPNet) error
	ListBlockedSubnets() []*net.IPNet
}

func NewBlockingConnectionGater

func NewBlockingConnectionGater(store ds.Batching) (BlockingConnectionGater, error)

type ConnectionGaterMetrics

type ConnectionGaterMetrics interface {
	RecordDial(allow bool)
	RecordAccept(allow bool)
}

type ExpiryConnectionGater

type ExpiryConnectionGater struct {
	BlockingConnectionGater
	// contains filtered or unexported fields
}

ExpiryConnectionGater enhances a BlockingConnectionGater by implementing ban-expiration

func (*ExpiryConnectionGater) InterceptAccept

func (g *ExpiryConnectionGater) InterceptAccept(mas network.ConnMultiaddrs) (allow bool)

func (*ExpiryConnectionGater) InterceptAddrDial

func (g *ExpiryConnectionGater) InterceptAddrDial(id peer.ID, ma multiaddr.Multiaddr) (allow bool)

func (*ExpiryConnectionGater) InterceptPeerDial

func (g *ExpiryConnectionGater) InterceptPeerDial(p peer.ID) (allow bool)

func (*ExpiryConnectionGater) InterceptSecured

func (g *ExpiryConnectionGater) InterceptSecured(direction network.Direction, id peer.ID, mas network.ConnMultiaddrs) (allow bool)

type ExpiryStore

type ExpiryStore interface {
	store.IPBanStore
	store.PeerBanStore
}

type MeteredConnectionGater

type MeteredConnectionGater struct {
	BlockingConnectionGater
	// contains filtered or unexported fields
}

func (*MeteredConnectionGater) InterceptAccept

func (g *MeteredConnectionGater) InterceptAccept(mas network.ConnMultiaddrs) (allow bool)

func (*MeteredConnectionGater) InterceptAddrDial

func (g *MeteredConnectionGater) InterceptAddrDial(id peer.ID, ma multiaddr.Multiaddr) (allow bool)

func (*MeteredConnectionGater) InterceptPeerDial

func (g *MeteredConnectionGater) InterceptPeerDial(p peer.ID) (allow bool)

func (*MeteredConnectionGater) InterceptSecured

func (g *MeteredConnectionGater) InterceptSecured(dir network.Direction, id peer.ID, mas network.ConnMultiaddrs) (allow bool)

type Scores

type Scores interface {
	GetPeerScore(id peer.ID) (float64, error)
}

type ScoringConnectionGater

type ScoringConnectionGater struct {
	BlockingConnectionGater
	// contains filtered or unexported fields
}

ScoringConnectionGater enhances a ConnectionGater by enforcing a minimum score for peer connections

func AddScoring

func AddScoring(gater BlockingConnectionGater, scores Scores, minScore float64) *ScoringConnectionGater

func (*ScoringConnectionGater) InterceptAddrDial

func (g *ScoringConnectionGater) InterceptAddrDial(id peer.ID, ma multiaddr.Multiaddr) (allow bool)

func (*ScoringConnectionGater) InterceptPeerDial

func (g *ScoringConnectionGater) InterceptPeerDial(p peer.ID) (allow bool)

func (*ScoringConnectionGater) InterceptSecured

func (g *ScoringConnectionGater) InterceptSecured(dir network.Direction, id peer.ID, mas network.ConnMultiaddrs) (allow bool)

type UnbanMetrics

type UnbanMetrics interface {
	RecordPeerUnban()
	RecordIPUnban()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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