Documentation ¶
Overview ¶
Package zone provides mDNS zone utilities.
Index ¶
Constants ¶
const (
// DefaultTTL is the default TTL value in returned DNS records in seconds.
DefaultTTL = 120
)
Variables ¶
var TestMDNSService = MDNSService{ Domain: "local", // contains filtered or unexported fields }
TestMDNSService is used for tests. Don't use.
Functions ¶
This section is empty.
Types ¶
type MDNSService ¶
type MDNSService struct { Instance string // Instance name (e.g. "hostService name") Service string // Service name (e.g. "_http._tcp.") Domain string // If blank, assumes "local" HostName string // Host machine DNS name (e.g. "mymachine.net.") Port int // Service Port IPs []net.IP // IP addresses for the service's host TXT []string // Service TXT records TTL uint32 // contains filtered or unexported fields }
MDNSService is used to export a named service by implementing a Zone.
func NewMDNSService ¶
func NewMDNSService( instance, service, domain, hostName string, port int, ips []net.IP, txt []string, ) (*MDNSService, error)
NewMDNSService returns a new instance of MDNSService.
If domain, hostName, or ips is set to the zero value, then a default value will be inferred from the operating system.
TODO(reddaly): This interface may need to change to account for "unique record" conflict rules of the mDNS protocol. Upon startup, the server should check to ensure that the instance name does not conflict with other instance names, and, if required, select a new name. There may also be conflicting hostName A/AAAA records.
func (*MDNSService) GetServiceAddr ¶
func (m *MDNSService) GetServiceAddr() string
GetServiceAddr returns the service address.