Skip to content

Commit

Permalink
chore: add AAAA and NS support
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmoysrt committed Nov 21, 2023
1 parent e06560c commit 58afd5b
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@ import (

func parseQuery(m *dns.Msg, qdns *QuickDNSResolver) {
for _, q := range m.Question {
println(q.Name, q.Qtype)
switch q.Qtype {
case dns.TypeAAAA:
{
isQDNS, ip := qdns.ResolveARecord(q.Name)
if isQDNS {
rr, err := dns.NewRR(fmt.Sprintf("%s AAAA %s", q.Name, ip))
if err == nil {
m.Answer = append(m.Answer, rr)
}
}
}
case dns.TypeNone:
fallthrough
case dns.TypeANY:
fallthrough
case dns.TypeNS:
fallthrough
case dns.TypeA:
{
isQDNS, ip := qdns.ResolveARecord(q.Name)
Expand All @@ -30,9 +27,6 @@ func parseQuery(m *dns.Msg, qdns *QuickDNSResolver) {
m.Answer = append(m.Answer, rr)
}
}
}
case dns.TypeNS:
{
// ns1.swiftwave.xyz and ns2.swiftwave.xyz
rr, err := dns.NewRR(fmt.Sprintf("%s NS ns1.swiftwave.xyz", q.Name))
if err == nil {
Expand Down

0 comments on commit 58afd5b

Please sign in to comment.