net/dnscache: add overly simplistic DNS cache package for selective use
I started to write a full DNS caching resolver and I realized it was overkill and wouldn't work on Windows even in Go 1.14 yet, so I'm doing this tiny one instead for now, just for all our netcheck STUN derp lookups, and connections to DERP servers. (This will be caching a exactly 8 DNS entries, all ours.) Fixes #145 (can be better later, of course)
This commit is contained in:
@ -17,6 +17,7 @@ import (
|
||||
|
||||
"golang.org/x/sync/errgroup"
|
||||
"tailscale.com/interfaces"
|
||||
"tailscale.com/net/dnscache"
|
||||
"tailscale.com/stun"
|
||||
"tailscale.com/stunner"
|
||||
"tailscale.com/types/logger"
|
||||
@ -181,6 +182,7 @@ func GetReport(ctx context.Context, logf logger.Logf) (*Report, error) {
|
||||
Endpoint: add,
|
||||
Servers: stunServers,
|
||||
Logf: logf,
|
||||
DNSCache: dnscache.Get(),
|
||||
}
|
||||
grp.Go(func() error { return s4.Run(ctx) })
|
||||
go reader(s4, pc4, unlimited)
|
||||
@ -190,6 +192,7 @@ func GetReport(ctx context.Context, logf logger.Logf) (*Report, error) {
|
||||
Endpoint: addHair,
|
||||
Servers: stunServers,
|
||||
Logf: logf,
|
||||
DNSCache: dnscache.Get(),
|
||||
}
|
||||
grp.Go(func() error { return s4Hair.Run(ctx) })
|
||||
go reader(s4Hair, pc4Hair, 2)
|
||||
@ -201,6 +204,7 @@ func GetReport(ctx context.Context, logf logger.Logf) (*Report, error) {
|
||||
Servers: stunServers6,
|
||||
Logf: logf,
|
||||
OnlyIPv6: true,
|
||||
DNSCache: dnscache.Get(),
|
||||
}
|
||||
grp.Go(func() error { return s6.Run(ctx) })
|
||||
go reader(s6, pc6, unlimited)
|
||||
|
Reference in New Issue
Block a user