Documentation
¶
Overview ¶
Package p2p implements the worker committee gossip network.
Index ¶
- func DebugForceAllowUnroutableAddresses()
- func New(identity *identity.Identity, consensus consensus.Backend, ...) (api.Service, error)
- func NewConnGater(cfg *ConnGaterConfig) (*conngater.BasicConnectionGater, error)
- func NewConnManager(cfg *ConnManagerConfig) (*connmgr.BasicConnMgr, error)
- func NewHost(cfg *HostConfig) (host.Host, *conngater.BasicConnectionGater, error)
- func NewNop() api.Service
- func NewResourceManager() (network.ResourceManager, error)
- func NewSeedNode(cfg *SeedConfig) (api.SeedService, error)
- type BootstrapDiscoveryConfig
- type Config
- type ConnGaterConfig
- type ConnManagerConfig
- type GossipSubConfig
- type HostConfig
- type SeedConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DebugForceAllowUnroutableAddresses ¶
func DebugForceAllowUnroutableAddresses()
DebugForceAllowUnroutableAddresses allows unroutable addresses.
func New ¶
func New(identity *identity.Identity, consensus consensus.Backend, store *persistent.CommonStore) (api.Service, error)
New creates a new P2P node.
func NewConnGater ¶
func NewConnGater(cfg *ConnGaterConfig) (*conngater.BasicConnectionGater, error)
NewConnGater constructs a new connection gater.
func NewConnManager ¶
func NewConnManager(cfg *ConnManagerConfig) (*connmgr.BasicConnMgr, error)
NewConnManager constructs a new connection manager.
func NewHost ¶
func NewHost(cfg *HostConfig) (host.Host, *conngater.BasicConnectionGater, error)
NewHost constructs a new libp2p host.
func NewResourceManager ¶ added in v0.2300.5
func NewResourceManager() (network.ResourceManager, error)
NewResourceManager constructs a new resource manager.
func NewSeedNode ¶
func NewSeedNode(cfg *SeedConfig) (api.SeedService, error)
NewSeedNode creates a new P2P seed node service.
Types ¶
type BootstrapDiscoveryConfig ¶
type BootstrapDiscoveryConfig struct {
Enable bool
Seeds []peer.AddrInfo
RetentionPeriod time.Duration
}
BootstrapDiscoveryConfig describes a set of settings for a discovery.
func (*BootstrapDiscoveryConfig) Load ¶
func (cfg *BootstrapDiscoveryConfig) Load() error
Load loads bootstrap discovery configuration.
type Config ¶
type Config struct {
Addresses []multiaddr.Multiaddr
HostConfig
GossipSubConfig
BootstrapDiscoveryConfig
}
Config describes a set of P2P settings for a peer.
type ConnGaterConfig ¶
ConnGaterConfig describes a set of settings for a connection gater.
func (*ConnGaterConfig) Load ¶
func (cfg *ConnGaterConfig) Load() error
Load loads connection gater configuration.
func (*ConnGaterConfig) NewConnGater ¶
func (cfg *ConnGaterConfig) NewConnGater() (*conngater.BasicConnectionGater, error)
NewConnGater constructs a new connection gater.
type ConnManagerConfig ¶
type ConnManagerConfig struct {
MinPeers int
MaxPeers int
GracePeriod time.Duration
PersistentPeers []peer.ID
}
ConnManagerConfig describes a set of settings for a connection manager.
func (*ConnManagerConfig) Load ¶
func (cfg *ConnManagerConfig) Load() error
Load loads connection manager configuration.
func (*ConnManagerConfig) NewConnManager ¶
func (cfg *ConnManagerConfig) NewConnManager() (*connmgr.BasicConnMgr, error)
NewConnManager constructs a new connection manager.
type GossipSubConfig ¶
type GossipSubConfig struct {
// XXX: Main config has int64, but here just int -- investigate.
PeerOutboundQueueSize int
ValidateQueueSize int
ValidateThrottle int
PersistentPeers []peer.AddrInfo
}
GossipSubConfig describes a set of settings for a gossip pubsub.
func (*GossipSubConfig) Load ¶
func (cfg *GossipSubConfig) Load() error
Load loads gossipsub configuration.
type HostConfig ¶
type HostConfig struct {
Signer signature.Signer
UserAgent string
ListenAddr multiaddr.Multiaddr
Port uint16
ConnManagerConfig
ConnGaterConfig
}
HostConfig describes a set of settings for a host.
func (*HostConfig) NewHost ¶
func (cfg *HostConfig) NewHost() (host.Host, *conngater.BasicConnectionGater, error)
NewHost constructs a new libp2p host.
type SeedConfig ¶
type SeedConfig struct {
CommonStore *persistent.CommonStore
HostConfig
BootstrapDiscoveryConfig
}
SeedConfig describes a set of settings for a seed.
func (*SeedConfig) NewSeed ¶
func (cfg *SeedConfig) NewSeed() (api.SeedService, error)
NewSeed creates a new P2P seed node service.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package api implements the P2P API.
|
Package api implements the P2P API. |
|
Package backup provides tools for backing up peers.
|
Package backup provides tools for backing up peers. |
|
Package config implements global configuration options.
|
Package config implements global configuration options. |
|
discovery
|
|
|
Package error exists only to break an import loop.
|
Package error exists only to break an import loop. |
|
Package rpc provides tools for building simple RPC protocols via libp2p.
|
Package rpc provides tools for building simple RPC protocols via libp2p. |