|
|
@ -143,21 +143,25 @@ func handleDNSStd(w dns.ResponseWriter, r *dns.Msg) { |
|
|
|
}} |
|
|
|
}} |
|
|
|
m.SetReply(r) |
|
|
|
m.SetReply(r) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var qtype string |
|
|
|
|
|
|
|
|
|
|
|
switch r.Question[0].Qtype { |
|
|
|
switch r.Question[0].Qtype { |
|
|
|
case dns.TypeA: |
|
|
|
case dns.TypeA: |
|
|
|
latest.mtx.RLock() |
|
|
|
latest.mtx.RLock() |
|
|
|
m.Answer = getv4stdRR() |
|
|
|
m.Answer = getv4stdRR() |
|
|
|
latest.mtx.RUnlock() |
|
|
|
latest.mtx.RUnlock() |
|
|
|
|
|
|
|
qtype = "A" |
|
|
|
case dns.TypeAAAA: |
|
|
|
case dns.TypeAAAA: |
|
|
|
latest.mtx.RLock() |
|
|
|
latest.mtx.RLock() |
|
|
|
m.Answer = getv6stdRR() |
|
|
|
m.Answer = getv6stdRR() |
|
|
|
latest.mtx.RUnlock() |
|
|
|
latest.mtx.RUnlock() |
|
|
|
|
|
|
|
qtype = "AAAA" |
|
|
|
default: |
|
|
|
default: |
|
|
|
// return no answer to all other queries
|
|
|
|
// return no answer to all other queries
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if config.verbose { |
|
|
|
if config.verbose { |
|
|
|
log.Printf("debug - standard port DNS response to ip: %s\n", w.RemoteAddr().String()) |
|
|
|
log.Printf("debug - standard port DNS response to ip: %s Query Type: %s\n", w.RemoteAddr().String(), qtype) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// FIXME - add stats and query counts
|
|
|
|
// FIXME - add stats and query counts
|
|
|
@ -175,21 +179,25 @@ func handleDNSNon(w dns.ResponseWriter, r *dns.Msg) { |
|
|
|
}} |
|
|
|
}} |
|
|
|
m.SetReply(r) |
|
|
|
m.SetReply(r) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var qtype string |
|
|
|
|
|
|
|
|
|
|
|
switch r.Question[0].Qtype { |
|
|
|
switch r.Question[0].Qtype { |
|
|
|
case dns.TypeA: |
|
|
|
case dns.TypeA: |
|
|
|
latest.mtx.RLock() |
|
|
|
latest.mtx.RLock() |
|
|
|
m.Answer = getv4nonRR() |
|
|
|
m.Answer = getv4nonRR() |
|
|
|
latest.mtx.RUnlock() |
|
|
|
latest.mtx.RUnlock() |
|
|
|
|
|
|
|
qtype = "A" |
|
|
|
case dns.TypeAAAA: |
|
|
|
case dns.TypeAAAA: |
|
|
|
latest.mtx.RLock() |
|
|
|
latest.mtx.RLock() |
|
|
|
m.Answer = getv6nonRR() |
|
|
|
m.Answer = getv6nonRR() |
|
|
|
latest.mtx.RUnlock() |
|
|
|
latest.mtx.RUnlock() |
|
|
|
|
|
|
|
qtype = "AAAA" |
|
|
|
default: |
|
|
|
default: |
|
|
|
// return no answer to all other queries
|
|
|
|
// return no answer to all other queries
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if config.verbose { |
|
|
|
if config.verbose { |
|
|
|
log.Printf("debug - non standard port DNS response to ip: %s\n", w.RemoteAddr().String()) |
|
|
|
log.Printf("debug - non standard port DNS response to ip: %s Query Type: %s\n", w.RemoteAddr().String(), qtype) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// FIXME - add stats and query counts
|
|
|
|
// FIXME - add stats and query counts
|
|
|
|