awl/conf/notwin.go
Sam Therapy 2e2d5187d1
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Fix testing on windows, add better Plan 9 support
Signed-off-by: Sam Therapy <sam@samtherapy.net>
2022-06-30 22:32:37 +00:00

26 lines
490 B
Go

// SPDX-License-Identifier: BSD-3-Clause
//go:build !windows
// +build !windows
package conf
import (
"os"
"runtime"
"github.com/miekg/dns"
)
// Get the DNS configuration, either from /etc/resolv.conf or somewhere else
func GetDNSConfig() (*dns.ClientConfig, error) {
if runtime.GOOS == "plan9" {
dat, err := os.ReadFile("/net/ndb")
if err != nil {
return nil, err
}
return getPlan9Config(string(dat))
} else {
return dns.ClientConfigFromFile("/etc/resolv.conf")
}
}