awl/conf/notwin.go
Sam 220964fc02
All checks were successful
continuous-integration/drone/push Build is passing
Windows and Plan 9 DNS Config (#17)
Closes #14, #15

Co-authored-by: Sam Therapy <sam@samtherapy.net>
Reviewed-on: #17
2022-06-30 22:37:08 +00:00

25 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")
}
}