From c9ccc532828f2ef656b98aa0f37f9b652b1faf89 Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Wed, 11 Dec 2019 17:54:34 +0300 Subject: [PATCH] Merge: * set BlockingMode: "null_ip" by default; minor improvements Squashed commit of the following: commit 653544b98dc4d1b9a74e1509d0e6104b71bcdcb3 Author: Simon Zolin Date: Wed Dec 11 17:34:41 2019 +0300 * DNS reconfigure: protect against delayed socket fd close commit 9e650f37dee7f771bf1d9d714c35f0a81788aa16 Author: Simon Zolin Date: Wed Dec 11 15:28:33 2019 +0300 - fix race on startup commit 878fdb8fc4ebbc6fab683a65f5e4298e64c2073e Author: Simon Zolin Date: Wed Dec 11 15:11:21 2019 +0300 * travis: don't run tests commit 1c4ab60684ee22d55e6d2a3350c0f24d9844255c Author: Simon Zolin Date: Wed Dec 11 14:56:28 2019 +0300 * travis: 'release.sh' and then run tests commit e1f644b8d9a1f3b46990cdfb1b75fd81b3a49d33 Author: Simon Zolin Date: Wed Dec 11 14:52:59 2019 +0300 * set BlockingMode: "null_ip" by default --- .travis.yml | 2 -- dnsforward/dnsforward.go | 7 +++---- home/config.go | 6 +++--- home/home.go | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3d5f0cc6..d04c24b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,8 +42,6 @@ matrix: script: - node -v - npm -v - # Run tests just in case - - go test -race -v -bench=. ./... # Prepare releases - ./release.sh - ls -l dist diff --git a/dnsforward/dnsforward.go b/dnsforward/dnsforward.go index 404d1ca0..2988133d 100644 --- a/dnsforward/dnsforward.go +++ b/dnsforward/dnsforward.go @@ -360,10 +360,9 @@ func (s *Server) Reconfigure(config *ServerConfig) error { return errorx.Decorate(err, "could not reconfigure the server") } - // On some Windows versions the UDP port we've just closed in proxy.Stop() doesn't get actually closed right away. - if runtime.GOOS == "windows" { - time.Sleep(1 * time.Second) - } + // It seems that net.Listener.Close() doesn't close file descriptors right away. + // We wait for some time and hope that this fd will be closed. + time.Sleep(100 * time.Millisecond) err = s.Prepare(config) if err != nil { diff --git a/home/config.go b/home/config.go index 3d99160b..019612eb 100644 --- a/home/config.go +++ b/home/config.go @@ -157,9 +157,9 @@ var config = configuration{ Port: 53, StatsInterval: 1, FilteringConfig: dnsforward.FilteringConfig{ - ProtectionEnabled: true, // whether or not use any of dnsfilter features - BlockingMode: "nxdomain", // mode how to answer filtered requests - BlockedResponseTTL: 10, // in seconds + ProtectionEnabled: true, // whether or not use any of dnsfilter features + BlockingMode: "null_ip", // mode how to answer filtered requests + BlockedResponseTTL: 10, // in seconds Ratelimit: 20, RefuseAny: true, AllServers: false, diff --git a/home/home.go b/home/home.go index 66309c53..9315ca0b 100644 --- a/home/home.go +++ b/home/home.go @@ -172,7 +172,7 @@ func run(args options) { log.Fatalf("%s", err) } go func() { - err = startDNSServer() + err := startDNSServer() if err != nil { log.Fatal(err) }