Remove needless blank line

This commit is contained in:
kenshinx 2015-02-11 17:11:32 +08:00
parent ed0dd3006c
commit f32122d875

View File

@ -7,18 +7,18 @@ import (
"github.com/miekg/dns" "github.com/miekg/dns"
) )
type Question struct {
qname string
qtype string
qclass string
}
const ( const (
notIPQuery = 0 notIPQuery = 0
_IP4Query = 4 _IP4Query = 4
_IP6Query = 6 _IP6Query = 6
) )
type Question struct {
qname string
qtype string
qclass string
}
func (q *Question) String() string { func (q *Question) String() string {
return q.qname + " " + q.qclass + " " + q.qtype return q.qname + " " + q.qclass + " " + q.qtype
} }
@ -117,10 +117,9 @@ func (h *GODNSHandler) do(Net string, w dns.ResponseWriter, req *dns.Msg) {
} else { } else {
Debug("%s didn't found in hosts file", Q.qname) Debug("%s didn't found in hosts file", Q.qname)
} }
} }
// Only query cache when qtype == 'A' , qclass == 'IN' // Only query cache when qtype == 'A'|'AAAA' , qclass == 'IN'
key := KeyGen(Q) key := KeyGen(Q)
if IPQuery > 0 { if IPQuery > 0 {
mesg, err := h.cache.Get(key) mesg, err := h.cache.Get(key)
@ -134,7 +133,6 @@ func (h *GODNSHandler) do(Net string, w dns.ResponseWriter, req *dns.Msg) {
h.mu.Unlock() h.mu.Unlock()
return return
} }
} }
mesg, err := h.resolver.Lookup(Net, req) mesg, err := h.resolver.Lookup(Net, req)
@ -149,14 +147,11 @@ func (h *GODNSHandler) do(Net string, w dns.ResponseWriter, req *dns.Msg) {
if IPQuery > 0 && len(mesg.Answer) > 0 { if IPQuery > 0 && len(mesg.Answer) > 0 {
err = h.cache.Set(key, mesg) err = h.cache.Set(key, mesg)
if err != nil { if err != nil {
Debug("Set %s cache failed: %s", Q.String(), err.Error()) Debug("Set %s cache failed: %s", Q.String(), err.Error())
} }
Debug("Insert %s into cache", Q.String()) Debug("Insert %s into cache", Q.String())
} }
} }
func (h *GODNSHandler) DoTCP(w dns.ResponseWriter, req *dns.Msg) { func (h *GODNSHandler) DoTCP(w dns.ResponseWriter, req *dns.Msg) {