awl/conf/unix.go
Sam 80648e08f6
All checks were successful
continuous-integration/drone/push Build is passing
(refactor) Draw the rest of the owl (#38)
Reviewed-on: #38
2022-07-26 00:32:31 +00:00

24 lines
471 B
Go

// SPDX-License-Identifier: BSD-3-Clause
//go: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")
}
}