mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-08-10 13:20:33 +02:00
Change test query to use controld.com
Since some Active Directory could blocks clients to query for "."
This commit is contained in:
+4
-1
@@ -70,11 +70,14 @@ func InitializeOsResolver() []string {
|
|||||||
// testPlainDnsNameserver sends a test query to DNS nameserver to check if the server is available.
|
// testPlainDnsNameserver sends a test query to DNS nameserver to check if the server is available.
|
||||||
func testNameserver(addr string) bool {
|
func testNameserver(addr string) bool {
|
||||||
msg := new(dns.Msg)
|
msg := new(dns.Msg)
|
||||||
msg.SetQuestion(".", dns.TypeNS)
|
msg.SetQuestion("controld.com.", dns.TypeNS)
|
||||||
client := new(dns.Client)
|
client := new(dns.Client)
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
_, _, err := client.ExchangeContext(ctx, msg, addr)
|
_, _, err := client.ExchangeContext(ctx, msg, addr)
|
||||||
|
if err != nil {
|
||||||
|
ProxyLogger.Load().Debug().Err(err).Msgf("failed to connect to OS nameserver: %s", addr)
|
||||||
|
}
|
||||||
return err == nil
|
return err == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user