Improve DNS over HTTPs implementation, fix #7
We first need to merge !4 (merged). Only the last commit is relevant.
Improvements
- sane default dns provider
- http timeout
- comment for ssl verification
- proper logging
- option to add custom resolver (not used/needed)
- add test
Test run if the first two dns servers are dropped by firewall :
pea@peabox:bootstrap go test -count=1 -v ./...
=== RUN TestDoh
10:26AM DBG Selected DoH provider dnsServer=208.67.222.222
10:26AM WRN Could not resolve host with DNS over HTTPs error="Post \"https://208.67.222.222/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)" domain=heise.de resolver=208.67.222.222
10:26AM DBG Selected DoH provider dnsServer=9.9.9.9
10:26AM WRN Could not resolve host with DNS over HTTPs error="Post \"https://9.9.9.9/dns-query\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)" domain=heise.de resolver=9.9.9.9
10:26AM DBG Selected DoH provider dnsServer=dns.mullvad.net
10:26AM INF Got dns ip=193.99.144.80
--- PASS: TestDoh (30.16s)
PASS
ok 0xacab.org/leap/bitmask-core/pkg/bootstrap 30.172s