lp2p

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0, MIT Imports: 31 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructHost

func ConstructHost(ds datastore.Datastore, 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       client.Client
}

GossipRelayConfig configures a gossip relay node.

type GossipRelayNode

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

GossipRelayNode is a gossip relay runtime.

func NewGossipRelayNode

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

NewGossipRelayNode starts a new gossip 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.

Directories

Path Synopsis
Package client provides a drand client implementation that retrieves randomness by subscribing to a libp2p pubsub topic.
Package client provides a drand client implementation that retrieves randomness by subscribing to a libp2p pubsub topic.

Jump to

Keyboard shortcuts

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