Skip to content
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

fix(dns): allow http:// DoH resolvers #645

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gateway/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
}

func newResolver(url string, opts ...doh.Option) (madns.BasicResolver, error) {
if !strings.HasPrefix(url, "https://") {
return nil, fmt.Errorf("invalid resolver url: %s", url)
if !strings.HasPrefix(url, "https://") && !strings.HasPrefix(url, "http://") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is going to be enough:
https://github.com/libp2p/go-doh-resolver/blob/f2e25860684789200e3a3a911dc9a74d01771d5b/resolver.go#L55

Note: AFAICT there is no DNS-over-HTTP spec for some reason it's specified as being over HTTPS, however I definitely see your point and have definitely felt the pain over the self-signed cert dance just to run local resolvers

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, filled this PR because I am looking at https://github.com/libp2p/go-doh-resolver and https://github.com/multiformats/go-multiaddr-dns to wire up TTL (to fix #329 (comment) for DNSLinks), so likely will relax things there as well, and get back to this PR draft.

return nil, fmt.Errorf("invalid DoH resolver URL: %s", url)

Check warning on line 19 in gateway/dns.go

View check run for this annotation

Codecov / codecov/patch

gateway/dns.go#L19

Added line #L19 was not covered by tests
}

return doh.NewResolver(url, opts...)
Expand Down
Loading