ipn/ipnlocal, net/dnscache: allow configuring dnscache logging via capability

This allows users to temporarily enable/disable dnscache logging via a
new node capability, to aid in debugging strange connectivity issues.

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: I46cf2596a8ae4c1913880a78d0033f8b668edc08
This commit is contained in:
Andrew Dunham
2023-01-24 14:31:20 -05:00
parent d8feeeee4c
commit 44d73ce932
4 changed files with 89 additions and 39 deletions

View File

@@ -22,7 +22,7 @@ func TestDialer(t *testing.T) {
if *dialTest == "" {
t.Skip("skipping; --dial-test is blank")
}
r := new(Resolver)
r := &Resolver{Logf: t.Logf}
var std net.Dialer
dialer := Dialer(std.DialContext, r)
t0 := time.Now()
@@ -113,6 +113,7 @@ func TestDialCall_uniqueIPs(t *testing.T) {
func TestResolverAllHostStaticResult(t *testing.T) {
r := &Resolver{
Logf: t.Logf,
SingleHost: "foo.bar",
SingleHostStaticResult: []netip.Addr{
netip.MustParseAddr("2001:4860:4860::8888"),
@@ -185,11 +186,12 @@ func TestShouldTryBootstrap(t *testing.T) {
errFailed := errors.New("some failure")
cacheWithFallback := &Resolver{
Logf: t.Logf,
LookupIPFallback: func(_ context.Context, _ string) ([]netip.Addr, error) {
panic("unimplemented")
},
}
cacheNoFallback := &Resolver{}
cacheNoFallback := &Resolver{Logf: t.Logf}
testCases := []struct {
name string