mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-15 05:31:18 +08:00
24 lines
429 B
Go
24 lines
429 B
Go
package dns
|
|
|
|
import (
|
|
"net"
|
|
)
|
|
|
|
func loadSystemResolver() (clients []dnsClient, err error) {
|
|
nameservers, err := dnsReadConfig()
|
|
if err != nil {
|
|
return
|
|
}
|
|
if len(nameservers) == 0 {
|
|
return
|
|
}
|
|
servers := make([]NameServer, 0, len(nameservers))
|
|
for _, addr := range nameservers {
|
|
servers = append(servers, NameServer{
|
|
Addr: net.JoinHostPort(addr, "53"),
|
|
Net: "udp",
|
|
})
|
|
}
|
|
return transform(servers, nil), nil
|
|
}
|