Documentation ¶
Index ¶
- type BasicConnectionGater
- func (cg *BasicConnectionGater) BlockAddr(ip net.IP) error
- func (cg *BasicConnectionGater) BlockPeer(p peer.ID) error
- func (cg *BasicConnectionGater) BlockSubnet(ipnet *net.IPNet) error
- func (cg *BasicConnectionGater) InterceptAccept(cma network.ConnMultiaddrs) (allow bool)
- func (cg *BasicConnectionGater) InterceptAddrDial(p peer.ID, a ma.Multiaddr) (allow bool)
- func (cg *BasicConnectionGater) InterceptPeerDial(p peer.ID) (allow bool)
- func (cg *BasicConnectionGater) InterceptSecured(dir network.Direction, p peer.ID, cma network.ConnMultiaddrs) (allow bool)
- func (cg *BasicConnectionGater) InterceptUpgraded(network.Conn) (allow bool, reason control.DisconnectReason)
- func (cg *BasicConnectionGater) ListBlockedAddrs() []net.IP
- func (cg *BasicConnectionGater) ListBlockedPeers() []peer.ID
- func (cg *BasicConnectionGater) ListBlockedSubnets() []*net.IPNet
- func (cg *BasicConnectionGater) UnblockAddr(ip net.IP) error
- func (cg *BasicConnectionGater) UnblockPeer(p peer.ID) error
- func (cg *BasicConnectionGater) UnblockSubnet(ipnet *net.IPNet) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicConnectionGater ¶
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 (*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