p2p

package
v0.0.0-...-05c9d29 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolIDPing      = "/pi/ping/1.0.0"
	ProtocolIDTx        = "/pi/tx/1.0.0"
	ProtocolIDBlock     = "/pi/block/1.0.0"
	ProtocolIDGossip    = "/pi/gossip/1.0.0"
	ProtocolIDDiscovery = "/pi/discovery/1.0.0"
)

Variables

Functions

This section is empty.

Types

type P2PNode

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

func NewP2PNode

func NewP2PNode(ctx context.Context, privKeyBytes []byte, port int) (*P2PNode, error)

func (*P2PNode) Addrs

func (n *P2PNode) Addrs() []multiaddr.Multiaddr

func (*P2PNode) Close

func (n *P2PNode) Close() error

func (*P2PNode) Connect

func (n *P2PNode) Connect(ctx context.Context, addrStr string) error

func (*P2PNode) ID

func (n *P2PNode) ID() peer.ID

func (*P2PNode) Multiaddr

func (n *P2PNode) Multiaddr() string

func (*P2PNode) NewStream

func (n *P2PNode) NewStream(ctx context.Context, p peer.ID, pid core.ProtocolID) (core.Stream, error)

func (*P2PNode) PeerCount

func (n *P2PNode) PeerCount() int

func (*P2PNode) Peers

func (n *P2PNode) Peers() int

func (*P2PNode) SignMessage

func (n *P2PNode) SignMessage(msg []byte) []byte

func (*P2PNode) String

func (n *P2PNode) String() string

type PeerInfo

type PeerInfo struct {
	Addr       multiaddr.Multiaddr
	Protocols  []core.ProtocolID
	Latency    time.Duration
	TrustScore float64
}

type StreamManager

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

Jump to

Keyboard shortcuts

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