Skip to content

Commit

Permalink
Added NS record support
Browse files Browse the repository at this point in the history
  • Loading branch information
Ice3man543 committed May 6, 2021
1 parent 00d336e commit 8358de1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/server/dns_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ func (h *DNSServer) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {
} else if r.Question[0].Qtype == dns.TypeMX {
nsHdr := dns.RR_Header{Name: domain, Rrtype: dns.TypeMX, Class: dns.ClassINET, Ttl: h.timeToLive}
m.Answer = append(m.Answer, &dns.MX{Hdr: nsHdr, Mx: h.mxDomain, Preference: 1})
} else if r.Question[0].Qtype == dns.TypeNS {
nsHeader := dns.RR_Header{Name: domain, Rrtype: dns.TypeNS, Class: dns.ClassINET, Ttl: h.timeToLive}

m.Ns = append(m.Ns, &dns.NS{Hdr: nsHeader, Ns: h.ns1Domain})
m.Ns = append(m.Ns, &dns.NS{Hdr: nsHeader, Ns: h.ns2Domain})
}
if strings.HasSuffix(domain, h.dotDomain) {
parts := strings.Split(domain, ".")
Expand Down

0 comments on commit 8358de1

Please sign in to comment.