mdns

package
v0.0.0-...-67cf1be Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package mdns provides utilities related to Multicast DNS (mDNS), as defined in https://tools.ietf.org/html/rfc6762.

Index

Constants

View Source
const UnicastResponseBit = 1 << 15

UnicastResponseBit is a bit flag that is used to indicate that a DNS question prefers a unicast response.

In the Question Section of a Multicast DNS query, the top bit of the qclass field is used to indicate that unicast responses are preferred for this particular question. (See Section 5.4.)

See https://tools.ietf.org/html/rfc6762#section-18.12.

View Source
const UniqueRecordBit = 1 << 15

UniqueRecordBit is a bit flag that is used to indicate that a DNS RR is a "unique" record.

In the Resource Record Sections of a Multicast DNS response, the top bit of the rrclass field is used to indicate that the record is a member of a unique RRSet, and the entire RRSet has been sent together (in the same packet, or in consecutive packets if there are too many records to fit in a single packet). (See Section 10.2.)

See https://tools.ietf.org/html/rfc6762#section-18.13.

Variables

This section is empty.

Functions

func IsUniqueRecord

func IsUniqueRecord(r dns.RR) (bool, dns.RR)

IsUniqueRecord returns true if the given RR is a "unique" record.

It returns a copy of the RR with the "unique record bit" cleared, to reflect the actual record class.

See https://tools.ietf.org/html/rfc6762#section-18.13.

func NewQuery

func NewQuery(legacy bool, q ...dns.Question) *dns.Msg

NewQuery returns a new (empty) DNS query.

If legacy is true, it indicates this query will be sent from a "legacy" or "one-shot" querier, which expects a unicast response.

func NewResponse

func NewResponse(query *dns.Msg, unicast bool) *dns.Msg

NewResponse returns a new (empty) response to a mDNS query.

See https://tools.ietf.org/html/rfc6762#section-6 and https://tools.ietf.org/html/rfc6762#section-18.

func SetUnicastResponse

func SetUnicastResponse(q dns.Question) dns.Question

SetUnicastResponse adds the "unicast response bit" to the given question.

func SetUniqueRecord

func SetUniqueRecord(r dns.RR) dns.RR

SetUniqueRecord adds the "unique record bit" to the given RR.

func ValidateQuery

func ValidateQuery(m *dns.Msg) error

ValidateQuery returns an error if m is not a valid mDNS query.

func WantsUnicastResponse

func WantsUnicastResponse(q dns.Question) (bool, dns.Question)

WantsUnicastResponse returns true if the given question requested a unicast response.

It returns a copy of the question with the "unicast response bit" cleared, to reflect the actual question class.

See https://tools.ietf.org/html/rfc6762#section-18.12.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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