Pull request: aghnet: imp windows nslookup

Updates #3375.

Squashed commit of the following:

commit a98f376a3c8253b873cadb992b42174fb3c1c584
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Aug 31 15:06:03 2021 +0300

    aghnet: imp windows nslookup
This commit is contained in:
Ainar Garipov 2021-08-31 15:14:08 +03:00
parent bb4cd312c2
commit 2365ddd2f2

View File

@ -99,7 +99,13 @@ func scanAddrs(s *bufio.Scanner) (addrs []string) {
// local resolvers addresses on Windows. We execute the external command for
// now that is not the most accurate way.
func (sr *systemResolvers) getAddrs() (addrs []string, err error) {
cmd := exec.Command("nslookup")
var cmdPath string
cmdPath, err = exec.LookPath("nslookup.exe")
if err != nil {
return nil, fmt.Errorf("looking up cmd path: %w", err)
}
cmd := exec.Command(cmdPath)
var stdin io.WriteCloser
stdin, err = cmd.StdinPipe()