Files
olm/dns/platform/detect_windows.go
Owen 50008f3c12 Basic platform?
Former-commit-id: 423e18edc3
2025-11-23 21:26:15 -05:00

35 lines
852 B
Go

//go:build windows
package dns
import "fmt"
// DetectBestConfigurator returns the Windows DNS configurator
// guid is the network interface GUID
func DetectBestConfigurator(guid string) (DNSConfigurator, error) {
if guid == "" {
return nil, fmt.Errorf("interface GUID is required for Windows")
}
return NewWindowsDNSConfigurator(guid)
}
// GetSystemDNS returns the current system DNS servers for the given interface
func GetSystemDNS(guid string) ([]string, error) {
configurator, err := NewWindowsDNSConfigurator(guid)
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
}