enabledStr:="disabled.\n\n(Run 'tailscale set --accept-dns=true' to start sending DNS queries to the Tailscale DNS resolver)"
ifprefs.CorpDNS{
enabledStr="enabled.\n\nTailscale is configured to handle DNS queries on this device.\nRun 'tailscale set --accept-dns=false' to revert to your system default DNS resolver."
}
fmt.Print("\n")
fmt.Println("=== 'Use Tailscale DNS' status ===")
fmt.Print("\n")
fmt.Printf("Tailscale DNS: %s\n",enabledStr)
fmt.Print("\n")
fmt.Println("=== MagicDNS configuration ===")
fmt.Print("\n")
fmt.Println("This is the DNS configuration provided by the coordination server to this device.")
fmt.Println("Filtered suffixes when forwarding DNS queries as an exit node:")
iflen(dnsConfig.ExitNodeFilteredSet)==0{
fmt.Println(" (no suffixes are filtered)")
}
for_,s:=rangednsConfig.ExitNodeFilteredSet{
fmt.Printf(" - %s\n",s)
}
fmt.Print("\n")
}
fmt.Println("=== System DNS configuration ===")
fmt.Print("\n")
fmt.Println("This is the DNS configuration that Tailscale believes your operating system is using.\nTailscale may use this configuration if 'Override Local DNS' is disabled in the admin console,\nor if no resolvers are provided by the coordination server.")
fmt.Print("\n")
osCfg,err:=localClient.GetDNSOSConfig(ctx)
iferr!=nil{
ifstrings.Contains(err.Error(),"not supported"){
// avoids showing the HTTP error code which would be odd here
fmt.Println(" (reading the system DNS configuration is not supported on this platform)")
}else{
fmt.Printf(" (failed to read system DNS configuration: %v)\n",err)
}
}elseifosCfg==nil{
fmt.Println(" (no OS DNS configuration available)")
}else{
fmt.Println("Nameservers:")
iflen(osCfg.Nameservers)==0{
fmt.Println(" (no nameservers found, DNS queries might fail\nunless the coordination server is providing a nameserver)")
}
for_,ns:=rangeosCfg.Nameservers{
fmt.Printf(" - %v\n",ns)
}
fmt.Print("\n")
fmt.Println("Search domains:")
iflen(osCfg.SearchDomains)==0{
fmt.Println(" (no search domains found)")
}
for_,sd:=rangeosCfg.SearchDomains{
fmt.Printf(" - %v\n",sd)
}
ifall{
fmt.Print("\n")
fmt.Println("Match domains:")
iflen(osCfg.MatchDomains)==0{
fmt.Println(" (no match domains found)")
}
for_,md:=rangeosCfg.MatchDomains{
fmt.Printf(" - %v\n",md)
}
}
}
fmt.Print("\n")
fmt.Println("[this is a preliminary version of this command; the output format may change in the future]")