discovery

package module
v0.0.0-...-d5ff492 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceTag = "_ble-discovery._udp"

Variables

View Source
var DiscoveryMap sync.Map

Functions

This section is empty.

Types

type BleDiscoveryService

type BleDiscoveryService interface {
	HandleFoundPeer(remotePID string) bool
	HandleLostPeer(remotePID string)
}

type NativeDriver

type NativeDriver interface {
	// Start the native driver
	Start(localPID string)

	// Stop the native driver
	Stop()

	// Check if the native driver is connected to the remote peer
	DialPeer(remotePID string) bool

	// Send data to the remote peer
	SendToPeer(remotePID string, payload []byte) bool

	// Close the connection with the remote peer
	CloseConnWithPeer(remotePID string)

	// Return the multiaddress protocol code
	ProtocolCode() int

	// Return the multiaddress protocol name
	ProtocolName() string

	// Return the default multiaddress
	DefaultAddr() string
}

type NoopNativeDriver

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

func NewNoopNativeDriver

func NewNoopNativeDriver(protocolCode int, protocolName, defaultAddr string) *NoopNativeDriver

func (*NoopNativeDriver) CloseConnWithPeer

func (d *NoopNativeDriver) CloseConnWithPeer(_ string)

func (*NoopNativeDriver) DefaultAddr

func (d *NoopNativeDriver) DefaultAddr() string

func (*NoopNativeDriver) DialPeer

func (d *NoopNativeDriver) DialPeer(_ string) bool

func (*NoopNativeDriver) ProtocolCode

func (d *NoopNativeDriver) ProtocolCode() int

func (*NoopNativeDriver) ProtocolName

func (d *NoopNativeDriver) ProtocolName() string

func (*NoopNativeDriver) SendToPeer

func (d *NoopNativeDriver) SendToPeer(_ string, _ []byte) bool

func (*NoopNativeDriver) Start

func (d *NoopNativeDriver) Start(_ string)

func (*NoopNativeDriver) Stop

func (d *NoopNativeDriver) Stop()

type Notifee

type Notifee interface {
	HandlePeerFound(peer.AddrInfo)
}

type Service

type Service interface {
	io.Closer
	RegisterNotifee(Notifee)
	UnregisterNotifee(Notifee)
}

func NewBleDiscoveryService

func NewBleDiscoveryService(ctx context.Context, peerhost host.Host, driver NativeDriver, interval time.Duration, serviceTag string) (Service, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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