Commit Graph

55 Commits

Author SHA1 Message Date
GreyXor
e72363306b cleanup code style 2023-07-04 16:09:12 +02:00
GreyXor
b9bf6e80f4 fix: io and os instead of deprecated ioutil
Deprecated: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details.
https://pkg.go.dev/io/ioutil
2022-10-29 11:35:22 +02:00
Fishbone
8cd4c4205d gh-115-go-import-v2: Suffix Go module path with /v2 2021-09-12 17:12:39 +08:00
gdm85
8a13f085a6 Simplify doDNSQuery call 2021-05-13 19:15:54 +02:00
Alex Chauvin
1cf98e87c9 add client certificate authentication (#98)
* add client certificate authentication
* fix #97 for ECS forward local addresses
2021-01-08 08:34:25 +00:00
Alex Chauvin
967faec56c add options for ECS full subnet mask in server & TLS verification bypass in client (#92)
* add ECS full size & limit filtering

* add tls certification bypass in configuration

* flush log lines

* changes following pull request comments

* with fmt and reorg of libs in client.go
2020-11-24 12:35:23 +00:00
Star Brilliant
4f46b89feb Resolve (some) linter warnings 2020-08-02 05:58:24 +08:00
Star Brilliant
6d30a12d5f Pass X-Real-IP to handlers.CombinedLoggingHandler
Note that X-Forwarded-For or guessed client IP are not used due to security concerns.
This should fix issue #71.
2020-07-30 20:44:18 +08:00
Star Brilliant
a8aed7e09a Use ExchangeClient for DNS request 2020-07-26 22:09:24 +08:00
James Swineson
d8e3969640 add no_ecs argument in query string support 2019-11-11 10:11:25 +08:00
gdm85
a09dfbbbc1 Add support for type prefix for upstream addresses
Add support for DNS-over-TLS upstream addresses
Remove tcp_only configuration option
2019-10-16 13:14:03 +02:00
Wesley Squasher
f6b52a653a Use TCP when appropriate for the given query type/response 2019-05-12 08:17:52 +00:00
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
Star Brilliant
fa2bcf74a9 Remove dns.ErrTruncated according to https://github.com/miekg/dns/pull/815 2018-11-28 15:31:02 +08:00
Star Brilliant
4754aa0414 Enable CORS by default, which is necessary for AJAX resolver to run 2018-11-07 20:13:51 +08:00
Star Brilliant
c51be0e69c Use context for more functions 2018-11-07 19:25:46 +08:00
Star Brilliant
afa0d563d0 Add passthrough feature, tests are welcome 2018-11-07 17:10:39 +08:00
Star Brilliant
c85ef45840 Fix panic with debug_http_headers 2018-09-27 16:46:36 +08:00
Star Brilliant
6eb7b29142 Add configuration option: debug_http_headers 2018-09-22 04:23:55 +08:00
Star Brilliant
a64df3f048 Preserve TransactionID 2018-07-02 13:49:59 +08:00
Star Brilliant
523b6120b9 Workaround a bug causing DNSCrypt-Proxy to expect a response with TransactionID = 0xcafe 2018-06-26 03:55:59 +08:00
Star Brilliant
82fe91395d Workaround a bug causing Unbound to refuse returning anything about the root 2018-06-26 03:04:34 +08:00
Star Brilliant
abdd033310 Print upstream information if error happens 2018-06-12 11:12:13 +08:00
Star Brilliant
874a3613e4 Use dns.DefaultMsgSize instead of magic number 4096 2018-04-25 03:04:31 +08:00
Star Brilliant
dc14a70e9d Use dns.DefaultMsgSize instead of magic number 4096 2018-04-24 20:46:34 +08:00
Star Brilliant
f4516429ee Take User-Agent out of common library, that would be better for packaging 2018-04-24 14:25:33 +08:00
Star Brilliant
ff0e9529cb Update User-Agent 2018-04-16 21:35:33 +08:00
Star Brilliant
7d5cf98d2b Fix the "address already in use" issue 2018-04-16 13:58:38 +08:00
gdm85
1abba72898 Add server support for multiple listen addresses 2018-04-15 19:57:17 +02:00
Star Brilliant
83f20767ea Update to IETF draft-07 2018-04-13 02:46:03 +08:00
Star Brilliant
236f7931e6 Update to IETF draft-06 2018-04-10 14:02:51 +08:00
Star Brilliant
0a107be362 Use absolute path for ../json-dns 2018-04-02 21:07:49 +08:00
Star Brilliant
8b45c99dfc Adapt for CloudFlare DNS service 2018-04-01 22:57:18 +08:00
Star Brilliant
cb78b9b696 A DNS API server SHOULD respond with HTTP status code 415 (Unsupported Media Type) upon receiving a media type it is unable to process. 2018-03-24 17:33:50 +08:00
Star Brilliant
06b700cb7e Fix server Content-Type problem 2018-03-21 17:07:40 +08:00
Star Brilliant
0e36d3b31b Content-Type auto detection for client 2018-03-21 16:58:42 +08:00
Star Brilliant
5723558934 Fix Accept header detection 2018-03-21 15:28:47 +08:00
Star Brilliant
a81a7eff58 It's time to flip the version number 2018-03-21 02:38:13 +08:00
Star Brilliant
521b4b6abc Implement IETF protocol 2018-03-21 00:14:59 +08:00
Star Brilliant
f4e27c93a6 Correct time.RFC1123 to http.TimeFormat 2018-01-22 17:45:53 +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
Star Brilliant
e510d84809 CloudFlare will break 502 error 2017-11-30 19:08:22 +08:00
Star Brilliant
f49b5a3a0b Modify HTTP status codes to affect the error 2017-11-30 16:24:29 +08:00
Star Brilliant
5e6be777c9 Alias 0/0 to be 0.0.0.0/0 2017-11-30 13:42:24 +08:00
Star Brilliant
82e9503849 Alias 0/0 to be 0.0.0.0/0 2017-11-30 13:38:59 +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
f621d88d99 Turn requests lower case (to get rid of knot-resolver's mixed case) 2017-11-16 15:47:42 +08:00
Star Brilliant
a03529d1fd Mark cache as private 2017-10-04 16:44:42 +08:00