mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-10 00:51:07 +00:00
net/dns: [win] add MagicDNS entries to etc/hosts
This works around the 2.3s delay in short name lookups when SNR is enabled. C:\Windows\System32\drivers\etc\hosts file. We only add known hosts that match the search domains, and we populate the list in order of Search Domains so that our matching algorithm mimics what Windows would otherwise do itself if SNR was off. Updates #1659 Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
@@ -37,8 +37,18 @@ type OSConfigurator interface {
|
||||
Close() error
|
||||
}
|
||||
|
||||
// HostEntry represents a single line in the OS's hosts file.
|
||||
type HostEntry struct {
|
||||
Addr netip.Addr
|
||||
Hosts []string
|
||||
}
|
||||
|
||||
// OSConfig is an OS DNS configuration.
|
||||
type OSConfig struct {
|
||||
// Hosts is a map of DNS FQDNs to their IPs, which should be added to the
|
||||
// OS's hosts file. Currently, (2022-08-12) it is only populated for Windows
|
||||
// in SplitDNS mode and with Smart Name Resolution turned on.
|
||||
Hosts []*HostEntry
|
||||
// Nameservers are the IP addresses of the nameservers to use.
|
||||
Nameservers []netip.Addr
|
||||
// SearchDomains are the domain suffixes to use when expanding
|
||||
|
Reference in New Issue
Block a user