peer

package
v0.1.25 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 25 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 {
	RepoPath                 string
	PrivKey                  crypto.PrivKey
	ListenMultiaddrs         []string
	AnnounceMultiaddrs       []string
	BootstrapAddrs           []string
	ConnManager              cconnmgr.ConnManager
	EnableQUIC               bool
	EnableNATPortMap         bool
	EnableMDNS               bool
	EnablePubSubPeerExchange bool
	EnablePubSubFloodPublish bool
}

Config defines params for Peer configuration.

type Info

type Info struct {
	ID        peer.ID
	PublicKey string
	Addresses []multiaddr.Multiaddr
}

Info contains public information about the libp2p peer.

type Peer

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

Peer wraps libp2p peer components for pubsub rpc.

func New

func New(conf Config) (*Peer, error)

New returns a new Peer.

func (*Peer) BlockStore

func (p *Peer) BlockStore() blockstore.Blockstore

BlockStore returns the underlying format.DAGService.

func (*Peer) Bootstrap

func (p *Peer) Bootstrap()

Bootstrap the market peer against Config.Bootstrap network peers. Some well-known network peers are included by default.

func (*Peer) Close

func (p *Peer) Close() error

Close the peer.

func (*Peer) DAGService

func (p *Peer) DAGService() format.DAGService

DAGService returns the underlying format.DAGService.

func (*Peer) Host

func (p *Peer) Host() host.Host

Host returns the peer host.

func (*Peer) Info

func (p *Peer) Info() (*Info, error)

Info returns the peer's public information.

func (*Peer) ListPeers

func (p *Peer) ListPeers() []peer.ID

ListPeers returns the peers the market peer currently connects to.

func (*Peer) NewTopic

func (p *Peer) NewTopic(ctx context.Context, topic string, subscribe bool) (*rpc.Topic, error)

NewTopic returns a new pubsub.Topic using the peer's host.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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