bridge

package
v0.0.0-...-3bed901 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2020 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProtocolID = protocol.ID("/liblora-bridge/0.0.1")

ProtocolID is the protocol ID of the liblora bridge

Functions

This section is empty.

Types

type Bridge

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

Bridge allows authorized peers to open a stream and read/write data through the LoRa bridge

func NewBridge

func NewBridge(ctx context.Context, wg *sync.WaitGroup, logger *zap.Logger, serial Serial, opt Opts) (*Bridge, error)

NewBridge returns an initialized bridge, suitable for use a LibP2P protocol

func (*Bridge) Close

func (b *Bridge) Close() error

Close is used to shutdown the bridge serial interface

func (*Bridge) StreamHandler

func (b *Bridge) StreamHandler(stream network.Stream)

StreamHandler is used to open a bi-directional stream.

type Opts

type Opts struct {
	AuthorizedPeers map[peer.ID]bool // empty means allow all
}

Opts allows configuring the bridge

type Serial

type Serial interface {
	Write([]byte) (int, error)
	Available() (int, error)
	Read([]byte) (int, error)
	Flush() error
	Close() error
}

Serial is an interface to provide easy testing of the lora protocol

Jump to

Keyboard shortcuts

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