Versions in this module Expand all Collapse all v0 v0.1.0 Jun 11, 2026 Changes in this version + func LoadOrGenerateID(path string) (string, error) + type ConnInfo = p2p.ConnInfo + type Handler = p2p.Handler + type Message struct + Payload any + Protocol string + Type string + func Msg(protocol, msgType string, payload any) Message + type Option func(*peerConfig) + func WithAdvertiseAddr(addr string) Option + func WithBootstrap(addrs ...string) Option + func WithCodec(c codec.Codec) Option + func WithDHT(cfg ...dht.Config) Option + func WithHandler(protocol string, handler Handler) Option + func WithHandlerFactory(factory func(node.Node)) Option + func WithHandshakeTimeout(d time.Duration) Option + func WithIdentityPath(path string) Option + func WithMaxFrameSize(bytes uint32) Option + func WithMaxInboundPeers(n int) Option + func WithMaxPeers(n int) Option + func WithMaxPendingPeers(n int) Option + func WithPeerConnected(fn func(peerID string)) Option + func WithPeerDisconnected(fn func(peerID string)) Option + func WithPingInterval(d time.Duration) Option + func WithPingMaxMissed(n int) Option + func WithProtocolFrameSize(protocol string, bytes uint32) Option + type Peer struct + func NewPeer(addr string, opts ...Option) (*Peer, error) + func NewVerifiedPeer(kp *identity.Keypair, addr string, opts ...Option) (*Peer, error) + func (p *Peer) Addr() string + func (p *Peer) Announce(ctx context.Context, key, value []byte) (StoreResult, error) + func (p *Peer) Broadcast(msg Message) int + func (p *Peer) Close() error + func (p *Peer) ConnectionInfo(peerID string) (ConnInfo, bool) + func (p *Peer) FindProviders(ctx context.Context, key []byte) ([]ProviderRecord, error) + func (p *Peer) ID() string + func (p *Peer) Lookup(ctx context.Context, key []byte) ([]dht.NodeInfo, error) + func (p *Peer) Peers() []string + func (p *Peer) Send(peerID string, msg Message) (int, error) + type ProviderRecord = dht.ProviderRecord + type StoreResult = dht.StoreResult