Commit Graph

12 Commits

Author SHA1 Message Date
Ming Aldrich-Gan
2332d9b7c1 Add local_addr configuration for doh-server (#39)
* Add local_addr configuration for doh-server

This commit adds a `local_addr` string value to `doh-server.conf`, specifying the IP address and port from which outgoing calls to upstream DNS resolvers should originate. This value is set as the `udpClient`'s and `tcpClient`'s `Dialer.LocalAddr` when initializing a `NewServer`. If the value is left empty in `doh-server.conf`, it defaults to the first `listen` address (which in turn defaults to `"127.0.0.1:8053"`).

One use case for this would be if `doh-server` is proxying requests to a local DNS resolver (e.g. `unbound` or Pi-hole). Up to version 2.0.0, all DNS queries from `doh-server` are sent from `127.0.0.1` (even if the `listen` address is set to a different loopback IP address), making it hard to distinguish them from all other local DNS queries from the same machine in the query logs.

* Revert defaulting of local_addr to listen address

This commit reverts to the existing behavior when `conf.LocalAddr == ""`, i.e. letting `dns.Client` instantiate its own `Dialer` with the default local address.

* Fixup comment in configuration file

* Log errors from Dialer instantiation (e.g. if LocalAddr port is missing)

* Fixup other comment in configuration file

* Return error and log fatal
2019-03-25 04:01:32 +08:00
Sherlock Holo
4c0cae7111 Refine runtime.GOOS check, use switch case to replace a long if 2018-11-28 00:08:21 +08:00
Star Brilliant
35ddf43505 Add PID file support 2018-11-27 17:37:57 +08:00
Star Brilliant
7d5cf98d2b Fix the "address already in use" issue 2018-04-16 13:58:38 +08:00
Star Brilliant
521b4b6abc Implement IETF protocol 2018-03-21 00:14:59 +08:00
Star Brilliant
699c8fba16 Breaking change: Use configuration file 2017-11-30 20:42:30 +08:00
Star Brilliant
1b998d13de Relicense as MIT license 2017-11-29 10:45:04 +08:00
Star Brilliant
2577b720c7 Disable logging by default 2017-11-25 15:05:15 +08:00
Star Brilliant
e382ff415f Add Readme 2017-10-04 12:30:41 +08:00
Star Brilliant
c4a57edc7f Change default port 2017-10-04 01:04:33 +08:00
Star Brilliant
45e42fe83c Change default port 2017-10-04 00:58:33 +08:00
Star Brilliant
1f8b1ea7ad Update 2017-10-03 23:50:16 +08:00