From 8358de174af3b82d8db8e74bf4e3e51a714a2a30 Mon Sep 17 00:00:00 2001 From: Ice3man543 Date: Thu, 6 May 2021 20:29:43 +0530 Subject: [PATCH] Added NS record support --- pkg/server/dns_server.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/server/dns_server.go b/pkg/server/dns_server.go index 7ff07ce8..e0742d15 100644 --- a/pkg/server/dns_server.go +++ b/pkg/server/dns_server.go @@ -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, ".")