Documentation ¶
Index ¶
- type P2p
- func (p2p *P2p) Close()
- func (p2p *P2p) CreateOptions() []libp2pConfig.Option
- func (p2p *P2p) RegisterChannelService(channels interfaces.ChannelService)
- func (p2p *P2p) RegisterOrderService(orders interfaces.OrderService)
- func (p2p *P2p) Run()
- func (p2p *P2p) Send(message *pb.WireMessage)
- func (p2p *P2p) Subscribe(channel *pb.Channel)
- func (p2p *P2p) Unsubscribe(channel *pb.Channel)
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) 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) Send ¶
func (p2p *P2p) Send(message *pb.WireMessage)
Send queues a message for sending to other peers
func (*P2p) Unsubscribe ¶
Unsubscribe sends a quit signal to a channel goroutine
Click to show internal directories.
Click to hide internal directories.