mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +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
|
|
}
|