zone

package
v0.0.0-...-b87209e Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package zone provides mDNS zone utilities.

Index

Constants

View Source
const (
	// DefaultTTL is the default TTL value in returned DNS records in seconds.
	DefaultTTL = 120
)

Variables

View Source
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.

func (*MDNSService) Records

func (m *MDNSService) Records(q dns.Question) []dns.RR

Records returns DNS records in response to a DNS question.

type Zone

type Zone interface {
	// Records returns DNS records in response to a DNS question.
	Records(q dns.Question) []dns.RR
}

Zone is the interface used to integrate with the server and to serve records dynamically.

Jump to

Keyboard shortcuts

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