Documentation
¶
Index ¶
- Variables
- func EnumerateServiceInstances(c Client, domain, service string) ([]string, error)
- func EnumerateServices(c Client, domain string) ([]string, error)
- func GetAllServiceBrowserDomains(c Client, domain string) ([]string, error)
- func GetDefaultServiceBrowserDomain(c Client, domain string) (string, error)
- func GetIP4s(c Client, name string) ([]netip.Addr, error)
- func GetIP6s(c Client, name string) ([]netip.Addr, error)
- func GetIPs(c Client, name string) ([]netip.Addr, error)
- func GetLegacyServiceBrowserDomain(c Client, domain string) (string, error)
- func GetServiceBrowserDomains(c Client, domain string) ([]string, error)
- func GetServiceInstanceInfo(c Client, domain string) error
- func NewMsg(config *Config, name string, qtype uint16) *dns.Msg
- func Query(c Client, name string, qtype uint16) (*dns.Msg, error)
- type Client
- type Config
- type DNSErr
- type DNSError
- type Do53Client
- type Do53Config
- type DoHClient
- type DoHConfig
- type DoTClient
- type DoTConfig
- type NameServer
Constants ¶
This section is empty.
Variables ¶
var DNSErrToString = map[DNSErr]string{ DNSErrRcodeNotSuccess: "RCODE was not SUCCESS", DNSErrMissingAnswer: "DNS response does not answer the query", DNSErrInvalidAnswer: "DNS response has an answer that matches neither the qname nor one of its aliases", DNSErrInvalidCNAMEChain: "DNS response contains an invalid CNAME chain", DNSErrMaxCNAMEs: "query followed max number of CNAMEs", }
Functions ¶
func GetServiceInstanceInfo ¶
func Query ¶
Return an error if:
- there was some sort of network error
- DNS returned a valid response but Rcode is not SUCCESS
- DNS returned Rcode SUCCESS, but the response doesn't have the record we requested
- The config is set to follow CNAMES, but we encountered some sort of malformed CNAME (namely, an invalid CNAME chain in an answer; this should be rare)
- The config is set to follow CNAMES, and we reached MaxCNAMEs without getting an answer
In other words, if we ergonomics are such that if the caller invokes:
resp, err != dnsquery.Query(c, name, type)
Then err == nil iff resp actually returns a positive response for the query. If err != nil, then err will store the response message (if there was one) as well as indicate the reason for the failure (basically, one of the above categories above. The whole point is to make it so the caller doesn't have to inspect the msg to see if the query succeeded; if the caller wants the nitty-gritty details of why the query didn't get an answer, it can inspect the error value.
Types ¶
type Config ¶
type Config struct { IdFunc func() uint16 RecursionDesired bool Timeout time.Duration MaxCNAMEs int DNSSEC bool }
This is configuration that applies to all typs of clients -- it deals purely with the handling of the DNS requests and responses
type Do53Client ¶
type Do53Client struct {
// contains filtered or unexported fields
}
func NewDo53Client ¶
func NewDo53Client(config *Do53Config) *Do53Client
func (*Do53Client) Close ¶
func (c *Do53Client) Close() error
func (*Do53Client) Dial ¶
func (c *Do53Client) Dial() error
func (*Do53Client) GetConfig ¶
func (c *Do53Client) GetConfig() *Config
type DoHClient ¶
type DoHClient struct {
// contains filtered or unexported fields
}
func NewDoHClient ¶
type DoTClient ¶
type DoTClient struct {
// contains filtered or unexported fields
}
func NewDoTClient ¶
type NameServer ¶
func GetNameServers ¶
func GetNameServers(c Client, name string) ([]*NameServer, error)