mirror of
https://github.com/twisterarmy/dnsseeder.git
synced 2025-09-11 21:52:41 +00:00
Improve logging output
This commit is contained in:
parent
ff9766d700
commit
0a8740b01d
@ -52,9 +52,10 @@ func crawlTwistee(tw *Twistee) {
|
||||
// no more to do so return which will shutdown the goroutine & call
|
||||
// the deffered cleanup
|
||||
if config.verbose {
|
||||
log.Printf("debug - failed crawl: twistee %s newstatus: %v:%v\n",
|
||||
log.Printf("debug - failed crawl: twistee %s failcount: %v newstatus: %v:%v\n",
|
||||
net.JoinHostPort(tw.na.IP.String(),
|
||||
strconv.Itoa(int(tw.na.Port))),
|
||||
tw.connectFails,
|
||||
tw.status,
|
||||
tw.rating)
|
||||
}
|
||||
|
12
server.go
12
server.go
@ -143,21 +143,25 @@ func handleDNSStd(w dns.ResponseWriter, r *dns.Msg) {
|
||||
}}
|
||||
m.SetReply(r)
|
||||
|
||||
var qtype string
|
||||
|
||||
switch r.Question[0].Qtype {
|
||||
case dns.TypeA:
|
||||
latest.mtx.RLock()
|
||||
m.Answer = getv4stdRR()
|
||||
latest.mtx.RUnlock()
|
||||
qtype = "A"
|
||||
case dns.TypeAAAA:
|
||||
latest.mtx.RLock()
|
||||
m.Answer = getv6stdRR()
|
||||
latest.mtx.RUnlock()
|
||||
qtype = "AAAA"
|
||||
default:
|
||||
// return no answer to all other queries
|
||||
|
||||
}
|
||||
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
|
||||
@ -175,21 +179,25 @@ func handleDNSNon(w dns.ResponseWriter, r *dns.Msg) {
|
||||
}}
|
||||
m.SetReply(r)
|
||||
|
||||
var qtype string
|
||||
|
||||
switch r.Question[0].Qtype {
|
||||
case dns.TypeA:
|
||||
latest.mtx.RLock()
|
||||
m.Answer = getv4nonRR()
|
||||
latest.mtx.RUnlock()
|
||||
qtype = "A"
|
||||
case dns.TypeAAAA:
|
||||
latest.mtx.RLock()
|
||||
m.Answer = getv6nonRR()
|
||||
latest.mtx.RUnlock()
|
||||
qtype = "AAAA"
|
||||
default:
|
||||
// return no answer to all other queries
|
||||
|
||||
}
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user