diff --git a/SimpleDnsCrypt/Config/Global.cs b/SimpleDnsCrypt/Config/Global.cs
index ab7d814e..c48950af 100644
--- a/SimpleDnsCrypt/Config/Global.cs
+++ b/SimpleDnsCrypt/Config/Global.cs
@@ -1,23 +1,23 @@
namespace SimpleDnsCrypt.Config
{
public static class Global
- {
+ {
///
/// The name of this application.
///
public const string ApplicationName = "Simple DNSCrypt";
- ///
- /// Remote URI where the application will find the update informations.
- ///
- public const string ApplicationUpdateUri =
- "https://raw.githubusercontent.com/bitbeans/SimpleDnsCrypt/master/update.yml";
+ ///
+ /// Remote URI where the application will find the update informations.
+ ///
+ public const string ApplicationUpdateUri =
+ "https://raw.githubusercontent.com/bitbeans/SimpleDnsCrypt/master/update.yml";
- ///
- /// Remote URI where the application will find the update informations.
- ///
- public const string ApplicationUpdateUri64 =
- "https://raw.githubusercontent.com/bitbeans/SimpleDnsCrypt/master/update64.yml";
+ ///
+ /// Remote URI where the application will find the update informations.
+ ///
+ public const string ApplicationUpdateUri64 =
+ "https://raw.githubusercontent.com/bitbeans/SimpleDnsCrypt/master/update64.yml";
///
/// The public key to validate the installer.
@@ -34,83 +34,93 @@ public static class Global
///
public const string RedistributablePackage64 = "https://aka.ms/vs/16/release/VC_redist.x64.exe";
+ ///
+ /// Output folder for logs.
+ ///
+ public const string LogDirectory = "logs";
+
///
/// The folder where the dnscrypt-proxy lives in.
///
public const string DnsCryptProxyFolder = "dnscrypt-proxy";
- public const string DnsCryptProxyExecutableName = "dnscrypt-proxy.exe";
+ public const string DnsCryptProxyExecutableName = "dnscrypt-proxy.exe";
public const string DnsCryptConfigurationFile = "dnscrypt-proxy.toml";
- ///
- /// Time we wait on a service restart (ms).
- ///
- public const int ServiceRestartTime = 5000;
+ ///
+ /// Logfile name of dnscrypt-proxy.
+ ///
+ public const string DnsCryptLogFile = "dnscrypt-proxy.log";
- ///
- /// Time we wait on a service start (ms).
- ///
- public const int ServiceStartTime = 2500;
+ ///
+ /// Time we wait on a service restart (ms).
+ ///
+ public const int ServiceRestartTime = 5000;
- ///
- /// Time we wait on a service stop (ms).
- ///
- public const int ServiceStopTime = 2500;
+ ///
+ /// Time we wait on a service start (ms).
+ ///
+ public const int ServiceStartTime = 2500;
- ///
- /// Time we wait on a service uninstall (ms).
- ///
- public const int ServiceUninstallTime = 2500;
+ ///
+ /// Time we wait on a service stop (ms).
+ ///
+ public const int ServiceStopTime = 2500;
- ///
- /// Time we wait on a service install (ms).
- ///
- public const int ServiceInstallTime = 3000;
+ ///
+ /// Time we wait on a service uninstall (ms).
+ ///
+ public const int ServiceUninstallTime = 2500;
- public const string DomainBlockLogFileName = "blocked.log";
- public const string QueryLogFileName = "query.log";
+ ///
+ /// Time we wait on a service install (ms).
+ ///
+ public const int ServiceInstallTime = 3000;
+
+ public const string DomainBlockLogFileName = "blocked.log";
+ public const string QueryLogFileName = "query.log";
- public const string WhitelistRuleFileName = "domain-whitelist.txt";
- public const string BlacklistRuleFileName = "domain-blacklist.txt";
- public const string BlacklistFileName = "blacklist.txt";
+ public const string WhitelistRuleFileName = "domain-whitelist.txt";
+ public const string BlacklistRuleFileName = "domain-blacklist.txt";
+ public const string BlacklistFileName = "blacklist.txt";
- public const string CloakingRulesFileName = "cloaking-rules.txt";
- public const string ForwardingRulesFileName = "forwarding-rules.txt";
+ public const string CloakingRulesFileName = "cloaking-rules.txt";
+ public const string ForwardingRulesFileName = "forwarding-rules.txt";
public const string GlobalResolver = "0.0.0.0:53";
- public const string DefaultResolverIpv4 = "127.0.0.1:53";
- public const string DefaultResolverIpv6 = "[::1]:53";
+ public const string DefaultResolverIpv4 = "127.0.0.1:53";
+ public const string DefaultResolverIpv6 = "[::1]:53";
///
/// List of files must exist.
///
public static readonly string[] DnsCryptProxyFiles =
- {
- "dnscrypt-proxy.exe",
+ {
+ "dnscrypt-proxy.exe",
"dnscrypt-proxy.toml",
"LICENSE"
- };
-
- ///
- /// List of interfaces, marked as hidden.
- ///
- public static readonly string[] NetworkInterfaceBlacklist =
- {
- "Microsoft Virtual",
- "Hamachi Network",
- "VMware Virtual",
- "VirtualBox",
- "Software Loopback",
- "Microsoft ISATAP",
- "Microsoft-ISATAP",
- "Teredo Tunneling Pseudo-Interface",
- "Microsoft Wi-Fi Direct Virtual",
- "Microsoft Teredo Tunneling Adapter",
- "Von Microsoft gehosteter",
- "Microsoft hosted",
- "Virtueller Microsoft-Adapter",
- "TAP"
- };
- }
+ };
+
+ ///
+ /// List of interfaces, marked as hidden.
+ ///
+ public static readonly string[] NetworkInterfaceBlacklist =
+ {
+ "Microsoft Virtual",
+ "Hamachi Network",
+ "VMware Virtual",
+ "VirtualBox",
+ "Software Loopback",
+ "Microsoft ISATAP",
+ "Microsoft-ISATAP",
+ "Teredo Tunneling Pseudo-Interface",
+ "Microsoft Wi-Fi Direct Virtual",
+ "Microsoft Teredo Tunneling Adapter",
+ "Von Microsoft gehosteter",
+ "Microsoft hosted",
+ "Virtueller Microsoft-Adapter",
+ "TAP"
+ };
+ }
}
diff --git a/SimpleDnsCrypt/Models/DnscryptProxyConfiguration.cs b/SimpleDnsCrypt/Models/DnscryptProxyConfiguration.cs
index 82b44f0f..13c654f3 100644
--- a/SimpleDnsCrypt/Models/DnscryptProxyConfiguration.cs
+++ b/SimpleDnsCrypt/Models/DnscryptProxyConfiguration.cs
@@ -1,8 +1,10 @@
using Caliburn.Micro;
using DnsCrypt.Models;
using Nett;
+using SimpleDnsCrypt.Config;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.IO;
// ReSharper disable InconsistentNaming
@@ -29,6 +31,7 @@ public class DnscryptProxyConfiguration : PropertyChangedBase
private int _cert_refresh_delay;
private bool _dnscrypt_ephemeral_keys;
private bool _tls_disable_session_tickets;
+ private bool _log;
private int _log_level;
private string _log_file;
private Dictionary _sources;
@@ -401,6 +404,37 @@ public string netprobe_address
}
}
+ ///
+ /// Enable or disable dnscrypt proxy logging.
+ ///
+ [TomlIgnore]
+ public bool log
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(log_file)) return false;
+ //TODO: make Configurable
+ var logFile = Path.Combine(Directory.GetCurrentDirectory(), Global.LogDirectory, Global.DnsCryptLogFile);
+ return log_file.Equals(logFile);
+ }
+ set
+ {
+ _log = value;
+ if (value)
+ {
+ var logFile = Path.Combine(Directory.GetCurrentDirectory(), Global.LogDirectory, Global.DnsCryptLogFile);
+ _log_level = 0;
+ _log_file = logFile;
+ }
+ else
+ {
+ _log_level = 0;
+ _log_file = null;
+ }
+ NotifyOfPropertyChange(() => log);
+ }
+ }
+
///
/// Log level (0-6, default: 2 - 0 is very verbose, 6 only contains fatal errors).
///
diff --git a/SimpleDnsCrypt/ViewModels/MainViewModel.cs b/SimpleDnsCrypt/ViewModels/MainViewModel.cs
index 220fad9e..3ee503bb 100644
--- a/SimpleDnsCrypt/ViewModels/MainViewModel.cs
+++ b/SimpleDnsCrypt/ViewModels/MainViewModel.cs
@@ -886,7 +886,7 @@ public void OpenLogDirectory()
{
try
{
- var logDirectory = Path.Combine(Directory.GetCurrentDirectory(), "logs");
+ var logDirectory = Path.Combine(Directory.GetCurrentDirectory(), Global.LogDirectory);
if (!Directory.Exists(logDirectory))
{
Directory.CreateDirectory(logDirectory);
diff --git a/SimpleDnsCrypt/Views/MainView.xaml b/SimpleDnsCrypt/Views/MainView.xaml
index a6bd1d7e..1432f36f 100644
--- a/SimpleDnsCrypt/Views/MainView.xaml
+++ b/SimpleDnsCrypt/Views/MainView.xaml
@@ -602,6 +602,7 @@
+
@@ -639,6 +640,8 @@
Grid.Row="0" Grid.Column="1" Cursor="Hand" Content="{lex:Loc Key=address_settings_manage_listen_addresses}" x:Name="ListenAddresses" Margin="0,0,0,5"
HorizontalAlignment="Right" Style="{DynamicResource CustomAccentedSquareButtonStyle}" VerticalAlignment="Top">
+
+
@@ -679,6 +682,8 @@
HorizontalAlignment="Right" VerticalAlignment="Top">
+
+
@@ -719,6 +724,8 @@
HorizontalAlignment="Right" VerticalAlignment="Top">
+
+
@@ -759,6 +766,8 @@
HorizontalAlignment="Right" VerticalAlignment="Top">
+
+
@@ -799,6 +808,8 @@
HorizontalAlignment="Right" VerticalAlignment="Top">
+
+
@@ -851,6 +862,8 @@
+
+
@@ -891,25 +904,50 @@
Opacity="0.8" BorderBrush="#FF575757"
HorizontalAlignment="Right" VerticalAlignment="Top"
TextAlignment="Right"/>
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
- -->
+ Grid.Row="0" Grid.Column="1" Cursor="Hand"
+ IsChecked="{Binding DnscryptProxyConfiguration.log}"
+ HorizontalAlignment="Right" VerticalAlignment="Top">
+
+