mdns

package
v0.0.0-...-1dbb05a Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = &Config{
	ForceUnicastResponses: false,
	MinTTL:                300,
	BrowsePeriod:          60 * time.Second,
	CachePurgePeriod:      300 * time.Second,
	RetryPeriod:           250 * time.Millisecond,
	Transport:             nil,
	Clock:                 clock.Realtime(),
	BindIPAddressV4:       net.IPv4zero,
	BindIPAddressV6:       net.IPv6zero,
}

DefaultConfig represents the defaut mDNS config

Functions

This section is empty.

Types

type Client

type Client struct {
	Config
	// contains filtered or unexported fields
}

Client represents a mDNS client

func New

func New(config *Config) (*Client, error)

New builds a mDNS Client with the given configuration

func (*Client) Close

func (c *Client) Close() error

Close shuts down the client

func (*Client) Query

func (c *Client) Query(ctx context.Context, questions ...dns.Question) ([]dns.RR, error)

Query takes a list of questions and tries to resove them until answers are received or context is cancelled.

type Config

type Config struct {
	ForceUnicastResponses bool          // whether to force unicast according to RFC 6762, section 18.12.
	BindIPAddressV4       net.IP        // IPv4 interface to bind to
	BindIPAddressV6       net.IP        // IPv6 interface to bind to
	MinTTL                uint32        // minimum TTL to keep records for, overriding mDNS response
	BrowseServices        []string      // List of services to scan and keep updated
	BrowsePeriod          time.Duration // How often scan the list of services
	CachePurgePeriod      time.Duration // How often clean the cache for stale records
	RetryPeriod           time.Duration // How often retry mDNS queries
	Transport             transport     // Network transport. Defaults to UDP. Useful for testing
	Clock                 clock.Clock   // Time reference. Defaults to system time. Useful for testing
}

Config contains the configuration of the mDNS client

func (*Config) ApplyDefaults

func (config *Config) ApplyDefaults() error

ApplyDefaults fills the missing fields with sane default values

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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