lp2p

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0, MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructHost

func ConstructHost(priv crypto.PrivKey, listenAddr string, bootstrap []ma.Multiaddr, log dlog.Logger) (host.Host, *pubsub.PubSub, error)

ConstructHost build a libp2p host configured for relaying drand randomness over pubsub.

func LoadOrCreatePrivKey

func LoadOrCreatePrivKey(identityPath string, log dlog.Logger) (crypto.PrivKey, error)

LoadOrCreatePrivKey loads a base64 encoded libp2p private key from a file or creates one if it does not exist.

func ParseMultiaddrSlice

func ParseMultiaddrSlice(peers []string) ([]ma.Multiaddr, error)

ParseMultiaddrSlice parses a list of addresses into multiaddrs

func PubSubTopic

func PubSubTopic(h string) string

PubSubTopic generates a drand pubsub topic from a chain hash.

Types

type GossipRelayConfig

type GossipRelayConfig struct {
	// ChainHash is a hash that uniquely identifies the drand chain.
	ChainHash    string
	PeerWith     []string
	Addr         string
	DataDir      string
	IdentityPath string
	CertPath     string
	Insecure     bool
	Client       drand.Client
}

GossipRelayConfig configures a gossip-relay relay node.

type GossipRelayNode

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

GossipRelayNode is a gossip-relay relay runtime.

func NewGossipRelayNode

func NewGossipRelayNode(l log.Logger, cfg *GossipRelayConfig) (*GossipRelayNode, error)

NewGossipRelayNode starts a new gossip-relay relay node.

func (*GossipRelayNode) Multiaddrs

func (g *GossipRelayNode) Multiaddrs() []ma.Multiaddr

Multiaddrs returns the gossipsub multiaddresses of this relay node.

func (*GossipRelayNode) Shutdown

func (g *GossipRelayNode) Shutdown()

Shutdown stops the relay node.

Jump to

Keyboard shortcuts

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