mirror of
https://github.com/miekg/dns.git
synced 2025-10-12 10:21:00 +02:00
Fix client programs
This commit is contained in:
parent
866e63aafa
commit
be5e51a6ab
@ -93,25 +93,28 @@ Flags:
|
|||||||
in := make(chan dns.Query)
|
in := make(chan dns.Query)
|
||||||
var out chan dns.Query
|
var out chan dns.Query
|
||||||
if *tcp {
|
if *tcp {
|
||||||
out = dns.QueryAndServerTCP(in, nil)
|
out = dns.QueryAndServeTCP(in, nil)
|
||||||
} else {
|
} else {
|
||||||
out = dns.QueryAndServerUDP(in, nil)
|
out = dns.QueryAndServeUDP(in, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range qname {
|
for _, v := range qname {
|
||||||
m.Question[0] = dns.Question{v, qtype, qclass}
|
m.Question[0] = dns.Question{v, qtype, qclass}
|
||||||
m.Id = dns.Id()
|
m.Id = dns.Id()
|
||||||
in, err := r.Query(m)
|
in <- dns.Query{Msg: m, Conn: d}
|
||||||
if in != nil {
|
|
||||||
if m.Id != in.Id {
|
r := <-out
|
||||||
|
|
||||||
|
if r.Msg != nil {
|
||||||
|
if r.Msg.Id != m.Id {
|
||||||
fmt.Printf("Id mismatch\n")
|
fmt.Printf("Id mismatch\n")
|
||||||
}
|
}
|
||||||
if *short {
|
if *short {
|
||||||
in = shortMsg(in)
|
r.Msg = shortMsg(r.Msg)
|
||||||
}
|
}
|
||||||
fmt.Printf("%v\n", in)
|
fmt.Printf("%v", r.Msg)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("%v\n", err.String())
|
fmt.Printf("%v\n", r.Err.String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,17 +144,3 @@ func shortRR(r dns.RR) dns.RR {
|
|||||||
}
|
}
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
41 func (m *Meta) String() string {
|
|
||||||
42 s := ";; Query time: " + strconv.Itoa(int(m.QueryEnd-m.QueryStart)) + " nsec"
|
|
||||||
43 s += "\n;; MSG SIZE rcvd: " + strconv.Itoa(m.RLen) + ", sent: " + strconv.Itoa(m.QLen)
|
|
||||||
44 rf := float32(m.RLen)
|
|
||||||
45 qf := float32(m.QLen)
|
|
||||||
46 if qf != 0 {
|
|
||||||
47 s += " (" + strconv.Ftoa32(rf/qf, 'f', 2) + ":1)"
|
|
||||||
48 }
|
|
||||||
49 // WHEN??
|
|
||||||
50 return s
|
|
||||||
51 }
|
|
||||||
*/
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user