p2pfacade

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: MIT Imports: 21 Imported by: 0

README

libp2p-facade

Utilities plus a facade interface on top of libp2p host and major components.

It wraps configuration in a simple and extensible structure, inspired by go-libp2p/config#Config.

In addition, some prometheus metrics were added.

Install

go get github.com/amirylm/libp2p-facade

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMdns

func NewMdns(ctx context.Context, connect ConnectQueue, host host.Host, serviceTag string) mdns.Service

New creates a new mdns service

func Notiffee

func Notiffee(net libp2pnetwork.Network) (*libp2pnetwork.NotifyBundle, func())

Types

type ConnectQueue

type ConnectQueue chan peer.AddrInfo

type Facade

type Facade interface {
	Start(connectQ ConnectQueue) error
	Host() host.Host
	pubsub.PubsubService
	io.Closer
}

Facade is an interface on top of libp2p

func New

func New(ctx context.Context, cfg *commons.Config, opts ...libp2p.Option) (Facade, error)

New creates a new p2p facade with the given config, if options were provided they will be used instead.

func StartNodes

func StartNodes(ctx context.Context, cfgs []*commons.Config) ([]Facade, error)

StartNodes spins up nodes according to given config

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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