p2pfacade

package module
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: MIT Imports: 26 Imported by: 0

README

libp2p-facade

API Reference Github Actions

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

  • Streams were simplfied into a Request and Handle procedues
  • Pubsub can be used with a simpler api to avoid topic management
  • Config has a simple and extensible structure
  • Metrics (prometheus)

Install

go get github.com/amirylm/libp2p-facade

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewKadDHT added in v0.1.1

func NewKadDHT(ctx context.Context, host host.Host, protocolPrefix protocol.ID,
	mode dht.ModeOpt, bootstrappers []peer.AddrInfo) (routing.Routing, discovery.Discovery, error)

NewKadDHT creates a new kademlia DHT and a corresponding discovery service

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 *config.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 []*config.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