mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-12-22 23:57:26 +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
|
|
}
|