Commit Graph

259 Commits

Author SHA1 Message Date
Wesley Squasher
f6b52a653a Use TCP when appropriate for the given query type/response 2019-05-12 08:17:52 +00:00
B. Modi
9a07f5b856 Added Quad9 servers in config. Good for malware threat prevention. 2019-05-10 13:50:17 -07:00
Star Brilliant
8787921faf Merge pull request #43 from modib/macos-build-error-fix
Make Makefile compatible with swift5 and older swift versions
2019-05-11 02:13:12 +08:00
B. Modi
1642730af0 Make Makefile compatible with swift5 and older swift versions 2019-05-10 11:02:07 -07: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
7f5a23584f Release 2.0.1 v2.0.1 2019-03-24 19:11:12 +08:00
Sherlock Holo
17e5848178 Fix random selector (#41)
* Fix a bug: when only have one upstream, random selector will panic

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>
2019-03-24 09:13:14 +08:00
Star Brilliant
475894baaa Update Changelog v2.0.0 2019-03-20 12:58:59 +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
Sherlock Holo
871604f577 Add LVS weight round robin selector (#36)
* Add upstream selector, there are two selector now:
    - random selector
    - weight random selector

random selector will choose upstream at random; weight random selector will choose upstream at random with weight

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Rewrite config and config file example, prepare for weight round robbin selector

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Replace bad implement of weight random selector with weight round robbin selector, the algorithm is nginx weight round robbin like

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Use new config module

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Disable deprecated DualStack set

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Fix typo

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Optimize upstreamSelector judge

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Fix typo

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Add config timeout unit tips

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Set wrr http client timeout to replace http request timeout

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Add weight value range

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Add a line ending for .gitignore

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Optimize config file style

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Modify Weight type to int32

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Add upstreamError

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Rewrite Selector interface and wrr implement

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Use http module predefined constant to judge req.response.StatusCode

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Use Selector.ReportUpstreamError to report upstream error for evaluation loop in real time

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Make client selector field private

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Replace config file url to URL
Add miss space for 'weight= 50'

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Rewrite Selector.ReportUpstreamError to Selector.ReportUpstreamStatus, report upstream ok in real time

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Fix checkIETFResponse: if upstream OK, won't increase weight

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Fix typo

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Rewrite wrr evaluation, concurrent check upstream and reduce interval to 15s

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Add lvs wrr selector config

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Add DebugReporter interface, when client verbose is true and the selector implements it, will report all upstream weights every 15s

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Rename WeightRoundRobinSelector to NginxWRRSelector

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Add LVSSelector

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Remove useless log

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>
2019-03-13 14:52:54 +08:00
Star Brilliant
a400f03960 Bump version to 2.0.0 2019-03-09 19:10:30 +08:00
Star Brilliant
7839eed014 Update build scripts 2019-03-09 19:09:35 +08:00
Star Brilliant
0f35971118 Replace Url with URL 2019-03-09 19:05:07 +08:00
Sherlock Holo
fec1e84d5e Add backend weight round robin select (#34)
* Add upstream selector, there are two selector now:
    - random selector
    - weight random selector

random selector will choose upstream at random; weight random selector will choose upstream at random with weight

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Rewrite config and config file example, prepare for weight round robbin selector

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Replace bad implement of weight random selector with weight round robbin selector, the algorithm is nginx weight round robbin like

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Use new config module

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Disable deprecated DualStack set

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Fix typo

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Optimize upstreamSelector judge

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Fix typo

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Add config timeout unit tips

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Set wrr http client timeout to replace http request timeout

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Add weight value range

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Add a line ending for .gitignore

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Optimize config file style

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Modify Weight type to int32

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Add upstreamError

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Rewrite Selector interface and wrr implement

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Use http module predefined constant to judge req.response.StatusCode

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Use Selector.ReportUpstreamError to report upstream error for evaluation loop in real time

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Make client selector field private

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Replace config file url to URL
Add miss space for 'weight= 50'

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Rewrite Selector.ReportUpstreamError to Selector.ReportUpstreamStatus, report upstream ok in real time

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Fix checkIETFResponse: if upstream OK, won't increase weight

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>

* Fix typo

Signed-off-by: Sherlock Holo <sherlockya@gmail.com>
2019-03-09 18:12:44 +08:00
Star Brilliant
8f2004d1de Bump to version 1.4.3 2018-12-05 15:57:51 +08:00
Star Brilliant
a3f4468325 Release 1.4.2 v1.4.2 2018-12-05 15:57:25 +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
01d60df9cd Merge pull request #30 from Sherlock-Holo/master
Refine runtime.GOOS check, use switch case to replace a long if
2018-11-28 00:11:52 +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
95fe3e3b4e Use time.Since to replace time.Now().Sub 2018-11-27 20:18:30 +08:00
Star Brilliant
35ddf43505 Add PID file support 2018-11-27 17:37:57 +08:00
Star Brilliant
3083b668ca Remove an item from Changelog since it was actually fixed in eariler version 2018-11-10 23:02:41 +08:00
Star Brilliant
dd8ea973f4 Correct spelling 2018-11-10 23:01:46 +08:00
Star Brilliant
0df0002e6b Bump version to 1.4.2 2018-11-10 23:00:06 +08:00
Star Brilliant
3affb2c227 Release 1.4.1 v1.4.1 2018-11-10 22:59:37 +08:00
Star Brilliant
7c7b7d969d Add detectportal.firefox.com to default passthrough list 2018-11-08 23:58:28 +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
2d9c9eba50 Detect context.DeadlineExceeded 2018-11-07 19:41:55 +08:00
Star Brilliant
c51be0e69c Use context for more functions 2018-11-07 19:25:46 +08:00
Star Brilliant
95ec839409 Put cancel() earlier 2018-11-07 19:10:06 +08:00
Star Brilliant
502fe6b048 Use RCODE_REFUSED for unsupported Qclass 2018-11-07 18:56:22 +08:00
Star Brilliant
f8b40c4bfc Try to use context.WithTimeout to detect HTTP timeout. Hopefully it might work. 2018-11-07 18:47:01 +08:00
Star Brilliant
bb1e21778a Slightly change the log format 2018-11-07 18:11:12 +08:00
Star Brilliant
afa0d563d0 Add passthrough feature, tests are welcome 2018-11-07 17:10:39 +08:00
Star Brilliant
017a18f20c Fix HTTP stream leaking problem 2018-11-06 14:46:45 +08:00
Star Brilliant
0577ff6dca Merge pull request #28 from Chaz6/patch-1
doh-server: change to google.go
2018-11-02 10:48:33 +08:00
Chris Hills
ef2c6bbdc8 Update google.go
Make "cd" check case-insensitive.
2018-11-01 20:12:28 +00:00
Chris Hills
4d742bd15e doh-server: change to google.go
Allow the "cd" parameter to be case insensitive to work with some clients that send True/False instead of true/false such as gDNS.
2018-10-31 23:40:33 +00:00
Star Brilliant
3b112b946e Congratulations RFC 8484, remove the word "draft" from Readme 2018-10-20 13:59:37 +08:00
Star Brilliant
6d19cbb9ad Congratulations RFC 8484, remove the word "draft" from Readme 2018-10-20 13:58:26 +08:00
Star Brilliant
b094a8d4fd Update Readme, fix issue #27 2018-10-04 23:03:51 +08:00
Star Brilliant
c1f6fe1997 Update Readme 2018-10-04 02:12:55 +08:00
Star Brilliant
1fb3ed3513 Add a ink to a guide 2018-10-04 02:11:55 +08:00
Star Brilliant
c85ef45840 Fix panic with debug_http_headers 2018-09-27 16:46:36 +08:00
Star Brilliant
85d81d3d0b Merge pull request #22 from paulie-g/master
Fix segfault when no_cookies=true
2018-09-24 03:21:00 +10:00
Paul G
ab0eddb0ba Fix segfault when no_cookies=true 2018-09-23 08:25:15 -04:00
Star Brilliant
aa3389b1d0 Build doh-logger with static libswiftCore, fix #20 2018-09-22 04:28:12 +08:00
Star Brilliant
6eb7b29142 Add configuration option: debug_http_headers 2018-09-22 04:23:55 +08:00
Star Brilliant
ea0a769389 Bump version to 1.3.11 2018-08-21 01:44:56 +08:00
Star Brilliant
e480251e67 Release 1.3.10 v1.3.10 2018-08-21 01:44:35 +08:00