Categorygithub.com/andrewheberle/mdns
modulepackage
0.3.0
Repository: https://github.com/andrewheberle/mdns.git
Documentation: pkg.go.dev

# README

mdns

This package is used to set the Query and RR class for DNS requests/responses to conform to mDNS.

Usage

This package is designed to be used with github.com/miekg/dns:

package main

import "github.com/miekg/dns"

func handle(w dns.ResponseWriter, r *dns.Msg) {
    m := new(dns.Msg)
	m.SetReply(r)

    if r.Question[0].Qtype == dns.TypePTR {
        m.Answer = append(m.Answer, &dns.PTR{
            Hdr: dns.RR_Header{Name: "_googlecast._tcp.local.", Rrtype: dns.TypePTR, Class: mdns.PackClass(dns.ClassINET, true), Ttl: 120},
            Ptr: "Chromecast-deadbeef-5c74-0091-b8b0-bc27e95d8e84._googlecast._tcp.local.",
        })
    }
    
    w.WriteMsg(m)
}

# Functions

From RFC6762 6.1.
From RFC6762 18.12.
PackClass packs a query or RR class setting either the unicast-response or cache-flush bit respectively.
UnpackClass unpacks a query or RR class returning the original class and if the unicast-response or cache-flush bit was set respectively.

# Constants

No description provided by the author

# Variables

Multicast groups used by mDNS.
mDNS endpoint addresses.
No description provided by the author
No description provided by the author
mDNS wildcard addresses.
No description provided by the author