p2p

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 37 Imported by: 1 module, 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

func EncodeAddrs added in v0.12.0

func EncodeAddrs(addrs []multiaddr.Multiaddr) ([]byte, error)

EncodeAddrs encodes a slice of multiaddrs into a byte slice

func GenKeyPair added in v0.10.0

func GenKeyPair() (crypto.PrivKey, crypto.PubKey, peer.ID, error)

Note: the curve used to generate the key pair will mostly likely change in the future.

func NewGossipTracer added in v0.12.3

func NewGossipTracer(h host.Host) *gossipTracer

Types

type Service

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

func New

func New(
	addr,
	publicAddr,
	version,
	peers,
	privKeyStr string,
	feederNode bool,
	bc *blockchain.Blockchain,
	snNetwork *networks.Network,
	logger log.StructuredLogger,
	database db.KeyValueStore,
	compiler compiler.Compiler,
) (*Service, error)

func NewWithHost added in v0.6.0

func NewWithHost(
	p2phost host.Host,
	peers string,
	feederNode bool,
	bc *blockchain.Blockchain,
	snNetwork *networks.Network,
	logger log.StructuredLogger,
	database db.KeyValueStore,
	compiler compiler.Compiler,
) (*Service, error)

func (*Service) Listen added in v0.15.3

func (s *Service) Listen() <-chan p2pSync.BlockBody

func (*Service) ListenAddrs

func (s *Service) ListenAddrs() ([]multiaddr.Multiaddr, error)

func (*Service) NewStream added in v0.6.0

func (s *Service) NewStream(ctx context.Context, pids ...protocol.ID) (network.Stream, error)

NewStream creates a bidirectional connection to a random peer that implements a set of protocol ids

func (*Service) Run

func (s *Service) Run(ctx context.Context) error

Run starts the p2p service. Calling any other function before run is undefined behaviour

func (*Service) WithListener added in v0.10.0

func (s *Service) WithListener(l junoSync.EventListener)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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