-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DoH resolver implementation #1
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8dbbea4
DoH resolver implementation
vyzo a4e937c
gomod: update madns dependency
vyzo 978e5c3
don't force the dns-query url path
vyzo 961bca3
do A/AAAA requests in parallel
vyzo 46ccfe2
add tests
vyzo a1e418f
use go-log/v2
vyzo 3ca7b87
deps: use go-multiaddr-dns@v0.3.0
vyzo 04e7f46
better dns addr for test
vyzo 92051b3
check that we got both ip4 and ip6 addrs in test
vyzo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add tests
- Loading branch information
commit 46ccfe2e705ea8479d7654f7c1044d1e509f1e4d
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package doh | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
) | ||
|
||
func TestLookupIPAddr(t *testing.T) { | ||
r := NewResolver("https://cloudflare-dns.com/dns-query") | ||
|
||
ips, err := r.LookupIPAddr(context.Background(), "ewr-1.bootstrap.libp2p.io") | ||
vyzo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
if len(ips) == 0 { | ||
t.Fatal("got no IPs") | ||
} | ||
} | ||
|
||
func TestLookupTXT(t *testing.T) { | ||
r := NewResolver("https://cloudflare-dns.com/dns-query") | ||
|
||
txt, err := r.LookupTXT(context.Background(), "_dnsaddr.bootstrap.libp2p.io") | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
if len(txt) == 0 { | ||
t.Fatal("got no TXT entries") | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to have an explicit check that confirms this returns both ipv4 AND ipv6 (
libp2p.io
has both, so good candidate)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, let me do that/