dns icon indicating copy to clipboard operation
dns copied to clipboard

Custom providers for DoT

Open spar01 opened this issue 4 years ago • 4 comments

Would be great to have the ability to specify custom DoT providers

Opening an issue as a result of discussion in https://github.com/qdm12/gluetun/discussions/679

spar01 avatar Oct 19 '21 03:10 spar01

@AndrewKvalheim @spar01 @falahati

I'm finally working on this, but I'm a bit stuck on how one should input a custom provider. For now the user specifies one or more CSV names like cloudflare,google and the program will fish out associated data for each. For example Cloudflare hardcoded data is:

https://github.com/qdm12/dns/blob/c24203f41ab21b588d9648cdda31223868ff88eb/pkg/provider/cloudflare.go#L5

Now how should one input this data? I think keeping the CSV aspect to select multiple built-in providers is best, so maybe have another environment variable/input and the user should describe the provider for example with JSON? A bit complex to do, it would be like DOT_PROVIDERS_CUSTOM={"name":"Cloudflare","dns":{"ipv4":["1.1.1.1","1.0.0.1"],"ipv6":["2606:4700:4700::1111","2606:4700:4700::1001"]},"dot":{"ipv4":["1.1.1.1","1.0.0.1"],"ipv6":["2606:4700:4700::1111","2606:4700:4700::1001"],"name":"cloudflare-dns.com","port":853},"doh":{"url":"https://cloudflare-dns.com/dns-query"}}. Obviously one can specify less IP addresses etc. but for example DoH requires both DoT + DNS, and DoT requires DNS ip addresses as well.

Thoughts?

qdm12 avatar May 25 '23 17:05 qdm12

Consider that a user may be leveraging Cloudflare Zero Trust and have a designated DoT/DoH URL given for their named location.

IMO, path of least resistance for a custom provider would fill all the boxes.

warrentc3 avatar May 31 '23 09:05 warrentc3

This is probably a bad idea but I wonder if you could represent those as a flat list of URIs. Not sure if standards exists for all of it but RFC 4501 provides some precedent. Something like this would be simple to store in a single line CSV:

dns://1.1.1.1
dns://1.0.0.1
dns://[2606:4700:4700::1111]
dns://[2606:4700:4700::1001]
dot://1.1.1.1:853/cloudflare-dns.com
dot://1.0.0.1/cloudflare-dns.com # Default port can be omitted
dot://[2606:4700:4700::1111]/cloudflare-dns.com
dot://[2606:4700:4700::1001]/cloudflare-dns.com
https://cloudflare-dns.com/dns-query

AndrewKvalheim avatar Jun 01 '23 16:06 AndrewKvalheim

Let's have all providers in a yml file. The program would output a yml file locally with its builtin providers if no file exists, and the user can then edit the file and restart the program to have additional providers. We can later on support other formats such as RFC 4501 / json / env variables.

qdm12 avatar Jul 12 '23 16:07 qdm12