discover

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2014 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package discover implements the device discovery protocol.

Index

Constants

View Source
const (
	AnnouncementMagic = 0x9D79BC39
	QueryMagic        = 0x2CA856F5
)

Variables

View Source
var (
	ErrIncorrectMagic = errors.New("incorrect magic number")
)

Functions

This section is empty.

Types

type Address

type Address struct {
	IP   []byte // max:16
	Port uint16
}

func (Address) AppendXDR

func (o Address) AppendXDR(bs []byte) []byte

func (*Address) DecodeXDR

func (o *Address) DecodeXDR(r io.Reader) error

func (Address) EncodeXDR

func (o Address) EncodeXDR(w io.Writer) (int, error)

func (Address) MarshalXDR

func (o Address) MarshalXDR() []byte

func (*Address) UnmarshalXDR

func (o *Address) UnmarshalXDR(bs []byte) error

type Announce

type Announce struct {
	Magic uint32
	This  Device
	Extra []Device // max:16
}

func (Announce) AppendXDR

func (o Announce) AppendXDR(bs []byte) []byte

func (*Announce) DecodeXDR

func (o *Announce) DecodeXDR(r io.Reader) error

func (Announce) EncodeXDR

func (o Announce) EncodeXDR(w io.Writer) (int, error)

func (Announce) MarshalXDR

func (o Announce) MarshalXDR() []byte

func (*Announce) UnmarshalXDR

func (o *Announce) UnmarshalXDR(bs []byte) error

type CacheEntry added in v0.10.2

type CacheEntry struct {
	Address string
	Seen    time.Time
}

type Device added in v0.10.0

type Device struct {
	ID        []byte    // max:32
	Addresses []Address // max:16
}

func (Device) AppendXDR added in v0.10.0

func (o Device) AppendXDR(bs []byte) []byte

func (*Device) DecodeXDR added in v0.10.0

func (o *Device) DecodeXDR(r io.Reader) error

func (Device) EncodeXDR added in v0.10.0

func (o Device) EncodeXDR(w io.Writer) (int, error)

func (Device) MarshalXDR added in v0.10.0

func (o Device) MarshalXDR() []byte

func (*Device) UnmarshalXDR added in v0.10.0

func (o *Device) UnmarshalXDR(bs []byte) error

type Discoverer

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

func NewDiscoverer

func NewDiscoverer(id protocol.DeviceID, addresses []string) *Discoverer

func (*Discoverer) All

func (d *Discoverer) All() map[protocol.DeviceID][]CacheEntry

func (*Discoverer) ExtAnnounceOK

func (d *Discoverer) ExtAnnounceOK() bool

func (*Discoverer) Hint

func (d *Discoverer) Hint(device string, addrs []string)

func (*Discoverer) Lookup

func (d *Discoverer) Lookup(device protocol.DeviceID) []string

func (*Discoverer) StartGlobal

func (d *Discoverer) StartGlobal(server string, extPort uint16)

func (*Discoverer) StartLocal

func (d *Discoverer) StartLocal(localPort int, localMCAddr string)

func (*Discoverer) StopGlobal

func (d *Discoverer) StopGlobal()

type Query

type Query struct {
	Magic    uint32
	DeviceID []byte // max:32
}

func (Query) AppendXDR

func (o Query) AppendXDR(bs []byte) []byte

func (*Query) DecodeXDR

func (o *Query) DecodeXDR(r io.Reader) error

func (Query) EncodeXDR

func (o Query) EncodeXDR(w io.Writer) (int, error)

func (Query) MarshalXDR

func (o Query) MarshalXDR() []byte

func (*Query) UnmarshalXDR

func (o *Query) UnmarshalXDR(bs []byte) error

Jump to

Keyboard shortcuts

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