libp2p

package
v2.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: BSD-3-Clause Imports: 69 Imported by: 3 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	IncomingStreamCountLimit = 5_000
	OutgoingStreamCountLimit = 10_000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChequebookStorer added in v2.8.0

type ChequebookStorer interface {
	Put(peer swarm.Address, chequebook common.Address, timestamp int64, source bzz.TimestampSource, writeAddressbook func() error) error
	Remove(peer swarm.Address)
}

ChequebookStorer persists the overlay→chequebook mapping. Put holds its internal mutex for the duration of writeAddressbook, so registry and addressbook writes are atomic with respect to concurrent ingestions.

type Options

type Options struct {
	PrivateKey                  *ecdsa.PrivateKey
	NATAddr                     string
	NATWSSAddr                  string
	EnableWS                    bool
	EnableWSS                   bool
	WSSAddr                     string
	AutoTLSStorageDir           string
	AutoTLSCAEndpoint           string
	AutoTLSDomain               string
	AutoTLSRegistrationEndpoint string
	FullNode                    bool
	LightNodeLimit              int
	WelcomeMessage              string
	Nonce                       []byte
	AllowPrivateCIDRs           bool

	HeadersRWTimeout time.Duration
	Registry         *prometheus.Registry

	ChequebookVerifier chequebook.Verifier
	ChequebookStorer   ChequebookStorer
	// contains filtered or unexported fields
}

type P2PForgeCertManager added in v2.7.1

type P2PForgeCertManager struct {
	// contains filtered or unexported fields
}

P2PForgeCertManager wraps the p2p-forge certificate manager with its associated zap logger.

func (*P2PForgeCertManager) CertMgr added in v2.7.1

CertMgr returns the underlying p2pforge.P2PForgeCertMgr.

func (*P2PForgeCertManager) ZapLogger added in v2.7.1

func (m *P2PForgeCertManager) ZapLogger() *zap.Logger

ZapLogger returns the zap logger used by the certificate manager.

type P2PForgeOptions added in v2.7.1

type P2PForgeOptions struct {
	Domain               string
	RegistrationEndpoint string
	CAEndpoint           string
	StorageDir           string
}

P2PForgeOptions contains the configuration for creating a P2P Forge certificate manager.

type Service

type Service struct {
	HeadersRWTimeout time.Duration
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, signer beecrypto.Signer, networkID uint64, overlay swarm.Address, addr string, ab addressbook.GetPutter, storer storage.StateStorer, lightNodes *lightnode.Container, logger log.Logger, tracer *tracing.Tracer, o Options) (s *Service, returnErr error)

func (*Service) AddProtocol

func (s *Service) AddProtocol(p p2p.ProtocolSpec) (err error)

func (*Service) Addresses

func (s *Service) Addresses() (addresses []ma.Multiaddr, err error)

func (*Service) Blocklist

func (s *Service) Blocklist(overlay swarm.Address, duration time.Duration, reason string) error

func (*Service) Blocklisted

func (s *Service) Blocklisted(overlay swarm.Address) (bool, error)

func (*Service) BlocklistedPeers

func (s *Service) BlocklistedPeers() ([]p2p.BlockListedPeer, error)

func (*Service) Close

func (s *Service) Close() error

func (*Service) Connect

func (s *Service) Connect(ctx context.Context, addrs []ma.Multiaddr) (address *bzz.Address, err error)

func (*Service) Disconnect

func (s *Service) Disconnect(overlay swarm.Address, reason string) (err error)

func (*Service) GetWelcomeMessage

func (s *Service) GetWelcomeMessage() string

GetWelcomeMessage returns the value of the welcome message.

func (*Service) Halt

func (s *Service) Halt()

func (*Service) Metrics

func (s *Service) Metrics() []prometheus.Collector

func (*Service) NATManager

func (s *Service) NATManager() basichost.NATManager

func (*Service) NetworkStatus

func (s *Service) NetworkStatus() p2p.NetworkStatus

NetworkStatus implements the p2p.NetworkStatuser interface.

func (*Service) NewStream

func (s *Service) NewStream(ctx context.Context, overlay swarm.Address, headers p2p.Headers, protocolName, protocolVersion, streamName string) (p2p.Stream, error)

func (*Service) Peers

func (s *Service) Peers() []p2p.Peer

func (*Service) Ping

func (s *Service) Ping(ctx context.Context, addr ma.Multiaddr) (rtt time.Duration, err error)

func (*Service) Ready

func (s *Service) Ready() error

func (*Service) SetChequebookAddress added in v2.8.0

func (s *Service) SetChequebookAddress(addr common.Address)

SetChequebookAddress sets the local chequebook address included in subsequent signed BzzAddress payloads. The zero value clears it.

func (*Service) SetPickyNotifier

func (s *Service) SetPickyNotifier(n p2p.PickyNotifier)

func (*Service) SetWelcomeMessage

func (s *Service) SetWelcomeMessage(val string) error

SetWelcomeMessage sets the welcome message for the handshake protocol.

func (*Service) StatusMetrics added in v2.6.0

func (s *Service) StatusMetrics() []prometheus.Collector

StatusMetrics exposes metrics that are exposed on the status protocol.

Directories

Path Synopsis
internal
handshake/pb
Package pb holds only Protocol Buffer definitions and generated code.
Package pb holds only Protocol Buffer definitions and generated code.
headers/pb
Package pb holds only Protocol Buffer definitions and generated code.
Package pb holds only Protocol Buffer definitions and generated code.
reacher
Package reacher runs a background worker that will ping peers from an internal queue and report back the reachability to the notifier.
Package reacher runs a background worker that will ping peers from an internal queue and report back the reachability to the notifier.

Jump to

Keyboard shortcuts

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