conngater

package
v0.20.3 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 13 Imported by: 35

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicConnectionGater

type BasicConnectionGater struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

BasicConnectionGater implements a connection gater that allows the application to perform access control on incoming and outgoing connections.

func NewBasicConnectionGater

func NewBasicConnectionGater(ds datastore.Datastore) (*BasicConnectionGater, error)

NewBasicConnectionGater creates a new connection gater. The ds argument is an (optional, can be nil) datastore to persist the connection gater filters.

func (*BasicConnectionGater) BlockAddr

func (cg *BasicConnectionGater) BlockAddr(ip net.IP) error

BlockAddr adds an IP address to the set of blocked addresses. Note: active connections to the IP address are not automatically closed.

func (*BasicConnectionGater) BlockPeer

func (cg *BasicConnectionGater) BlockPeer(p peer.ID) error

BlockPeer adds a peer to the set of blocked peers. Note: active connections to the peer are not automatically closed.

func (*BasicConnectionGater) BlockSubnet

func (cg *BasicConnectionGater) BlockSubnet(ipnet *net.IPNet) error

BlockSubnet adds an IP subnet to the set of blocked addresses. Note: active connections to the IP subnet are not automatically closed.

func (*BasicConnectionGater) InterceptAccept

func (cg *BasicConnectionGater) InterceptAccept(cma network.ConnMultiaddrs) (allow bool)

func (*BasicConnectionGater) InterceptAddrDial

func (cg *BasicConnectionGater) InterceptAddrDial(p peer.ID, a ma.Multiaddr) (allow bool)

func (*BasicConnectionGater) InterceptPeerDial

func (cg *BasicConnectionGater) InterceptPeerDial(p peer.ID) (allow bool)

func (*BasicConnectionGater) InterceptSecured

func (cg *BasicConnectionGater) InterceptSecured(dir network.Direction, p peer.ID, cma network.ConnMultiaddrs) (allow bool)

func (*BasicConnectionGater) InterceptUpgraded

func (cg *BasicConnectionGater) InterceptUpgraded(network.Conn) (allow bool, reason control.DisconnectReason)

func (*BasicConnectionGater) ListBlockedAddrs

func (cg *BasicConnectionGater) ListBlockedAddrs() []net.IP

ListBlockedAddrs return a list of blocked IP addresses

func (*BasicConnectionGater) ListBlockedPeers

func (cg *BasicConnectionGater) ListBlockedPeers() []peer.ID

ListBlockedPeers return a list of blocked peers

func (*BasicConnectionGater) ListBlockedSubnets

func (cg *BasicConnectionGater) ListBlockedSubnets() []*net.IPNet

ListBlockedSubnets return a list of blocked IP subnets

func (*BasicConnectionGater) UnblockAddr

func (cg *BasicConnectionGater) UnblockAddr(ip net.IP) error

UnblockAddr removes an IP address from the set of blocked addresses

func (*BasicConnectionGater) UnblockPeer

func (cg *BasicConnectionGater) UnblockPeer(p peer.ID) error

UnblockPeer removes a peer from the set of blocked peers

func (*BasicConnectionGater) UnblockSubnet

func (cg *BasicConnectionGater) UnblockSubnet(ipnet *net.IPNet) error

UnblockSubnet removes an IP address from the set of blocked addresses

Jump to

Keyboard shortcuts

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