From 6dfcb659d4e3794b2d9cdb36f99cbaf29aafb428 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Wed, 10 Jan 2018 13:33:06 +0100 Subject: [PATCH] Handle daemonization --- dnscrypt-proxy/dnscrypt-proxy.toml | 43 +++++++++++++++++++++++------- dnscrypt-proxy/main.go | 5 ++++ 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/dnscrypt-proxy/dnscrypt-proxy.toml b/dnscrypt-proxy/dnscrypt-proxy.toml index 4edd62dc..f3802a34 100644 --- a/dnscrypt-proxy/dnscrypt-proxy.toml +++ b/dnscrypt-proxy/dnscrypt-proxy.toml @@ -1,25 +1,50 @@ -# dnscrypt-proxy configuration -# List of servers to use -# If this line is commented, all registered servers will be used +#################################### +# # +# dnscrypt-proxy configuration # +# # +#################################### + + +############## Global settings ############## + +## List of servers to use +## If this line is commented, all registered servers will be used + server_names = ["dnscrypt.org-fr"] -# List of local addresses and ports to listen to. Can be IPv4 and/or IPv6. + +## List of local addresses and ports to listen to. Can be IPv4 and/or IPv6. + listen_addresses = ["127.0.0.1:53", "[::1]:53"] -# Run the server as a background process + +## Whether to the server as a background process +## Do not set to true if you are using systemd. + daemonize = false -# Always use TCP to connect to upstream servers + +## Always use TCP to connect to upstream servers + force_tcp = false -# Timeout, in milliseconds + +## Timeout, in milliseconds + timeout = 2500 -# Delay, in minutes, after which certificates are reloaded + +## Delay, in minutes, after which certificates are reloaded + cert_refresh_delay = 30 -# Static list of available servers + + +############## Servers ############## + +## Static list of available servers + [servers] [servers."dnscrypt.org-fr"] provider_name = "2.dnscrypt-cert.fr.dnscrypt.org" diff --git a/dnscrypt-proxy/main.go b/dnscrypt-proxy/main.go index c504d8b4..f553ed91 100644 --- a/dnscrypt-proxy/main.go +++ b/dnscrypt-proxy/main.go @@ -7,6 +7,8 @@ import ( "net" "time" + "github.com/VividCortex/godaemon" + "golang.org/x/crypto/curve25519" ) @@ -29,6 +31,9 @@ func main() { if err := ConfigLoad(&proxy, "dnscrypt-proxy.toml"); err != nil { panic(err) } + if proxy.daemonize { + godaemon.MakeDaemon(&godaemon.DaemonAttr{}) + } proxy.StartProxy() }