Skip to content

Commit

Permalink
Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
Ice3man543 committed Feb 2, 2021
1 parent 99b511e commit 99eeea4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 0 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ type Client struct {
serversIndex uint32
}

const defaultPort = "53"

// New creates a new dns client
func New(baseResolvers []string, maxRetries int) *Client {
client := Client{
Expand Down
23 changes: 23 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package retryabledns

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestConsistentResolve(t *testing.T) {
client := New([]string{"8.8.8.8:53", "1.1.1.1:53"}, 5)

var last string
for i := 0; i < 10; i++ {
d, err := client.Resolve("example.com")
require.Nil(t, err, "could not resolve dns")

if last != "" {
require.Equal(t, last, d.A[0], "got another data from previous")
} else {
last = d.A[0]
}
}
}

0 comments on commit 99eeea4

Please sign in to comment.