Clash.Meta/dns/system.go

24 lines
429 B
Go
Raw Normal View History

2023-04-26 15:57:55 +08:00
package dns
import (
2023-06-01 12:36:53 +08:00
"net"
2023-04-26 15:57:55 +08:00
)
func loadSystemResolver() (clients []dnsClient, err error) {
2023-06-01 12:36:53 +08:00
nameservers, err := dnsReadConfig()
2023-04-26 15:57:55 +08:00
if err != nil {
return
}
if len(nameservers) == 0 {
return
}
servers := make([]NameServer, 0, len(nameservers))
for _, addr := range nameservers {
servers = append(servers, NameServer{
2023-06-01 12:36:53 +08:00
Addr: net.JoinHostPort(addr, "53"),
2023-04-26 15:57:55 +08:00
Net: "udp",
})
}
return transform(servers, nil), nil
}