p2p

package
v0.2300.10 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Overview

Package p2p implements the worker committee gossip network.

Index

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

NewHost constructs a new libp2p host.

func NewNop

func NewNop() api.Service

NewNop creates a new no-op P2P node.

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.

func (*Config) Load

func (cfg *Config) Load() error

Load loads P2P configuration.

type ConnGaterConfig

type ConnGaterConfig struct {
	BlockedPeers []net.IP
}

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) Load

func (cfg *HostConfig) Load() error

Load loads host configuration.

func (*HostConfig) NewHost

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) Load

func (cfg *SeedConfig) Load() error

Load loads seed configuration.

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.

Jump to

Keyboard shortcuts

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