Browse Source

Improve logging output

master
Lyndsay Roger 9 years ago
parent
commit
0a8740b01d
  1. 3
      crawler.go
  2. 12
      server.go

3
crawler.go

@ -52,9 +52,10 @@ func crawlTwistee(tw *Twistee) { @@ -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

@ -143,21 +143,25 @@ func handleDNSStd(w dns.ResponseWriter, r *dns.Msg) { @@ -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) { @@ -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…
Cancel
Save