Documentation
¶
Overview ¶
Package cluster provides types and methods for working with a libp2p cluster.
Index ¶
- Variables
- func NewDHT(ctx context.Context, h host.Host, cfg *config.Cluster) (*dht.IpfsDHT, error)
- func PushPullInterval(n int, interval time.Duration) time.Duration
- type Cluster
- type ConnectionGater
- func (c *ConnectionGater) InterceptAccept(multiaddrs network.ConnMultiaddrs) bool
- func (c *ConnectionGater) InterceptAddrDial(id peer.ID, multiaddr multiaddr.Multiaddr) bool
- func (c *ConnectionGater) InterceptPeerDial(peer.ID) bool
- func (c *ConnectionGater) InterceptSecured(_ network.Direction, _ peer.ID, _ network.ConnMultiaddrs) bool
- func (c *ConnectionGater) InterceptUpgraded(_ network.Conn) (bool, control.DisconnectReason)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoPeersAvailable = errors.New("no peers discovered in DHT")
Functions ¶
func PushPullInterval ¶
PushPullInterval returns the push/pull interval for the given network size. We scale the push/pull interval based on the network size for clusters > 32 nodes to prevent saturating the network with state sync requests, same as memberlist.
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster represents a distributed peer-to-peer network, managed via libp2p.
func New ¶
func New(cfg *config.Config, files *state.Files, resolver dmnet.InterfaceResolver) (*Cluster, error)
New initializes and returns a new Cluster instance with the provided configuration and store.
type ConnectionGater ¶
type ConnectionGater struct {
// contains filtered or unexported fields
}
func NewConnectionGater ¶
func NewConnectionGater(interfaces []string, resolver dmnet.InterfaceResolver) *ConnectionGater
func (*ConnectionGater) InterceptAccept ¶
func (c *ConnectionGater) InterceptAccept(multiaddrs network.ConnMultiaddrs) bool
func (*ConnectionGater) InterceptAddrDial ¶
func (*ConnectionGater) InterceptPeerDial ¶
func (c *ConnectionGater) InterceptPeerDial(peer.ID) bool
func (*ConnectionGater) InterceptSecured ¶
func (c *ConnectionGater) InterceptSecured(_ network.Direction, _ peer.ID, _ network.ConnMultiaddrs) bool
func (*ConnectionGater) InterceptUpgraded ¶
func (c *ConnectionGater) InterceptUpgraded(_ network.Conn) (bool, control.DisconnectReason)
Click to show internal directories.
Click to hide internal directories.