discovery

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: May 5, 2019 License: Apache-2.0 Imports: 19 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 (
	DELTA_PROBE = 2 * time.Minute
	DEFAULT_TTL = 15 * time.Minute
)
View Source
const (
	MDNS_DEFAULT_DOMAIN = "local."
	DELTA_QUERY_MS      = 500
	REPEAT_QUERY        = 4
)

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(source rpc.DiscoveryType) []string

EnumerateServices returns the names of discovered service types and filters to those which have been registered locally (rather than through DNS service discovery) if flag is set

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, source rpc.DiscoveryType) []rpc.ServiceRecord

func (*Config) IndexForService

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

func (*Config) Init

func (this *Config) Init(config Discovery, 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) 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) UnexpiredServices added in v1.0.8

func (this *Config) UnexpiredServices(records []rpc.ServiceRecord) []rpc.ServiceRecord

ExpireServices returns an array of unexpired services

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

type Discovery

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

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) AnswerEnumMulticast added in v1.0.8

func (this *Listener) AnswerEnumMulticast(services []string, question Question, ttl time.Duration) error

func (*Listener) AnswerInstanceMulticast added in v1.0.8

func (this *Listener) AnswerInstanceMulticast(instances []rpc.ServiceRecord, question Question, ttl time.Duration) error

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<- Question) error

func (*Listener) QueryAll added in v1.0.8

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

QueryAll sends a message to all multicast addresses

func (Listener) String

func (this Listener) String() string

type Question added in v1.0.8

type Question struct {
	Message *dns.Msg
	Query   string
	IfIndex int
	From    net.Addr
}

Jump to

Keyboard shortcuts

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