p2p

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type P2p

type P2p struct {
	Logger interfaces.Logger
	Config interfaces.Config

	Orders   interfaces.OrderService
	Channels interfaces.ChannelService
	// contains filtered or unexported fields
}

P2p stores all things required to converse with other peers in the Sprawl network and save data locally

func NewP2p

func NewP2p(log interfaces.Logger, config interfaces.Config, privateKey crypto.PrivKey, publicKey crypto.PubKey) (p2p *P2p)

NewP2p returns a P2p struct with an input channel

func (*P2p) Close

func (p2p *P2p) Close()

Close closes the underlying libp2p host

func (*P2p) CreateOptions

func (p2p *P2p) CreateOptions() []libp2pConfig.Option

CreateOptions queries p2p.Config for any user-submitted options and assigns defaults

func (*P2p) RegisterChannelService

func (p2p *P2p) RegisterChannelService(channels interfaces.ChannelService)

RegisterChannelService registers a channel service to persist joined channels locally

func (*P2p) RegisterOrderService

func (p2p *P2p) RegisterOrderService(orders interfaces.OrderService)

RegisterOrderService registers an order service to persist order data locally

func (*P2p) Run

func (p2p *P2p) Run()

Run runs the p2p network

func (*P2p) Send

func (p2p *P2p) Send(message *pb.WireMessage)

Send queues a message for sending to other peers

func (*P2p) Subscribe

func (p2p *P2p) Subscribe(channel *pb.Channel)

Subscribe subscribes to a libp2p pubsub channel defined with "channel"

func (*P2p) Unsubscribe

func (p2p *P2p) Unsubscribe(channel *pb.Channel)

Unsubscribe sends a quit signal to a channel goroutine

Jump to

Keyboard shortcuts

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