MCPcopy
hub / github.com/AdguardTeam/dnsproxy / checkDNSCryptProxy

Function checkDNSCryptProxy

proxy/serverdnscrypt_internal_test.go:72–92  ·  view source on GitHub ↗

checkDNSCryptProxy is a helper function that checks the DNSCrypt proxy by sending a test message and verifying the response.

(tb testing.TB, proto dnscrypt.Proto, stamp dnsstamps.ServerStamp)

Source from the content-addressed store, hash-verified

70// checkDNSCryptProxy is a helper function that checks the DNSCrypt proxy by
71// sending a test message and verifying the response.
72func checkDNSCryptProxy(tb testing.TB, proto dnscrypt.Proto, stamp dnsstamps.ServerStamp) {
73 tb.Helper()
74
75 // Create a DNSCrypt client.
76 c := dnscrypt.NewClient(&dnscrypt.ClientConfig{
77 Logger: slogutil.NewDiscardLogger(),
78 Proto: proto,
79 })
80
81 ctx := testutil.ContextWithTimeout(tb, testTimeout)
82
83 // Fetch the server certificate.
84 ri, err := c.DialStampContext(ctx, stamp)
85 require.NoError(tb, err)
86
87 // Send the test message.
88 msg := newTestMessage()
89 reply, err := c.ExchangeContext(ctx, msg, ri)
90 require.NoError(tb, err)
91 requireResponse(tb, msg, reply)
92}

Callers 1

TestDNSCryptProxyFunction · 0.85

Calls 2

newTestMessageFunction · 0.85
requireResponseFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…