presence

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Timestamp time.Time
	MAC       mac.MAC
	Present   bool
}

Event defines a presence event.

type Listener

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

Listener listens on a given address for incoming connections. For each connection received, it parses the presence message and passes the event to the callback.

func NewListener

func NewListener(addr string, logger log.Logger) (*Listener, error)

Listen returns a read-to-use Listener.

func (*Listener) Accept

func (l *Listener) Accept(ctx context.Context, cb func(Event)) error

Accept starts the listener accepting connections. It will stop when and if the context is canceled.

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

Addr returns the address the listener is bound to.

func (*Listener) Close

func (l *Listener) Close() error

Close closes the listener.

Jump to

Keyboard shortcuts

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