awl/conf/unix.go
Sam Therapy 7314122951
All checks were successful
continuous-integration/drone/push Build is passing
more modular
Signed-off-by: Sam Therapy <sam@samtherapy.net>
2022-08-31 02:48:57 +02:00

22 lines
524 B
Go

// SPDX-License-Identifier: BSD-3-Clause
//go:build unix || (!windows && !plan9 && !js && !zos)
// FIXME: Can remove the or on the preprocessor when Go 1.18 becomes obsolete
package conf
import (
"fmt"
"github.com/miekg/dns"
)
// GetDNSConfig gets the DNS configuration, either from /etc/resolv.conf or somewhere else.
func GetDNSConfig() (*dns.ClientConfig, error) {
conf, err := dns.ClientConfigFromFile("/etc/resolv.conf")
if err != nil {
return nil, fmt.Errorf("unix config: %w", err)
}
return conf, nil
}