From bab25d5053feac1763f90dd8dbcc4ba108c387c7 Mon Sep 17 00:00:00 2001 From: Viktor Liu Date: Mon, 29 Jan 2024 16:30:18 +0100 Subject: [PATCH] Rename method --- client/internal/dns/upstream.go | 2 +- client/internal/dns/upstream_ios.go | 2 +- client/internal/dns/upstream_nonios.go | 2 +- client/internal/dns/upstream_test.go | 7 +------ 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/client/internal/dns/upstream.go b/client/internal/dns/upstream.go index 65f16b6c137..85d9e58e2a5 100644 --- a/client/internal/dns/upstream.go +++ b/client/internal/dns/upstream.go @@ -25,7 +25,7 @@ const ( const testRecord = "." type upstreamClient interface { - exchangeContext(ctx context.Context, upstream string, r *dns.Msg) (*dns.Msg, time.Duration, error) + exchange(ctx context.Context, upstream string, r *dns.Msg) (*dns.Msg, time.Duration, error) } type UpstreamResolver interface { diff --git a/client/internal/dns/upstream_ios.go b/client/internal/dns/upstream_ios.go index a101cf663b0..bce940ec649 100644 --- a/client/internal/dns/upstream_ios.go +++ b/client/internal/dns/upstream_ios.go @@ -40,7 +40,7 @@ func newUpstreamResolver(parentCTX context.Context, interfaceName string, ip net return ios, nil } -func (u *upstreamResolverIOS) exchangeContext(ctx context.Context, upstream string, r *dns.Msg) (rm *dns.Msg, t time.Duration, err error) { +func (u *upstreamResolverIOS) exchange(ctx context.Context, upstream string, r *dns.Msg) (rm *dns.Msg, t time.Duration, err error) { client := &dns.Client{} upstreamHost, _, err := net.SplitHostPort(upstream) if err != nil { diff --git a/client/internal/dns/upstream_nonios.go b/client/internal/dns/upstream_nonios.go index e64d27033e9..93e523c4ef3 100644 --- a/client/internal/dns/upstream_nonios.go +++ b/client/internal/dns/upstream_nonios.go @@ -23,7 +23,7 @@ func newUpstreamResolver(parentCTX context.Context, interfaceName string, ip net return nonIOS, nil } -func (u *upstreamResolverNonIOS) exchangeContext(ctx context.Context, upstream string, r *dns.Msg) (rm *dns.Msg, t time.Duration, err error) { +func (u *upstreamResolverNonIOS) exchange(ctx context.Context, upstream string, r *dns.Msg) (rm *dns.Msg, t time.Duration, err error) { upstreamExchangeClient := &dns.Client{} return upstreamExchangeClient.ExchangeContext(ctx, r, upstream) } diff --git a/client/internal/dns/upstream_test.go b/client/internal/dns/upstream_test.go index 7f200e7f784..b94126c7fd9 100644 --- a/client/internal/dns/upstream_test.go +++ b/client/internal/dns/upstream_test.go @@ -105,13 +105,8 @@ type mockUpstreamResolver struct { err error } -// Exchange mock implementation of Exchangefrom upstreamResolver -func (c mockUpstreamResolver) exchange(upstream string, r *dns.Msg) (*dns.Msg, time.Duration, error) { - return c.exchangeContext(context.Background(), upstream, r) -} - // ExchangeContext mock implementation of ExchangeContext from upstreamResolver -func (c mockUpstreamResolver) exchangeContext(_ context.Context, _ string, _ *dns.Msg) (*dns.Msg, time.Duration, error) { +func (c mockUpstreamResolver) exchange(_ context.Context, _ string, _ *dns.Msg) (*dns.Msg, time.Duration, error) { return c.r, c.rtt, c.err }