mirror of
https://github.com/fosrl/olm.git
synced 2026-02-08 05:56:41 +00:00
31 lines
692 B
Go
31 lines
692 B
Go
//go:build darwin && !ios
|
|
|
|
package dns
|
|
|
|
import "fmt"
|
|
|
|
// DetectBestConfigurator returns the macOS DNS configurator
|
|
func DetectBestConfigurator(ifaceName string) (DNSConfigurator, error) {
|
|
return NewDarwinDNSConfigurator()
|
|
}
|
|
|
|
// GetSystemDNS returns the current system DNS servers
|
|
func GetSystemDNS() ([]string, error) {
|
|
configurator, err := NewDarwinDNSConfigurator()
|
|
if err != nil {
|
|
return nil, fmt.Errorf("create configurator: %w", err)
|
|
}
|
|
|
|
servers, err := configurator.GetCurrentDNS()
|
|
if err != nil {
|
|
return nil, fmt.Errorf("get current DNS: %w", err)
|
|
}
|
|
|
|
var result []string
|
|
for _, server := range servers {
|
|
result = append(result, server.String())
|
|
}
|
|
|
|
return result, nil
|
|
}
|