Documentation
¶
Index ¶
- func AdvertiseSSDP(ctx context.Context, nickname, ip string, port int, peerID string) (stop func(), err error)
- func BLECentralSendData(peripheralUUID string, data []byte)
- func BLECentralSendSDP(_ string, _ string)
- func BLEPeripheralSendDataTo(_ string, _ []byte)
- func BLEPeripheralSendSDP(_ string)
- func BrowseBonjour(ctx context.Context, mgr *Manager) (stop func(), err error)
- func ListenWSD(ctx context.Context, mgr *Manager) error
- func MakeDataChunks(data []byte) [][]byte
- func RegisterBonjour(nickname string, port int, fullAddrs []multiaddr.Multiaddr) (*zeroconf.Server, error)
- func SearchSSDP(ctx context.Context, mgr *Manager) (stop func(), err error)
- func SendWSDHello(ctx context.Context, nickname string, port int) error
- func SetBLECallbacks(_ func(string, string), _ func(string, string, bool), _ func(string))
- func SetBLEDataCallback(onData func(peerUUID string, data []byte))
- func StartBLE(ctx context.Context, nickname string, mgr *Manager) error
- type ChunkAssembler
- type DiscoveredPeer
- type Manager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdvertiseSSDP ¶
func AdvertiseSSDP(ctx context.Context, nickname, ip string, port int, peerID string) (stop func(), err error)
AdvertiseSSDP announces this peer on the local network. ip should be a routable interface address (not 0.0.0.0); peerID is the libp2p host ID so receivers can construct a full multiaddr and dial back.
func BLECentralSendData ¶ added in v0.4.0
func BLECentralSendSDP ¶ added in v0.3.0
func BLEPeripheralSendDataTo ¶ added in v0.4.0
func BLEPeripheralSendSDP ¶ added in v0.3.0
func BLEPeripheralSendSDP(_ string)
func MakeDataChunks ¶ added in v0.4.0
MakeDataChunks splits data into BLE chunk frames for DataChar transmission. Each chunk: [type(1)][idx_hi(1)][idx_lo(1)][total_hi(1)][total_lo(1)][payload...]
func RegisterBonjour ¶
func SetBLECallbacks ¶ added in v0.3.0
func SetBLEDataCallback ¶ added in v0.4.0
Types ¶
type ChunkAssembler ¶ added in v0.4.0
type ChunkAssembler struct {
// contains filtered or unexported fields
}
ChunkAssembler reassembles BLE DataChar chunk sequences per peer. Not goroutine-safe — the caller must serialize Feed calls per instance.
func NewChunkAssembler ¶ added in v0.4.0
func NewChunkAssembler() *ChunkAssembler
func (*ChunkAssembler) Feed ¶ added in v0.4.0
func (a *ChunkAssembler) Feed(peerKey string, chunk []byte) ([]byte, bool)
Feed processes one raw BLE notification chunk for the given peer key. Returns (assembled data, true) when all chunks for a sequence have arrived.
func (*ChunkAssembler) Reset ¶ added in v0.4.0
func (a *ChunkAssembler) Reset(peerKey string)
Reset discards any partial assembly state for peerKey. Call when a peer disconnects to prevent stale buffer accumulation.
type DiscoveredPeer ¶
type Manager ¶
type Manager struct {
OnPeerFound func(DiscoveredPeer)
OnPeerLost func(DiscoveredPeer)
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) Notify ¶
func (m *Manager) Notify(p DiscoveredPeer)