On Windows, there's no easy way for disabling/removing IPv6 DNS
resolver, so we check whether we can listen on ::1, then spawn a
listener for receiving DNS requests
On windows, the SYSTEM user is used to run ctrld service. This user has
different environment with the user that run the `ctrld` binary via CLI.
That causes the mismatch issue in config file path, log path, or more
generally, everything that involve with home directory.
To circumvent this pain, just always passing the config path and the
original home dir in start mode. So `ctrld run` command can setup things
correctly.
Supported actions:
- start: install and start ctrld as a system service
- stop: stop the ctrld service
- restart: restart ctrld service
- status: show status of ctrld service
- uninstall: remove ctrld from system service
Some operating systems may throw a confirmation dialog when attempting
to listen on any interface other than loopback. A better approach is
checking for any interface which is up and can be routed IP traffic.
Currently, os resolver not only handle A and AAAA records, but also does
it wrongly, since when it packs AAAA record to a dns.A record.
This commit reworks os resolver to make it works with all supported
record types.
This commit adds the ability to start `ctrld` without config file. All
necessary information can be provided via command line flags, either in
base64 encoded config or launch arguments.
This commit adds config params to enable local DNS response caching and
control its behavior, allow tweaking the cache size, ttl override and
serving stale response.
This commit changes "verbose" flag from boolean to count flag, so we can
specify the flag multiple times to indicate different logging output:
- No "-v": no query logging except startup/listeners
- "-v" : query logging enabled
- "-vv" : debug level logging enabled
Previously, for each DoH query, we use the net/http default transport
with DialContext function re-assigned. This has some problems:
- The first query to server will be slow.
- Using the default transport for all upstreams can have race condition
in case of multiple queries to multiple DoH upstreams
This commit fixes those issues, by initializing a separate transport for
each DoH upstream, the warming up the transport by doing a test query.
Later queries can take the advantage and re-use the connection.