Skip to content

Commit

Permalink
Rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
lixmal committed Jan 29, 2024
1 parent 5a37bf3 commit bab25d5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion client/internal/dns/upstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion client/internal/dns/upstream_ios.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion client/internal/dns/upstream_nonios.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
7 changes: 1 addition & 6 deletions client/internal/dns/upstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit bab25d5

Please sign in to comment.