discovery

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2019 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

View Source
const (
	FILENAME_DEFAULT = "discovery.json"
	WRITE_DELTA      = 5 * time.Second
	EXPIRE_DELTA     = 60 * time.Second
)
View Source
const (
	MDNS_DEFAULT_DOMAIN = "local."
	MDNS_SERVICE_QUERY  = "_services._dns-sd._udp"
	DELTA_QUERY         = 5 * time.Second
)

Variables

View Source
var (
	MDNS_ADDR_IPV4 = &net.UDPAddr{IP: net.ParseIP("224.0.0.251"), Port: 5353}
	MDNS_ADDR_IPV6 = &net.UDPAddr{IP: net.ParseIP("ff02::fb"), Port: 5353}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	sync.Mutex
	event.Tasks
	event.Publisher

	// Public members
	Services []*rpc.ServiceRecord `json:"services"`
	// contains filtered or unexported fields
}

func (*Config) CreatePath

func (this *Config) CreatePath(path string) error

Create path if it doesn't exist

func (*Config) Destroy

func (this *Config) Destroy() error

func (*Config) EnumerateServices added in v1.0.6

func (this *Config) EnumerateServices(local bool) []string

func (*Config) ExpireServices

func (this *Config) ExpireServices() []*rpc.ServiceRecord

ExpireServices returns an array of unexpired services

func (*Config) ExpireTask

func (this *Config) ExpireTask(start chan<- event.Signal, stop <-chan event.Signal) error

func (*Config) GetServices added in v1.0.6

func (this *Config) GetServices(service string, local bool) []*rpc.ServiceRecord

func (*Config) IndexForService

func (this *Config) IndexForService(service *rpc.ServiceRecord) int

func (*Config) Init

func (this *Config) Init(path string, source gopi.Driver, errors chan<- error) error

func (*Config) Read

func (this *Config) Read(path string) error

Read the configuration from a file

func (*Config) Reader

func (this *Config) Reader(fh io.Reader) (*Config, error)

Reader reads the configuration from an io.Reader object

func (*Config) Register

func (this *Config) Register(service *rpc.ServiceRecord) error

func (*Config) Remove

func (this *Config) Remove(service *rpc.ServiceRecord) error

func (*Config) RemoveAtIndex

func (this *Config) RemoveAtIndex(index int) error

func (*Config) SetModified

func (this *Config) SetModified()

Set the modified flag to true

func (Config) String

func (this Config) String() string

func (*Config) Write

func (this *Config) Write(path string, indent bool) error

Write the configuration file to disk

func (*Config) WriteConfigTask

func (this *Config) WriteConfigTask(start chan<- event.Signal, stop <-chan event.Signal) error

func (*Config) Writer

func (this *Config) Writer(fh io.Writer, indent bool) error

Writer writes the configuration to a io.Writer object

type Discovery

type Discovery struct {
	Path      string
	Interface *net.Interface
	Domain    string
	Flags     gopi.RPCFlag
}

func (Discovery) Open

func (config Discovery) Open(logger gopi.Logger) (gopi.Driver, error)

type Listener

type Listener struct {
	sync.WaitGroup
	// contains filtered or unexported fields
}

func (*Listener) AnswerEnum added in v1.0.6

func (this *Listener) AnswerEnum(name string, ttl time.Duration)

func (*Listener) Destroy

func (this *Listener) Destroy() error

func (*Listener) Init

func (this *Listener) Init(config Discovery, errors chan<- error, services chan<- *rpc.ServiceRecord, questions chan<- string) error

func (*Listener) Query

func (this *Listener) Query(msg *dns.Msg, ctx context.Context) error

func (Listener) String

func (this Listener) String() string

Jump to

Keyboard shortcuts

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