libp2p

package
v0.0.38 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 20 Imported by: ? modules, 0 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// ListenAddrs is the list of multiaddrs to bind to. Defaults to /ip4/0.0.0.0/tcp/0.
	ListenAddrs []string
	// ProtocolID is the stream protocol identifier. Defaults to /push/tss/1.0.0.
	ProtocolID string
	// PrivateKeyBase64 optionally contains a base64-encoded libp2p private key.
	// If empty, a fresh Ed25519 keypair is generated.
	PrivateKeyBase64 string
	// DialTimeout bounds outbound dial operations.
	DialTimeout time.Duration
	// IOTimeout bounds stream read/write operations.
	IOTimeout time.Duration
}

Config controls the libp2p network behaviour.

type Network

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

Network implements networking.Network using libp2p.

func New

func New(ctx context.Context, cfg Config, logger zerolog.Logger) (*Network, error)

New creates a new libp2p network instance.

func (*Network) Close

func (n *Network) Close() error

func (*Network) EnsurePeer

func (n *Network) EnsurePeer(peerID string, addrs []string) error

EnsurePeer implements networking.Network.

func (*Network) ID

func (n *Network) ID() string

ID implements networking.Network.

func (*Network) ListenAddrs

func (n *Network) ListenAddrs() []string

ListenAddrs implements networking.Network.

func (*Network) RegisterHandler

func (n *Network) RegisterHandler(handler networking.MessageHandler) error

RegisterHandler implements networking.Network.

func (*Network) Send

func (n *Network) Send(ctx context.Context, peerID string, data []byte) error

Send implements networking.Network.

Jump to

Keyboard shortcuts

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