Commit Graph

10 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
qyb
2df81db465 log real client ip behind a HTTPS gateway (#38)
* log real client ip behind a HTTPS gateway

* fix tab/space indent

* better compatible for apache/nginx log default format

* add  config option
2019-03-16 05:36:52 +08:00
Star Brilliant
07f39088d4 Update example configuration 2018-07-02 20:42:11 +08:00
Star Brilliant
db007fbded Update example configuration 2018-07-02 20:40:56 +08:00
Star Brilliant
07143d5890 Update documentation about TLS
This is to avoid confusions like issue #12
2018-06-26 13:22:32 +08:00
Star Brilliant
b9c1bcaad2 Put [::1] into default listen addresses 2018-04-16 13:18:51 +08:00
gdm85
1abba72898 Add server support for multiple listen addresses 2018-04-15 19:57:17 +02:00
Star Brilliant
521b4b6abc Implement IETF protocol 2018-03-21 00:14:59 +08:00
Star Brilliant
dcd6b0bb57 Add a timeout configuration for server 2018-01-17 20:31:49 +08:00
Star Brilliant
699c8fba16 Breaking change: Use configuration file 2017-11-30 20:42:30 +08:00