discovery

package
v0.0.0-...-178e1e7 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2017 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	Model        string
	Platform     string
	MacAddress   string
	Hostname     string
	Firmware     string
	IPAddresses  map[string][]string
	UpSince      time.Time
	Essid        string
	WirelessMode string
	LastSeenAt   time.Time
	FirstSeenAt  time.Time
}

Device descibes an UBNT device found on the local network

func (*Device) Clone

func (d *Device) Clone() *Device

Clone creates a deep-copy

func (*Device) Merge

func (d *Device) Merge(other *Device)

Merge updates this instance with the values of the other (by copying the data), so that references to this instance are kept intact

func (*Device) RecentlySeen

func (d *Device) RecentlySeen(dur time.Duration) bool

RecentlySeen tells you, whether you have seen this device in the given time period

func (*Device) String

func (d *Device) String() string

type Discover

type Discover struct {
	NotifyHandler NotifyHandler
	// contains filtered or unexported fields
}

func AutoDiscover

func AutoDiscover(notify NotifyHandler, interfaceNames ...string) (d *Discover, err error)

AutoDiscover starts the UBNT auto discovery mechanism. It returns a notifier channel which receives newly discovered devices (i.e. a device already seen won't be send again). You can stop the discovery by closing the quit channel.

func (*Discover) Close

func (d *Discover) Close()

Close closes ...

func (*Discover) Find

func (d *Discover) Find(mac string) *Device

Find will search the list of discovered devices for an entry with matching MAC address, and return a duplicate.

func (*Discover) List

func (d *Discover) List() (list []*Device)

List all discovered devices so far. Will create duplicates of the actual device list, so that it'll be safe to work with the result.

type NotifyHandler

type NotifyHandler func(*Device)

type Packet

type Packet struct {
	Version uint8
	Tags    []*Tag
	// contains filtered or unexported fields
}

Packet holds information about a UBNT Discovery response

func ParsePacket

func ParsePacket(raw []byte) (*Packet, error)

ParsePacket tries to parse UPD packet data into a Packet

func (*Packet) Device

func (p *Packet) Device() *Device

Device converts the packet information into a new device

type Tag

type Tag struct {
	ID TagID
	// contains filtered or unexported fields
}

Tag describes a key value pair

func ParseTag

func ParseTag(id TagID, n uint16, raw []byte) (*Tag, error)

ParseTag converts a byte stream (i.e. an UDP packet slice) into a Tag

func (*Tag) Description

func (t *Tag) Description() string

Description returns the long tag name

func (*Tag) Name

func (t *Tag) Name() string

Name returns the short tag name

func (*Tag) StringInto

func (t *Tag) StringInto(ref *string)

StringInto tries to update the given string reference with a type asserted value (it doesn't perform an update, if the type assertion fails)

type TagDescription

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

TagDescription annotates some meta information to a TagID

type TagID

type TagID uint8

TagID identifies tags

Jump to

Keyboard shortcuts

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