diff options
| author | Shulhan <ms@kilabit.info> | 2022-04-15 03:07:32 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-04-15 03:07:32 +0700 |
| commit | b3bb806d49498a1fd69cd4d2966a6d08c3506401 (patch) | |
| tree | d465a8cc9cc86017813faad3188d8e08933ad4a6 | |
| parent | a33c4f7e3c9bf4b9c394a0be426b4a6740382aee (diff) | |
| download | rescached-b3bb806d49498a1fd69cd4d2966a6d08c3506401.tar.xz | |
cmd/resolver: replace populateQueries with lib/net ResolvConf
Since share 9329196125fe, the populateQueries has been moved to package
lib/net as a method of ResolvConf.
| -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 ( |
