p2p

package
v0.0.0-...-a5614bf Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ListenAddr string
}

Config represents p2p host configuration

type Host

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

Host represents a p2p network host

func New

func New(ctx context.Context, cfg *Config) (*Host, error)

New creates a new p2p host

func (*Host) Close

func (h *Host) Close() error

Close shuts down the p2p host

func (*Host) Connect

func (h *Host) Connect(ctx context.Context, addr string) error

Connect attempts to connect to a peer

func (*Host) GetAddrs

func (h *Host) GetAddrs() []multiaddr.Multiaddr

GetAddrs returns the addresses this host is listening on

func (*Host) GetHost

func (h *Host) GetHost() host.Host

GetHost returns the underlying libp2p host

func (*Host) GetPeerID

func (h *Host) GetPeerID() peer.ID

GetPeerID returns the peer ID of this host

Jump to

Keyboard shortcuts

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