Documentation ¶
Overview ¶
Package beacon implements a peer-to-peer discovery service for local networks. A beacon can broadcast and/or capture service announcements using UDP messages on the local area network. This implementation uses IPv4 UDP broadcasts. You can define the format of your outgoing beacons, and set a filter that validates incoming beacons. Beacons are sent and received asynchronously in the background.
This package is an idiomatic go translation of zbeacon class of czmq at following address:
https://github.com/zeromq/czmq
Instead of ZMQ_PEER socket it uses go channel and also uses go routine instead of zthread. To simplify the implementation it doesn't pass API calls through the pipe (as zbeacon does) instead it modifies beacon struct directly.
For more information please visit:
http://hintjens.com/blog:32
Index ¶
- type Beacon
- func (b *Beacon) Addr() string
- func (b *Beacon) Close()
- func (b *Beacon) NoEcho() *Beacon
- func (b *Beacon) Port() int
- func (b *Beacon) Publish(transmit []byte) error
- func (b *Beacon) SetInterface(iface string) *Beacon
- func (b *Beacon) SetInterval(interval time.Duration) *Beacon
- func (b *Beacon) SetPort(port int) *Beacon
- func (b *Beacon) Signals() chan interface{}
- func (b *Beacon) Silence() *Beacon
- func (b *Beacon) Subscribe(filter []byte) *Beacon
- func (b *Beacon) Unsubscribe() *Beacon
- type Signal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Beacon ¶
Beacon defines main structure of the application
func (*Beacon) SetInterface ¶
SetInterface sets interface to bind and listen on.
func (*Beacon) SetInterval ¶
SetInterval sets broadcast interval.
func (*Beacon) Signals ¶
func (b *Beacon) Signals() chan interface{}
Signals returns Signals channel
func (*Beacon) Subscribe ¶
Subscribe starts listening to other peers; zero-sized filter means get everything.
func (*Beacon) Unsubscribe ¶
Unsubscribe stops listening to other peers.