sd01

package
v0.0.0-...-a1394a3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Port is the sd01 service discovery port number.
	Port = 17823
)

Variables

View Source
var (
	// Interval between announcements.
	Interval = 5 * time.Second
)

these vars may be overridden by test

View Source
var (
	// Timeout after which a discovered service is considered non-existent.
	// Defined by protocol.
	Timeout = 600 * time.Second
)

these vars may be overridden by test

Functions

This section is empty.

Types

type Announcer

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

Announcer implements sd01 service announcement.

func NewAnnouncer

func NewAnnouncer(name string, port int) *Announcer

NewAnnouncer returns a new Announcer and published beacons containing the supplied service name and port number.

func (*Announcer) Start

func (a *Announcer) Start() error

Start the Announcer. Remember to call Stop when finished.

func (*Announcer) Stop

func (a *Announcer) Stop()

Stop the Announcer.

type Discoverer

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

Discoverer implements sd01 service discovery and provides a list of recently discovered services.

func NewDiscoverer

func NewDiscoverer(name string) *Discoverer

NewDiscoverer returns a new Discoverer with name as the service filter. Matching service discoveries will be reported via the GetServices method

func (*Discoverer) GetServices

func (d *Discoverer) GetServices() []Service

GetServices returns a list of recently discovered services.

func (*Discoverer) Start

func (d *Discoverer) Start() error

Start the Discoverer. Remember to call Stop when finished.

func (*Discoverer) Stop

func (d *Discoverer) Stop()

Stop the Discoverer.

type Service

type Service struct {
	IP       net.IP
	Port     int
	LastSeen time.Time
}

Service provides information about a remote service.

func (*Service) String

func (s *Service) String() string

String returns a human friendly representation of the Service.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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