libp2p

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const MaxFrameSize = 1 * 1024 * 1024 // 1 MiB

MaxFrameSize bounds a single length-prefixed frame on TSS streams. The cap rejects oversize length prefixes before allocation so a peer cannot trigger large attacker-chosen heap allocations. Sized well above the largest observed DKLS Step() + coordinator.Message wrapping for our committee sizes.

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