diff options
| -rw-r--r-- | cmd/resolver/resolver.go | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/cmd/resolver/resolver.go b/cmd/resolver/resolver.go index 80d837d..1c0d1d8 100644 --- a/cmd/resolver/resolver.go +++ b/cmd/resolver/resolver.go @@ -155,7 +155,7 @@ func (rsol *resolver) doCmdQuery(args []string) { fmt.Printf("= resolv.conf: %+v\n", rsol.conf) - queries = populateQueries(rsol.conf, rsol.qname) + queries = rsol.conf.PopulateQuery(rsol.qname) timeout = time.Duration(rsol.conf.Timeout) * time.Second maxAttempts = rsol.conf.Attempts } else { @@ -248,30 +248,6 @@ func (rsol *resolver) query(timeout time.Duration, qname string) (res *dns.Messa return res, nil } -func populateQueries(cr *libnet.ResolvConf, qname string) (queries []string) { - ndots := 0 - - for _, c := range qname { - if c == '.' { - ndots++ - continue - } - } - - if ndots >= cr.NDots { - queries = append(queries, qname) - } else { - if len(cr.Domain) > 0 { - queries = append(queries, qname+"."+cr.Domain) - } - for _, s := range cr.Search { - queries = append(queries, qname+"."+s) - } - } - - return -} - // printAnswers print list of DNS Answer to stdout. func printAnswers(answers []*dns.Answer) { var ( |
