├── .editorconfig ├── .github └── workflows │ └── dotnet-desktop.yml ├── .gitignore ├── Contributors.md ├── Directory.Build.props ├── Installer ├── Installer.wixproj ├── License.rtf └── Product.wxs ├── LICENSE.md ├── README.md ├── SimpleDnsCrypt.Utils ├── Base64Url.cs ├── DomainBlacklist.cs ├── Models │ ├── Stamp.cs │ ├── StampFileEntry.cs │ ├── StampProperties.cs │ └── StampProtocol.cs ├── SimpleDnsCrypt.Utils.csproj └── StampTools.cs ├── SimpleDnsCrypt.sln ├── SimpleDnsCrypt ├── App.config ├── App.xaml ├── App.xaml.cs ├── AppBootstrapper.cs ├── AppWindowManager.cs ├── Config │ └── Global.cs ├── Controls │ ├── BaseMetroDialog.xaml │ ├── BaseMetroDialog.xaml.cs │ └── LoggingListView.cs ├── Converters │ ├── BoolToForegroundConverter.cs │ ├── BoolToTextConverter.cs │ ├── BoolToVisibilityCollapsedConverter.cs │ ├── BoolToVisibilityConverter.cs │ ├── EnumToCollectionConverter.cs │ ├── HeightConverter.cs │ ├── InUseToBackgroundConverter.cs │ ├── IntegerBoolToVisibilityConverter.cs │ ├── IntegerToBoolConverter.cs │ ├── IntegerToVisibilityConverter.cs │ ├── InterfaceTypeToIconConverter.cs │ ├── InverseBoolToVisibilityConverter.cs │ ├── LicenseLinkToVisibilityConverter.cs │ ├── LocalDateConverter.cs │ ├── MessageBoxTypeToColor.cs │ ├── ProtocolToVisibilityConverter.cs │ ├── QueryLogReturnCodeToColorConverter.cs │ ├── QueryLogTypeToColorConverter.cs │ ├── ReverseBoolToEnabledConverter.cs │ ├── RouteStateToColorConverter.cs │ ├── ServerListBackgroundConverter.cs │ └── TextLengthToFontSizeConverter.cs ├── Extensions │ ├── ColorConverterExtensions.cs │ ├── ServiceControllerExtensions.cs │ └── WindowManagerExtensions.cs ├── Helper │ ├── DnsCryptProxyManager.cs │ ├── DnscryptProxyConfigurationManager.cs │ ├── EnumHelper.cs │ ├── LocalNetworkInterfaceManager.cs │ ├── LocalizationEx.cs │ ├── LogManagerHelper.cs │ ├── NavigationService.cs │ ├── PatchHelper.cs │ ├── ProcessHelper.cs │ ├── RelayHelper.cs │ ├── UriYamlTypeConverter.cs │ ├── ValidationHelper.cs │ └── VersionHelper.cs ├── Images │ ├── 128x128.png │ └── simplednscrypt.ico ├── LogMode.cs ├── Logger │ └── NLogLogger.cs ├── Models │ ├── AddRuleWindowResult.cs │ ├── AddressBlockLogLine.cs │ ├── AvailableResolver.cs │ ├── BoxType.cs │ ├── DnsServer.cs │ ├── DnscryptProxyConfiguration.cs │ ├── DomainBlockLogLine.cs │ ├── Language.cs │ ├── License.cs │ ├── LocalNetworkInterface.cs │ ├── ProcessResult.cs │ ├── QueryLogLine.cs │ ├── QueryLogLineType.cs │ ├── Rule.cs │ └── ValueDescription.cs ├── NLog.config ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ ├── Settings.settings │ └── app.manifest ├── Resources │ ├── Licenses │ │ ├── Baseclass.Contrib.Nuget.Output.txt │ │ ├── Caliburn.Micro.txt │ │ ├── ControlzEx.txt │ │ ├── Costura.Fody.txt │ │ ├── Fody.txt │ │ ├── Hardcodet.NotifyIcon.txt │ │ ├── MahApps.Metro.SimpleChildWindow.txt │ │ ├── MahApps.Metro.txt │ │ ├── NLog.txt │ │ ├── Nett.txt │ │ ├── Newtonsoft.Json.txt │ │ ├── SimpleDNSCrypt.txt │ │ ├── WPFLocalizationExtension.txt │ │ ├── XAMLMarkupExtensions.txt │ │ ├── YamlDotNet.txt │ │ ├── dnscrypt-proxy.txt │ │ ├── gong-wpf-dragdrop.txt │ │ ├── helper-net.txt │ │ ├── libsodium-net.txt │ │ └── minisign-net.txt │ ├── ResourceDictionaries │ │ └── ResourceLibrary.xaml │ ├── Translation.Designer.cs │ ├── Translation.ar.resx │ ├── Translation.bg.resx │ ├── Translation.cs.resx │ ├── Translation.da.resx │ ├── Translation.de.resx │ ├── Translation.el.resx │ ├── Translation.en.resx │ ├── Translation.es.resx │ ├── Translation.fa.resx │ ├── Translation.fi.resx │ ├── Translation.fil.resx │ ├── Translation.fr.resx │ ├── Translation.he.resx │ ├── Translation.hu.resx │ ├── Translation.id.resx │ ├── Translation.it.resx │ ├── Translation.ja.resx │ ├── Translation.ko.resx │ ├── Translation.ms.resx │ ├── Translation.nl.resx │ ├── Translation.pl.resx │ ├── Translation.pt-br.resx │ ├── Translation.pt.resx │ ├── Translation.resx │ ├── Translation.ro.resx │ ├── Translation.ru.resx │ ├── Translation.sl.resx │ ├── Translation.sv.resx │ ├── Translation.tgl.resx │ ├── Translation.th.resx │ ├── Translation.tr.resx │ ├── Translation.uk.resx │ ├── Translation.vi.resx │ ├── Translation.zh-hans.resx │ └── Translation.zh-hant.resx ├── SimpleDnsCrypt.csproj ├── Styles │ ├── CustomAccentedSquareButtonStyle.xaml │ ├── CustomMetroListBoxItem.xaml │ ├── HyperLink.xaml │ ├── HyperlinkButton.xaml │ ├── LinkHeaderStyle.xaml │ └── ModalStyle.xaml ├── ViewModels │ ├── AboutViewModel.cs │ ├── AddCustomResolverViewModel.cs │ ├── AddressBlacklistViewModel.cs │ ├── AddressBlockLogViewModel.cs │ ├── CloakAndForwardViewModel.cs │ ├── DomainBlacklistViewModel.cs │ ├── DomainBlockLogViewModel.cs │ ├── FallbackResolversViewModel.cs │ ├── ListenAddressesViewModel.cs │ ├── LoaderViewModel.cs │ ├── MainViewModel.cs │ ├── MetroMessageBoxViewModel.cs │ ├── ProxiesViewModel.cs │ ├── QueryLogViewModel.cs │ ├── RouteViewModel.cs │ ├── SettingsViewModel.cs │ └── SystemTrayViewModel.cs ├── Views │ ├── AboutView.xaml │ ├── AddCustomResolverView.xaml │ ├── FallbackResolversView.xaml │ ├── ListenAddressesView.xaml │ ├── LoaderView.xaml │ ├── MainView.xaml │ ├── MetroMessageBoxView.xaml │ ├── ProxiesView.xaml │ ├── RouteView.xaml │ ├── SettingsView.xaml │ └── SystemTrayView.xaml ├── Windows │ ├── AddRuleWindow.xaml │ ├── AddRuleWindow.xaml.cs │ ├── BaseDialogWindow.xaml │ ├── BaseDialogWindow.xaml.cs │ ├── BaseMessageDialogWindow.xaml │ ├── BaseMessageDialogWindow.xaml.cs │ ├── BaseTrayWindow.xaml │ ├── BaseTrayWindow.xaml.cs │ ├── BaseWindow.xaml │ ├── BaseWindow.xaml.cs │ ├── SplashDialogWindow.xaml │ └── SplashDialogWindow.xaml.cs └── dnscrypt-proxy │ ├── LICENSE │ ├── dnscrypt-proxy.toml.example │ ├── dnscrypt-proxy64.exe │ └── dnscrypt-proxy86.exe ├── Tests ├── StampDecodeTests.cs ├── StampEncodeTests.cs └── Tests.csproj ├── Uninstall ├── Program.cs ├── Properties │ └── app.manifest ├── Uninstall.csproj └── simplednscrypt.ico └── img ├── icons ├── 128x128.png ├── 16x16.png ├── 24x24.png ├── 256x256.png ├── 32x32.png ├── 48x48.png ├── 64x64.png └── 96x96.png ├── logo_with_text.png ├── old ├── about.png ├── advanced.png ├── analyse.png ├── blacklist.png ├── livelog.png ├── livelog_modal.png ├── plugins.png └── standard.png ├── preview ├── advancedsettings.png ├── blacklist.png ├── blocklog.png ├── custom_resolver.png ├── mainmenu.png ├── resolvers.png └── settings.png └── simplednscrypt_256.png /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.cs] 2 | indent_style = space 3 | indent_size = 4 4 | csharp_style_var_elsewhere = true 5 | csharp_style_var_for_built_in_types = true 6 | csharp_style_var_when_type_is_apparent = true 7 | csharp_prefer_braces = false -------------------------------------------------------------------------------- /.github/workflows/dotnet-desktop.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | 6 | # This workflow will build, test, sign and package a WPF or Windows Forms desktop application 7 | # built on .NET Core. 8 | # To learn how to migrate your existing application to .NET Core, 9 | # refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework 10 | # 11 | # To configure this workflow: 12 | # 13 | # 1. Configure environment variables 14 | # GitHub sets default environment variables for every workflow run. 15 | # Replace the variables relative to your project in the "env" section below. 16 | # 17 | # 2. Signing 18 | # Generate a signing certificate in the Windows Application 19 | # Packaging Project or add an existing signing certificate to the project. 20 | # Next, use PowerShell to encode the .pfx file using Base64 encoding 21 | # by running the following Powershell script to generate the output string: 22 | # 23 | # $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte 24 | # [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt' 25 | # 26 | # Open the output file, SigningCertificate_Encoded.txt, and copy the 27 | # string inside. Then, add the string to the repo as a GitHub secret 28 | # and name it "Base64_Encoded_Pfx." 29 | # For more information on how to configure your signing certificate for 30 | # this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing 31 | # 32 | # Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key". 33 | # See "Build the Windows Application Packaging project" below to see how the secret is used. 34 | # 35 | # For more information on GitHub Actions, refer to https://github.com/features/actions 36 | # For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications, 37 | # refer to https://github.com/microsoft/github-actions-for-desktop-apps 38 | 39 | name: .NET Core Desktop 40 | 41 | on: 42 | push: 43 | branches: [ master ] 44 | pull_request: 45 | branches: [ master ] 46 | workflow_dispatch: 47 | 48 | jobs: 49 | 50 | build: 51 | 52 | strategy: 53 | matrix: 54 | configuration: [Release] 55 | 56 | runs-on: windows-latest # For a list of available runner types, refer to 57 | # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on 58 | 59 | steps: 60 | - name: Checkout 61 | uses: actions/checkout@v3 62 | with: 63 | fetch-depth: 0 64 | 65 | # Install the .NET workload 66 | - name: Install .NET 67 | uses: actions/setup-dotnet@v3 68 | with: 69 | dotnet-version: 8.0.x 70 | 71 | # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild 72 | - name: Setup MSBuild.exe 73 | uses: microsoft/setup-msbuild@v1.3 74 | 75 | # Execute all unit tests in the solution 76 | #- name: Execute unit tests 77 | # run: dotnet test 78 | 79 | # Restore the application to populate the obj folder with RuntimeIdentifiers 80 | - name: Restore the application 81 | run: msbuild SimpleDnsCrypt.sln /t:Restore /p:Configuration=$env:Configuration 82 | env: 83 | Configuration: ${{ matrix.configuration }} 84 | 85 | # Create the app package by building and packaging the Windows Application Packaging project 86 | - name: Create the app package 87 | run: msbuild Installer\Installer.wixproj /p:OutputPath=build /p:Configuration=$env:Configuration 88 | env: 89 | Configuration: ${{ matrix.configuration }} 90 | 91 | # Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact 92 | - name: Upload build artifacts 93 | uses: actions/upload-artifact@v3 94 | with: 95 | name: MSI Installer (${{ matrix.configuration }}) 96 | path: Installer\build 97 | -------------------------------------------------------------------------------- /Contributors.md: -------------------------------------------------------------------------------- 1 | # Contributors # 2 | 3 | Those listed below have contributed to `SimpleDnsCrypt`, and are the copyright holders. See the `LICENSE.md` file for details. Contributors are listed in chronological order: 4 | 5 | * @bitbeans - Christian Hermann 6 | * @christantoan 7 | * @tuphamnguyen 8 | * @thedroidgeek 9 | * @didihu 10 | * @jerryhou85 11 | * @rugk - 12 | * Vlad - 13 | * @emirgian 14 | * @bcien 15 | * @eson57 16 | * @simonclausen 17 | * @ShellAddicted 18 | * @robin98 19 | * @pablomh 20 | * @rddim 21 | * @porsche613 22 | * @socrat3z 23 | * @niikoo 24 | * @bungoume 25 | * Esmail EL BoB - 26 | * @ukind 27 | * @Mongogamer 28 | * @Celonfix - 29 | * @instant.sc -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | $(MSBuildProjectDirectory)=$(MSBuildProjectName) 4 | 5 | -------------------------------------------------------------------------------- /Installer/Installer.wixproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | x64 6 | 3.10 7 | b2c887e0-6f49-4ce9-bf0a-f87873da80b9 8 | 2.0 9 | SimpleDnsCrypt 10 | Package 11 | 12 | 13 | Debug 14 | 15 | 16 | bin\$(Configuration)\ 17 | obj\$(Configuration)\ 18 | false 19 | ..\publish\exe 20 | BasePath=..\publish\exe 21 | false 22 | true 23 | 24 | 25 | 26 | 27 | INSTALLFOLDER 28 | SimpleDNSCrypt_Project 29 | true 30 | true 31 | true 32 | var.BasePath 33 | 34 | 35 | $(WixExtDir)WixUIExtension.dll 36 | WixUIExtension 37 | 38 | 39 | $(WixExtDir)WixUtilExtension.dll 40 | WixUtilExtension 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Installer/License.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}} 2 | {\*\generator Riched20 10.0.17763}\viewkind4\uc1 3 | \pard\sa200\sl276\slmult1\fs22\lang9 The MIT License (MIT)\par 4 | Copyright (c) 2015 - 2020 Christian Hermann & Contributors\par 5 | Copyright (c) 2021 - 2023 instant.sc & Contributors\par 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\par 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\par 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\par 9 | } 10 | -------------------------------------------------------------------------------- /Installer/Product.wxs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | NOT UPGRADINGPRODUCTCODE 22 | NOT UPGRADINGPRODUCTCODE and REMOVE="ALL" 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 - 2020 Christian Hermann & Contributors 4 | Copyright (c) 2021 - 2022 instant.sc & Contributors 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![license](https://img.shields.io/github/license/instantsc/SimpleDnsCrypt.svg?style=flat-square)](https://github.com/instantsc/SimpleDnsCrypt/blob/master/LICENSE.md) 2 | [![Github All Releases](https://img.shields.io/github/release/instantsc/SimpleDnsCrypt.svg?style=flat-square&include_prereleases)](https://github.com/instantsc/SimpleDnsCrypt/releases/latest) 3 | [![dnscrypt--proxy](https://img.shields.io/badge/dnscrypt--proxy-2.1.5-orange.svg?style=flat-square)](https://github.com/jedisct1/dnscrypt-proxy) 4 | [![Github All Releases](https://img.shields.io/github/downloads/instantsc/SimpleDnsCrypt/total.svg?style=flat-square)](https://github.com/instantsc/SimpleDnsCrypt/releases/latest) 5 | 6 | 7 | # ![Simple DNSCrypt Logo](img/logo_with_text.png) 8 | 9 | # Fork 10 | This was forked from [here](https://github.com/bitbeans/SimpleDnsCrypt) due to inactivity. I was able to fix a few things that were bugging me and see no reason not to share. 11 | 12 | Note that this repository has **no** connection to OpenCollective or any other form of funding. 13 | 14 | This is not a drop-in replacement in a sense that you will have to migrate your settings yourself, although the files themselves (if you copy them) should be fairly compatible. 15 | 16 | # Simple DNSCrypt 17 | Simple DNSCrypt is a simple management tool to configure [dnscrypt-proxy](https://github.com/jedisct1/dnscrypt-proxy) on windows based systems. 18 | 19 | ## Status 20 | 21 | Uses dnscrypt-proxy: **2.1.5** 22 | 23 | 24 | ## Getting Started 25 | 26 | 27 | ### Prerequisites 28 | 29 | Windows 10 LTSC 21H2 is tested(-ish) to work, other users are welcome to test and report other Windows versions. 30 | 31 | ### Installing 32 | 33 | To install Simple DNSCrypt use the [MSI package](https://github.com/instantsc/SimpleDnsCrypt/releases/latest). 34 | 35 | ### Deinstallation 36 | 37 | To uninstall Simple DNSCrypt and dnscrypt-proxy, just go to the Windows Control Panel (Programs and Features) and search for Simple DNSCrypt. 38 | 39 | ### Updates 40 | 41 | For now, the only update option is to download and install the newest version manually. Note that in .NET the setting storage is tied to the binary location, and so you'll either have to migrate manually or to install update to the same location as before. 42 | 43 | ## Screenshots 44 | 45 | ![maintab](img/preview/mainmenu.png) 46 | 47 | ![maintab](img/preview/custom_resolver.png) 48 | 49 |
50 | More 51 | 52 | ![resolvers](img/preview/resolvers.png) 53 | 54 | ![advanced](img/preview/advancedsettings.png) 55 | 56 | ![blacklist](img/preview/blacklist.png) 57 | 58 | ![blocklog](img/preview/blocklog.png) 59 | 60 | ![settings](img/preview/settings.png) 61 |
62 | 63 | 64 | ## Built With 65 | 66 | * [Visual Studio 2022](https://www.visualstudio.com/downloads/) 67 | * [.NET 7](https://dotnet.microsoft.com/download/dotnet) 68 | * [WiX](https://wixtoolset.org/) 69 | 70 | ## Authors 71 | 72 | * **Christian Hermann** - [bitbeans](https://github.com/bitbeans) 73 | * [**instant.sc**](https://github.com/instantsc) 74 | 75 | See also the list of [Contributors.md](Contributors.md) who participated in this project. 76 | If you are a translator, feel free to update this file. 77 | 78 | ## License 79 | 80 | This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details 81 | 82 | ## Used Software and Libraries 83 | 84 | - [Caliburn.Micro](https://github.com/Caliburn-Micro/Caliburn.Micro) 85 | - [DnsCrypt.Toolbox](https://github.com/bitbeans/DnsCrypt.Toolbox) 86 | - [gong-wpf-dragdrop](https://github.com/punker76/gong-wpf-dragdrop) 87 | - [MahApps.Metro](https://github.com/MahApps/MahApps.Metro) 88 | - [MahApps.Metro.SimpleChildWindow](https://github.com/punker76/MahApps.Metro.SimpleChildWindow) 89 | - [Nett](https://github.com/paiden/Nett) 90 | - [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) 91 | - [NLog](https://github.com/nlog/NLog) 92 | - [notifyicon-wpf](https://bitbucket.org/hardcodet/notifyicon-wpf/src) 93 | - [WPFLocalizationExtension](https://github.com/SeriousM/WPFLocalizationExtension) 94 | - [YamlDotNet](https://github.com/aaubry/YamlDotNet) 95 | 96 | 97 | ## Thanks to 98 | 99 | * Frank Denis for the development of [dnscrypt-proxy](https://github.com/jedisct1/dnscrypt-proxy) 100 | * all users, translators and contributors 101 | 102 | ### Contributors 103 | 104 | This project exists thanks to all the people who contribute. [[Contributors](Contributors.md)]. -------------------------------------------------------------------------------- /SimpleDnsCrypt.Utils/Base64Url.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SimpleDnsCrypt.Utils 4 | { 5 | /// 6 | /// source: https://gist.github.com/igorushko/cccef0561aea7e46ae52bc62270b2b61 7 | /// 8 | public static class Base64Url 9 | { 10 | public static string Encode(byte[] arg) 11 | { 12 | if (arg == null) throw new ArgumentNullException(nameof(arg)); 13 | 14 | var s = Convert.ToBase64String(arg); 15 | return s 16 | .Replace("=", "") 17 | .Replace("/", "_") 18 | .Replace("+", "-"); 19 | } 20 | 21 | public static string ToBase64(string arg) 22 | { 23 | if (arg == null) throw new ArgumentNullException(nameof(arg)); 24 | var lastQuadCount = arg.Length % 4; 25 | if (lastQuadCount == 1) 26 | { 27 | throw new Exception("Invalid base64 string: the last four-character block cannot consist of only one character"); 28 | } 29 | 30 | var s = arg 31 | .PadRight(arg.Length + (4 - lastQuadCount) % 4, '=') 32 | .Replace("_", "/") 33 | .Replace("-", "+"); 34 | 35 | return s; 36 | } 37 | 38 | public static byte[] Decode(string arg) 39 | { 40 | var decrypted = ToBase64(arg); 41 | 42 | return Convert.FromBase64String(decrypted); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /SimpleDnsCrypt.Utils/Models/Stamp.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SimpleDnsCrypt.Utils.Models 4 | { 5 | public class Stamp 6 | { 7 | public StampProtocol Protocol { get; set; } 8 | public StampProperties Properties { get; set; } 9 | public string Address { get; set; } 10 | public string PublicKey { get; set; } 11 | public string ProviderName { get; set; } 12 | public string Hash { get; set; } 13 | public string Hostname { get; set; } 14 | public string Path { get; set; } 15 | public int Port { get; set; } 16 | 17 | public IEnumerable ValidationIssues 18 | { 19 | get 20 | { 21 | if (Protocol == StampProtocol.DnsCrypt) 22 | { 23 | if (string.IsNullOrEmpty(Address)) 24 | { 25 | yield return "Empty address"; 26 | } 27 | 28 | if (string.IsNullOrEmpty(PublicKey)) 29 | { 30 | yield return "Empty public key"; 31 | } 32 | 33 | yield break; 34 | } 35 | 36 | if (Protocol == StampProtocol.DoH) 37 | { 38 | if (string.IsNullOrEmpty(Hash)) 39 | { 40 | yield return "Empty hash"; 41 | } 42 | 43 | if (string.IsNullOrEmpty(Hostname)) 44 | { 45 | yield return "Empty hostname"; 46 | } 47 | 48 | yield break; 49 | } 50 | 51 | if (Protocol == StampProtocol.DNSCryptRelay) 52 | { 53 | yield break; 54 | } 55 | 56 | yield return $"Unsupported protocol {Protocol}. For now, only {nameof(StampProtocol.DnsCrypt)}, " + 57 | $"{nameof(StampProtocol.DoH)} and {StampProtocol.DNSCryptRelay} are supported"; 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /SimpleDnsCrypt.Utils/Models/StampFileEntry.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleDnsCrypt.Utils.Models 2 | { 3 | public class StampFileEntry 4 | { 5 | public string Name { get; set; } 6 | public string Description { get; set; } 7 | public Stamp Stamp { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /SimpleDnsCrypt.Utils/Models/StampProperties.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleDnsCrypt.Utils.Models 2 | { 3 | public class StampProperties 4 | { 5 | public bool DnsSec { get; set; } 6 | public bool NoLog { get; set; } 7 | public bool NoFilter { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /SimpleDnsCrypt.Utils/Models/StampProtocol.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleDnsCrypt.Utils.Models 2 | { 3 | public enum StampProtocol 4 | { 5 | Plain, 6 | DnsCrypt, 7 | DoH, 8 | TLS, 9 | DNSCryptRelay, 10 | Unknown 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /SimpleDnsCrypt.Utils/SimpleDnsCrypt.Utils.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8-windows10.0.19041 4 | 5 | -------------------------------------------------------------------------------- /SimpleDnsCrypt.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.3.32901.215 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleDnsCrypt", "SimpleDnsCrypt\SimpleDnsCrypt.csproj", "{3B555A42-C19F-405D-A983-6D3B95E65265}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uninstall", "Uninstall\Uninstall.csproj", "{1A9CA4FE-BDD5-4D7C-A86A-7ED503974718}" 9 | EndProject 10 | Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Installer", "Installer\Installer.wixproj", "{B2C887E0-6F49-4CE9-BF0A-F87873DA80B9}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{209C4925-B294-4129-9A4B-C2798E2E3B40}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleDnsCrypt.Utils", "SimpleDnsCrypt.Utils\SimpleDnsCrypt.Utils.csproj", "{A0B2D0DB-BF16-4C71-9069-48F911A131D0}" 15 | EndProject 16 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39B27D6F-CBE4-46C6-A0FF-0A1A3B4A51B8}" 17 | ProjectSection(SolutionItems) = preProject 18 | Directory.Build.props = Directory.Build.props 19 | EndProjectSection 20 | EndProject 21 | Global 22 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 23 | Debug|Any CPU = Debug|Any CPU 24 | Release|Any CPU = Release|Any CPU 25 | EndGlobalSection 26 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 27 | {3B555A42-C19F-405D-A983-6D3B95E65265}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 28 | {3B555A42-C19F-405D-A983-6D3B95E65265}.Debug|Any CPU.Build.0 = Debug|Any CPU 29 | {3B555A42-C19F-405D-A983-6D3B95E65265}.Release|Any CPU.ActiveCfg = Release|Any CPU 30 | {3B555A42-C19F-405D-A983-6D3B95E65265}.Release|Any CPU.Build.0 = Release|Any CPU 31 | {1A9CA4FE-BDD5-4D7C-A86A-7ED503974718}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 32 | {1A9CA4FE-BDD5-4D7C-A86A-7ED503974718}.Debug|Any CPU.Build.0 = Debug|Any CPU 33 | {1A9CA4FE-BDD5-4D7C-A86A-7ED503974718}.Release|Any CPU.ActiveCfg = Release|Any CPU 34 | {1A9CA4FE-BDD5-4D7C-A86A-7ED503974718}.Release|Any CPU.Build.0 = Release|Any CPU 35 | {B2C887E0-6F49-4CE9-BF0A-F87873DA80B9}.Debug|Any CPU.ActiveCfg = Debug|x64 36 | {B2C887E0-6F49-4CE9-BF0A-F87873DA80B9}.Release|Any CPU.ActiveCfg = Release|x64 37 | {209C4925-B294-4129-9A4B-C2798E2E3B40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 38 | {209C4925-B294-4129-9A4B-C2798E2E3B40}.Debug|Any CPU.Build.0 = Debug|Any CPU 39 | {209C4925-B294-4129-9A4B-C2798E2E3B40}.Release|Any CPU.ActiveCfg = Release|Any CPU 40 | {209C4925-B294-4129-9A4B-C2798E2E3B40}.Release|Any CPU.Build.0 = Release|Any CPU 41 | {A0B2D0DB-BF16-4C71-9069-48F911A131D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 42 | {A0B2D0DB-BF16-4C71-9069-48F911A131D0}.Debug|Any CPU.Build.0 = Debug|Any CPU 43 | {A0B2D0DB-BF16-4C71-9069-48F911A131D0}.Release|Any CPU.ActiveCfg = Release|Any CPU 44 | {A0B2D0DB-BF16-4C71-9069-48F911A131D0}.Release|Any CPU.Build.0 = Release|Any CPU 45 | EndGlobalSection 46 | GlobalSection(SolutionProperties) = preSolution 47 | HideSolutionNode = FALSE 48 | EndGlobalSection 49 | GlobalSection(ExtensibilityGlobals) = postSolution 50 | SolutionGuid = {001A38DB-C5C4-459D-B91B-946FA300F63C} 51 | EndGlobalSection 52 | EndGlobal 53 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | True 13 | 14 | 15 | False 16 | 17 | 18 | False 19 | 20 | 21 | False 22 | 23 | 24 | False 25 | 26 | 27 | True 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | True 46 | 47 | 48 | False 49 | 50 | 51 | True 52 | 53 | 54 | 55 | 56 | 57 | False 58 | 59 | 60 | 61 | 62 | 63 | 825 64 | 65 | 66 | 875 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace SimpleDnsCrypt 4 | { 5 | public partial class App : Application 6 | { 7 | public App() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/AppBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Threading; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel.Composition; 5 | using System.ComponentModel.Composition.Hosting; 6 | using System.ComponentModel.Composition.Primitives; 7 | using System.Linq; 8 | using System.Threading; 9 | using System.Windows; 10 | using Caliburn.Micro; 11 | using SimpleDnsCrypt.Helper; 12 | using SimpleDnsCrypt.Logger; 13 | using SimpleDnsCrypt.ViewModels; 14 | using System.IO; 15 | using System.Reflection; 16 | 17 | namespace SimpleDnsCrypt 18 | { 19 | public class AppBootstrapper : BootstrapperBase 20 | { 21 | private CompositionContainer _container; 22 | private static readonly ILog Log = LogManagerHelper.Factory(); 23 | private static Mutex _mutex; 24 | 25 | public AppBootstrapper() 26 | { 27 | LogManager.GetLog = type => new NLogLogger(type); 28 | Initialize(); 29 | } 30 | 31 | protected override void Configure() 32 | { 33 | try 34 | { 35 | _container = new CompositionContainer( 36 | new AggregateCatalog(AssemblySource.Instance.Select(x => new AssemblyCatalog(x)) 37 | .OfType()) 38 | ); 39 | var batch = new CompositionBatch(); 40 | batch.AddExportedValue(new AppWindowManager()); 41 | batch.AddExportedValue(new EventAggregator()); 42 | batch.AddExportedValue(_container); 43 | _container.Compose(batch); 44 | } 45 | catch (Exception exception) 46 | { 47 | Log.Error(exception); 48 | } 49 | } 50 | 51 | protected override object GetInstance(Type service, string key) 52 | { 53 | var contract = string.IsNullOrEmpty(key) ? AttributedModelServices.GetContractName(service) : key; 54 | var exports = _container.GetExportedValues(contract); 55 | 56 | return exports.FirstOrDefault() ?? throw new Exception($"Could not locate any instances of contract {contract}."); 57 | } 58 | 59 | protected override IEnumerable GetAllInstances(Type service) 60 | { 61 | return _container.GetExportedValues(AttributedModelServices.GetContractName(service)); 62 | } 63 | 64 | protected override void BuildUp(object instance) 65 | { 66 | _container.SatisfyImportsOnce(instance); 67 | } 68 | 69 | protected override void OnStartup(object sender, StartupEventArgs e) 70 | { 71 | try 72 | { 73 | // set the working directory 74 | Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); 75 | 76 | // prevent multiple instances 77 | const string appName = "SimpleDnsCrypt"; 78 | _mutex = new Mutex(true, appName, out var createdNew); 79 | 80 | if (!createdNew) 81 | { 82 | Application.Current.Shutdown(); 83 | } 84 | 85 | if (e.Args is ["-debug"]) 86 | { 87 | LogMode.Debug = true; 88 | } 89 | 90 | var loader = _container.GetExportedValue(); 91 | var windowManager = IoC.Get(); 92 | windowManager.ShowDialogAsync(loader); 93 | } 94 | catch (Exception exception) 95 | { 96 | Log.Error(exception); 97 | } 98 | } 99 | 100 | protected override void OnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) 101 | { 102 | Log.Error(e.Exception); 103 | Execute.OnUIThread(() => MessageBox.Show( 104 | "There was an UnhandledException. Check the log entries for further information.", 105 | "Error", MessageBoxButton.OK, MessageBoxImage.Error)); 106 | } 107 | } 108 | } -------------------------------------------------------------------------------- /SimpleDnsCrypt/AppWindowManager.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | using SimpleDnsCrypt.ViewModels; 3 | using SimpleDnsCrypt.Windows; 4 | using System.Windows; 5 | 6 | namespace SimpleDnsCrypt 7 | { 8 | /// 9 | /// Provides a window manager for the application 10 | /// 11 | public class AppWindowManager : WindowManager 12 | { 13 | /// 14 | /// Selects a base window depending on the view, model and dialog options 15 | /// 16 | /// The model 17 | /// The view 18 | /// Whether it's a dialog 19 | /// The proper window 20 | protected override Window EnsureWindow(object model, object view, bool isDialog) 21 | { 22 | Window window = view as BaseWindow; 23 | 24 | if (window == null) 25 | { 26 | if (isDialog) 27 | { 28 | if (model.GetType() == typeof(LoaderViewModel)) 29 | { 30 | window = new SplashDialogWindow 31 | { 32 | Content = view, 33 | SizeToContent = SizeToContent.WidthAndHeight 34 | }; 35 | } 36 | else if (model.GetType() == typeof(MetroMessageBoxViewModel)) 37 | { 38 | window = new BaseMessageDialogWindow 39 | { 40 | Content = view, 41 | SizeToContent = SizeToContent.WidthAndHeight 42 | }; 43 | } 44 | else 45 | { 46 | window = new BaseDialogWindow 47 | { 48 | Content = view, 49 | SizeToContent = SizeToContent.WidthAndHeight 50 | }; 51 | } 52 | } 53 | else 54 | { 55 | if (model.GetType() == typeof(SystemTrayViewModel)) 56 | { 57 | window = new BaseTrayWindow 58 | { 59 | Content = view, 60 | ResizeMode = ResizeMode.NoResize, 61 | SizeToContent = SizeToContent.Manual 62 | }; 63 | } 64 | else 65 | { 66 | window = new BaseWindow 67 | { 68 | Content = view, 69 | ResizeMode = ResizeMode.CanResizeWithGrip, 70 | SizeToContent = SizeToContent.Manual 71 | }; 72 | } 73 | } 74 | window.SetValue(View.IsGeneratedProperty, true); 75 | } 76 | else 77 | { 78 | Window owner = InferOwnerOf(window); 79 | if (owner != null && isDialog) 80 | { 81 | window.Owner = owner; 82 | } 83 | } 84 | 85 | return window; 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Controls/BaseMetroDialog.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 23 | 29 | 30 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Controls/BaseMetroDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleDnsCrypt.Controls 2 | { 3 | public partial class BaseMetroDialog 4 | { 5 | public BaseMetroDialog() 6 | { 7 | InitializeComponent(); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/BoolToForegroundConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace SimpleDnsCrypt.Converters 6 | { 7 | public class BoolToForegroundConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 10 | { 11 | if ((bool)value) 12 | { 13 | return "#FF8ab329"; 14 | } 15 | 16 | return "#FFFF8C00"; 17 | } 18 | 19 | public object ConvertBack(object value, Type targetTypes, object parameter, CultureInfo culture) 20 | { 21 | throw new NotImplementedException(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/BoolToTextConverter.cs: -------------------------------------------------------------------------------- 1 | using SimpleDnsCrypt.Helper; 2 | using System; 3 | using System.Globalization; 4 | using System.Threading; 5 | using System.Windows.Data; 6 | 7 | namespace SimpleDnsCrypt.Converters 8 | { 9 | public class BoolToTextConverter : IValueConverter 10 | { 11 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 12 | { 13 | if ((bool)value) 14 | { 15 | return LocalizationEx.GetUiString("yes", Thread.CurrentThread.CurrentCulture); 16 | } 17 | 18 | return LocalizationEx.GetUiString("no", Thread.CurrentThread.CurrentCulture); 19 | } 20 | 21 | public object ConvertBack(object value, Type targetTypes, object parameter, CultureInfo culture) 22 | { 23 | throw new NotImplementedException(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/BoolToVisibilityCollapsedConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace SimpleDnsCrypt.Converters 7 | { 8 | public class BoolToVisibilityCollapsedConverter : IValueConverter 9 | { 10 | public static readonly BoolToVisibilityCollapsedConverter Instance = new BoolToVisibilityCollapsedConverter(); 11 | 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | try 15 | { 16 | return (bool)value ? Visibility.Visible : Visibility.Collapsed; 17 | } 18 | catch 19 | { 20 | return Visibility.Collapsed; 21 | } 22 | } 23 | 24 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 25 | { 26 | var visibility = (Visibility)value; 27 | return visibility == Visibility.Visible; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/BoolToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace SimpleDnsCrypt.Converters 7 | { 8 | /// 9 | /// Boolean to visibility converter. 10 | /// 11 | public class BoolToVisibilityConverter : IValueConverter 12 | { 13 | public static readonly BoolToVisibilityConverter Instance = new BoolToVisibilityConverter(); 14 | 15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 16 | { 17 | try 18 | { 19 | return (bool)value ? Visibility.Visible : Visibility.Hidden; 20 | } 21 | catch 22 | { 23 | return Visibility.Visible; 24 | } 25 | } 26 | 27 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 28 | { 29 | throw new NotImplementedException(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/EnumToCollectionConverter.cs: -------------------------------------------------------------------------------- 1 | using SimpleDnsCrypt.Helper; 2 | using SimpleDnsCrypt.Models; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Globalization; 6 | using System.Windows.Data; 7 | using System.Windows.Markup; 8 | 9 | namespace SimpleDnsCrypt.Converters 10 | { 11 | [ValueConversion(typeof(Enum), typeof(IEnumerable))] 12 | public class EnumToCollectionConverter : MarkupExtension, IValueConverter 13 | { 14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | return EnumHelper.GetAllValuesAndDescriptions(value.GetType()); 17 | } 18 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 19 | { 20 | return null; 21 | } 22 | public override object ProvideValue(IServiceProvider serviceProvider) 23 | { 24 | return this; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/HeightConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace SimpleDnsCrypt.Converters 6 | { 7 | public class HeightConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 10 | { 11 | try 12 | { 13 | var actualHeight = (double)value; 14 | if (actualHeight > 700) 15 | { 16 | switch ((string)parameter) 17 | { 18 | case "Resolvers": 19 | return actualHeight - 400; 20 | case "QueryLog": 21 | return actualHeight - 200; 22 | case "DomainBlockLog": 23 | return actualHeight - 200; 24 | default: 25 | return actualHeight - 200; 26 | } 27 | } 28 | return actualHeight; 29 | } 30 | catch 31 | { 32 | return 0; 33 | } 34 | } 35 | 36 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 37 | { 38 | throw new NotImplementedException(); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/InUseToBackgroundConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Net.NetworkInformation; 4 | using System.Windows.Data; 5 | using SimpleDnsCrypt.Models; 6 | 7 | namespace SimpleDnsCrypt.Converters 8 | { 9 | /// 10 | /// LocalNetworkInterface to color converter. 11 | /// 12 | public class InUseToBackgroundConverter : IValueConverter 13 | { 14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | var localNetworkInterface = (LocalNetworkInterface)value; 17 | 18 | if (localNetworkInterface != null && localNetworkInterface.OperationalStatus != OperationalStatus.Up) 19 | { 20 | // red 21 | return "#CCC1170F"; 22 | } 23 | 24 | if (localNetworkInterface != null && localNetworkInterface.UseDnsCrypt) 25 | { 26 | // green 27 | return "#FF8ab329"; 28 | } 29 | 30 | // gray 31 | return "#FFA0A0A0"; 32 | } 33 | 34 | public object ConvertBack(object value, Type targetTypes, object parameter, CultureInfo culture) 35 | { 36 | throw new NotImplementedException(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/IntegerBoolToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace SimpleDnsCrypt.Converters 7 | { 8 | public class IntegerBoolToVisibilityConverter : IMultiValueConverter 9 | { 10 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | var integerValue = (int)values[0]; 13 | var boolValue = (bool)values[1]; 14 | if (integerValue == 0 && boolValue) 15 | { 16 | return Visibility.Visible; 17 | } 18 | return Visibility.Collapsed; 19 | } 20 | 21 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 22 | { 23 | throw new NotImplementedException(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/IntegerToBoolConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace SimpleDnsCrypt.Converters 6 | { 7 | public class IntegerToBoolConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 10 | { 11 | try 12 | { 13 | return (int)value > 0; 14 | } 15 | catch 16 | { 17 | return false; 18 | } 19 | } 20 | 21 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | throw new NotImplementedException(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/IntegerToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace SimpleDnsCrypt.Converters 7 | { 8 | public class IntegerToVisibilityConverter : IValueConverter 9 | { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | try 13 | { 14 | return (int)value > 0 ? Visibility.Collapsed : Visibility.Visible; 15 | } 16 | catch 17 | { 18 | return Visibility.Collapsed; 19 | } 20 | } 21 | 22 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | throw new NotImplementedException(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/InterfaceTypeToIconConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Net.NetworkInformation; 4 | using System.Windows.Data; 5 | using SimpleDnsCrypt.Models; 6 | 7 | namespace SimpleDnsCrypt.Converters 8 | { 9 | /// 10 | /// Interface to icon converter. 11 | /// 12 | public class InterfaceTypeToIconConverter : IValueConverter 13 | { 14 | public object EthernetIconOffline { get; set; } 15 | public object EthernetIcon { get; set; } 16 | public object WifiIcon { get; set; } 17 | public object WifiIconOffline { get; set; } 18 | 19 | 20 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 21 | { 22 | try 23 | { 24 | var localNetworkInterface = (LocalNetworkInterface)value; 25 | bool isCable; 26 | switch (localNetworkInterface.Type) 27 | { 28 | case NetworkInterfaceType.Ethernet: 29 | case NetworkInterfaceType.Ethernet3Megabit: 30 | case NetworkInterfaceType.FastEthernetFx: 31 | case NetworkInterfaceType.FastEthernetT: 32 | case NetworkInterfaceType.GigabitEthernet: 33 | isCable = true; 34 | break; 35 | case NetworkInterfaceType.Wireless80211: 36 | isCable = false; 37 | break; 38 | default: 39 | isCable = true; 40 | break; 41 | } 42 | 43 | if (isCable) 44 | { 45 | return localNetworkInterface.OperationalStatus != OperationalStatus.Up ? EthernetIconOffline : EthernetIcon; 46 | } 47 | return localNetworkInterface.OperationalStatus != OperationalStatus.Up ? WifiIconOffline : WifiIcon; 48 | } 49 | catch (Exception) 50 | { 51 | return EthernetIcon; 52 | } 53 | } 54 | 55 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 56 | { 57 | throw new NotImplementedException(); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/InverseBoolToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace SimpleDnsCrypt.Converters; 7 | 8 | /// 9 | /// Boolean to visibility converter. 10 | /// 11 | public class InverseBoolToVisibilityConverter : IValueConverter 12 | { 13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | try 16 | { 17 | return (bool)value ? Visibility.Hidden : Visibility.Visible; 18 | } 19 | catch 20 | { 21 | return Visibility.Visible; 22 | } 23 | } 24 | 25 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 26 | { 27 | throw new NotImplementedException(); 28 | } 29 | } -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/LicenseLinkToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using SimpleDnsCrypt.Models; 2 | using System; 3 | using System.Globalization; 4 | using System.Windows; 5 | using System.Windows.Data; 6 | 7 | namespace SimpleDnsCrypt.Converters 8 | { 9 | public class LicenseLinkToVisibilityConverter : IValueConverter 10 | { 11 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 12 | { 13 | try 14 | { 15 | return (LicenseLink)value != null ? Visibility.Visible : Visibility.Collapsed; 16 | } 17 | catch 18 | { 19 | return Visibility.Collapsed; 20 | } 21 | } 22 | 23 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/LocalDateConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Threading; 4 | using System.Windows.Data; 5 | 6 | namespace SimpleDnsCrypt.Converters 7 | { 8 | public class LocalDateConverter : IValueConverter 9 | { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | if (value == null) return $"({DateTime.Now.ToString("g", Thread.CurrentThread.CurrentCulture)})"; 13 | var date = (DateTime)value; 14 | return $"({date.ToString("g", Thread.CurrentThread.CurrentCulture)})"; 15 | } 16 | 17 | public object ConvertBack(object value, Type targetTypes, object parameter, CultureInfo culture) 18 | { 19 | throw new NotImplementedException(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/MessageBoxTypeToColor.cs: -------------------------------------------------------------------------------- 1 | using SimpleDnsCrypt.Models; 2 | using System; 3 | using System.Globalization; 4 | using System.Windows.Data; 5 | 6 | namespace SimpleDnsCrypt.Converters 7 | { 8 | /// 9 | /// Enum to color converter. 10 | /// 11 | [ValueConversion(typeof(BoxType), typeof(string))] 12 | public class MessageBoxTypeToColor : IValueConverter 13 | { 14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | switch ((BoxType)value) 17 | { 18 | case BoxType.Error: 19 | //red 20 | return "#CCC1170F"; 21 | case BoxType.Warning: 22 | //orange 23 | return "#CCEA6A12"; 24 | case BoxType.Default: 25 | //green 26 | return "#CC60A917"; 27 | default: 28 | return null; 29 | } 30 | } 31 | 32 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 33 | { 34 | throw new NotImplementedException(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/ProtocolToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace SimpleDnsCrypt.Converters 7 | { 8 | public class ProtocolToVisibilityConverter : IValueConverter 9 | { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | try 13 | { 14 | return value.Equals("DNSCrypt") ? Visibility.Visible : Visibility.Hidden; 15 | } 16 | catch 17 | { 18 | return Visibility.Hidden; 19 | } 20 | } 21 | 22 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | throw new NotImplementedException(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/QueryLogReturnCodeToColorConverter.cs: -------------------------------------------------------------------------------- 1 | using SimpleDnsCrypt.Models; 2 | using System; 3 | using System.Globalization; 4 | using System.Windows.Data; 5 | 6 | namespace SimpleDnsCrypt.Converters 7 | { 8 | public class QueryLogReturnCodeToColorConverter : IValueConverter 9 | { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | var logLineReturnCode = (QueryLogReturnCode)value; 13 | switch (logLineReturnCode) 14 | { 15 | case QueryLogReturnCode.PASS: 16 | return "#FF8ab329"; 17 | case QueryLogReturnCode.FORWARD: 18 | return "#FF8ab329"; 19 | case QueryLogReturnCode.DROP: 20 | return "#FFB32929"; 21 | case QueryLogReturnCode.REJECT: 22 | return "#FFB32929"; 23 | case QueryLogReturnCode.SYNTH: 24 | return "#FF8ab329"; 25 | case QueryLogReturnCode.PARSE_ERROR: 26 | return "#FFB32929"; 27 | case QueryLogReturnCode.NXDOMAIN: 28 | return "#FFB36729"; 29 | case QueryLogReturnCode.RESPONSE_ERROR: 30 | return "#FFB32929"; 31 | case QueryLogReturnCode.SERVER_ERROR: 32 | return "#FFB32929"; 33 | case QueryLogReturnCode.CLOAK: 34 | return "#FF2a3b68"; 35 | default: 36 | return "#FFB32929"; 37 | } 38 | } 39 | 40 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 41 | { 42 | throw new NotImplementedException(); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/QueryLogTypeToColorConverter.cs: -------------------------------------------------------------------------------- 1 | using SimpleDnsCrypt.Models; 2 | using System; 3 | using System.Globalization; 4 | using System.Windows.Data; 5 | 6 | namespace SimpleDnsCrypt.Converters 7 | { 8 | public class QueryLogTypeToColorConverter : IValueConverter 9 | { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | var logLineType = (QueryLogLineType)value; 13 | switch (logLineType) 14 | { 15 | case QueryLogLineType.A: 16 | return "#FF8ab329"; 17 | case QueryLogLineType.Unknown: 18 | return "#FF8ab329"; 19 | case QueryLogLineType.NS: 20 | return "#FF8ab329"; 21 | case QueryLogLineType.CNAME: 22 | return "#FF8ab329"; 23 | case QueryLogLineType.SOA: 24 | return "#FF8ab329"; 25 | case QueryLogLineType.WKS: 26 | return "#FF8ab329"; 27 | case QueryLogLineType.PTR: 28 | return "#FF2a3b68"; 29 | case QueryLogLineType.MX: 30 | return "#FF8ab329"; 31 | case QueryLogLineType.TXT: 32 | return "#FF8ab329"; 33 | case QueryLogLineType.AAAA: 34 | return "#FFB32929"; 35 | case QueryLogLineType.SRV: 36 | return "#FF8ab329"; 37 | case QueryLogLineType.ANY: 38 | return "#FF8ab329"; 39 | default: 40 | return "#FFB32929"; 41 | } 42 | } 43 | 44 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 45 | { 46 | throw new NotImplementedException(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/ReverseBoolToEnabledConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace SimpleDnsCrypt.Converters 6 | { 7 | /// 8 | /// Reverse boolean converter. 9 | /// 10 | public class ReverseBoolToEnabledConverter : IValueConverter 11 | { 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | return !(bool)value; 15 | } 16 | 17 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 18 | { 19 | throw new NotImplementedException(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/RouteStateToColorConverter.cs: -------------------------------------------------------------------------------- 1 | using SimpleDnsCrypt.Models; 2 | using System; 3 | using System.Globalization; 4 | using System.Windows.Data; 5 | 6 | namespace SimpleDnsCrypt.Converters 7 | { 8 | public class RouteStateToColorConverter : IValueConverter 9 | { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | if (value != null) 13 | { 14 | var routeState = (RouteState)value; 15 | switch (routeState) 16 | { 17 | case RouteState.Empty: 18 | //gray 19 | return "#D8D8D8"; 20 | case RouteState.Invalid: 21 | //red 22 | return "#CCC1170F"; 23 | case RouteState.Valid: 24 | //green 25 | return "#CC60A917"; 26 | } 27 | } 28 | //gray 29 | return "#D8D8D8"; 30 | } 31 | 32 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 33 | { 34 | throw new NotImplementedException(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/ServerListBackgroundConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Globalization; 4 | using System.Windows.Data; 5 | using SimpleDnsCrypt.Extensions; 6 | 7 | namespace SimpleDnsCrypt.Converters 8 | { 9 | public class ServerListBackgroundConverter : IValueConverter 10 | { 11 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 12 | { 13 | if ((bool)value) 14 | { 15 | return "#FF8AB329"; 16 | } 17 | return Color.DarkGray.ToHexString(); 18 | } 19 | 20 | public object ConvertBack(object value, Type targetTypes, object parameter, CultureInfo culture) 21 | { 22 | throw new NotImplementedException(); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /SimpleDnsCrypt/Converters/TextLengthToFontSizeConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace SimpleDnsCrypt.Converters 6 | { 7 | /// 8 | /// Text length to font size converter. 9 | /// 10 | public class TextLengthToFontSizeConverter : IValueConverter 11 | { 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | var text = (string)value; 15 | return text.Length switch 16 | { 17 | <= 10 => 14, 18 | > 10 and < 15 => 14, 19 | _ => 10, 20 | }; 21 | } 22 | 23 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /SimpleDnsCrypt/Extensions/ColorConverterExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | 3 | namespace SimpleDnsCrypt.Extensions 4 | { 5 | /// 6 | /// ColorConverterExtensions. 7 | /// 8 | /// 9 | public static class ColorConverterExtensions 10 | { 11 | public static string ToHexString(this Color c) => $"#{c.R:X2}{c.G:X2}{c.B:X2}"; 12 | 13 | public static string ToRgbString(this Color c) => $"RGB({c.R}, {c.G}, {c.B})"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Extensions/ServiceControllerExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ServiceProcess; 3 | using System.Threading.Tasks; 4 | 5 | namespace SimpleDnsCrypt.Extensions 6 | { 7 | public static class ServiceControllerExtensions 8 | { 9 | public static async Task StartAsync(this ServiceController serviceController, TimeSpan timeout) 10 | { 11 | serviceController.Start(); 12 | return await serviceController.WaitForStatusAsync(ServiceControllerStatus.Running, timeout); 13 | } 14 | 15 | public static async Task StopAsync(this ServiceController serviceController, TimeSpan timeout) 16 | { 17 | serviceController.Stop(); 18 | return await serviceController.WaitForStatusAsync(ServiceControllerStatus.Stopped, timeout); 19 | } 20 | 21 | public static async Task WaitForStatusAsync(this ServiceController serviceController, ServiceControllerStatus status, TimeSpan timeout) 22 | { 23 | var start = DateTime.UtcNow; 24 | serviceController.Refresh(); 25 | while (serviceController.Status != status) 26 | { 27 | if (DateTime.UtcNow - start > timeout) 28 | { 29 | return false; 30 | } 31 | 32 | await Task.Delay(250); 33 | serviceController.Refresh(); 34 | } 35 | 36 | return true; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Extensions/WindowManagerExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Caliburn.Micro; 3 | using SimpleDnsCrypt.Models; 4 | using SimpleDnsCrypt.ViewModels; 5 | using System.Windows; 6 | 7 | namespace SimpleDnsCrypt.Extensions 8 | { 9 | /// 10 | /// Custom WindowManagerExtensions. 11 | /// 12 | public static class WindowManagerExtensions 13 | { 14 | /// 15 | /// Extended MetroMessageBox. 16 | /// 17 | /// 18 | /// 19 | /// 20 | /// 21 | /// 22 | /// 23 | public static async Task ShowMetroMessageBox(this IWindowManager @this, string message, string title, 24 | MessageBoxButton buttons, BoxType messageBoxType = BoxType.Default) 25 | { 26 | var model = new MetroMessageBoxViewModel(message, title, buttons, messageBoxType); 27 | await Execute.OnUIThreadAsync(async () => await @this.ShowDialogAsync(model)); 28 | return model.Result; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Helper/DnscryptProxyConfigurationManager.cs: -------------------------------------------------------------------------------- 1 | using Nett; 2 | using SimpleDnsCrypt.Config; 3 | using SimpleDnsCrypt.Models; 4 | using System; 5 | using System.IO; 6 | 7 | namespace SimpleDnsCrypt.Helper 8 | { 9 | /// 10 | /// Class to load and save the dnscrypt configuration (TOML format). 11 | /// 12 | public static class DnscryptProxyConfigurationManager 13 | { 14 | public static TomlSettings ReadTomlSettings => 15 | TomlSettings.Create(s => s.ConfigurePropertyMapping(m => m.UseTargetPropertySelector(standardSelectors => standardSelectors.IgnoreCase))); 16 | 17 | /// 18 | /// The global dnscrypt configuration. 19 | /// 20 | public static DnscryptProxyConfiguration DnscryptProxyConfiguration { get; set; } 21 | 22 | /// 23 | /// Loads the configuration from a .toml file. 24 | /// 25 | /// true on success, otherwise false 26 | public static bool LoadConfiguration() 27 | { 28 | try 29 | { 30 | var configFile = Global.DnsCryptConfigurationFilePath; 31 | if (!File.Exists(configFile)) return false; 32 | DnscryptProxyConfiguration = Toml.ReadFile(configFile, ReadTomlSettings); 33 | return true; 34 | } 35 | catch (Exception) 36 | { 37 | return false; 38 | } 39 | } 40 | 41 | /// 42 | /// Saves the configuration to a .toml file. 43 | /// 44 | /// true on success, otherwise false 45 | public static bool SaveConfiguration() 46 | { 47 | try 48 | { 49 | var settings = TomlSettings.Create(s => s.ConfigurePropertyMapping(m => m.UseKeyGenerator(standardGenerators => standardGenerators.LowerCase))); 50 | Toml.WriteFile(DnscryptProxyConfiguration, Global.DnsCryptConfigurationFilePath, settings); 51 | return true; 52 | } 53 | catch (Exception) 54 | { 55 | return false; 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Helper/EnumHelper.cs: -------------------------------------------------------------------------------- 1 | using SimpleDnsCrypt.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Globalization; 6 | using System.Linq; 7 | using System.Reflection; 8 | 9 | namespace SimpleDnsCrypt.Helper 10 | { 11 | public static class EnumHelper 12 | { 13 | public static string Description(this Enum eValue) 14 | { 15 | var descriptionAttribute = eValue.GetType().GetField(eValue.ToString())?.GetCustomAttribute(false); 16 | if (descriptionAttribute != null) 17 | return descriptionAttribute.Description; 18 | 19 | var oTi = CultureInfo.CurrentCulture.TextInfo; 20 | return oTi.ToTitleCase(oTi.ToLower(eValue.ToString())); 21 | } 22 | 23 | public static IEnumerable GetAllValuesAndDescriptions(Type t) 24 | { 25 | if (!t.IsEnum) 26 | throw new ArgumentException("t must be an enum type"); 27 | 28 | return Enum.GetValues(t).Cast().Select((e) => new ValueDescription() { Value = e, Description = e.Description() }).ToList(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Helper/LogManagerHelper.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | using System.Diagnostics; 3 | 4 | namespace SimpleDnsCrypt.Helper 5 | { 6 | public static class LogManagerHelper 7 | { 8 | public static ILog Factory() 9 | { 10 | var callerFrame = new StackFrame(1); 11 | return LogManager.GetLog(callerFrame.GetMethod().ReflectedType); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Helper/NavigationService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Text.RegularExpressions; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | using System.Windows.Documents; 7 | 8 | namespace SimpleDnsCrypt.Helper 9 | { 10 | /// 11 | /// Class to make inline URLs clickable (UI). 12 | /// 13 | public static class NavigationService 14 | { 15 | /// 16 | /// Copied from http://geekswithblogs.net/casualjim/archive/2005/12/01/61722.aspx 17 | /// 18 | private static readonly Regex ReUrl = 19 | new Regex( 20 | @"(?#Protocol)(?:(?:ht|f)tp(?:s?)\:\/\/|~/|/)?(?#Username:Password)(?:\w+:\w+@)?(?#Subdomains)(?:(?:[-\w]+\.)+(?#TopLevel Domains)(?:com|org|de|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?#Port)(?::[\d]{1,5})?(?#Directories)(?:(?:(?:/(?:[-\w~!$+|.,=]|%[a-f\d]{2})+)+|/)+|\?|#)?(?#Query)(?:(?:\?(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)(?:&(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)*)*(?#Anchor)(?:#(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)?"); 21 | 22 | public static readonly DependencyProperty TextProperty = DependencyProperty.RegisterAttached( 23 | "Text", 24 | typeof(string), 25 | typeof(NavigationService), 26 | new PropertyMetadata(null, OnTextChanged) 27 | ); 28 | 29 | public static string GetText(DependencyObject d) 30 | { 31 | return d.GetValue(TextProperty) as string; 32 | } 33 | 34 | public static void SetText(DependencyObject d, string value) 35 | { 36 | d.SetValue(TextProperty, value); 37 | } 38 | 39 | private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 40 | { 41 | var textBlock = d as TextBlock; 42 | if (textBlock == null) 43 | return; 44 | 45 | textBlock.Inlines.Clear(); 46 | 47 | var newText = (string)e.NewValue; 48 | if (string.IsNullOrEmpty(newText)) 49 | return; 50 | 51 | // Find all URLs using a regular expression 52 | var lastPos = 0; 53 | foreach (Match match in ReUrl.Matches(newText)) 54 | { 55 | // Copy raw string from the last position up to the match 56 | if (match.Index != lastPos) 57 | { 58 | var rawText = newText.Substring(lastPos, match.Index - lastPos); 59 | textBlock.Inlines.Add(new Run(rawText)); 60 | } 61 | 62 | // Create a hyperlink for the match 63 | var hyperLink = new ResourceDictionary 64 | { 65 | Source = new Uri("/SimpleDnsCrypt;component/Styles/HyperLink.xaml", UriKind.RelativeOrAbsolute) 66 | }; 67 | 68 | var linkHyperLinkStyle = hyperLink["LinkHyperLinkStyle"] as Style; 69 | 70 | var link = new Hyperlink(new Run(match.Value)) 71 | { 72 | NavigateUri = new Uri(match.Value), 73 | Style = linkHyperLinkStyle 74 | }; 75 | 76 | link.Click += OnUrlClick; 77 | textBlock.Inlines.Add(link); 78 | 79 | // Update the last matched position 80 | lastPos = match.Index + match.Length; 81 | } 82 | 83 | // Finally, copy the remainder of the string 84 | if (lastPos < newText.Length) 85 | textBlock.Inlines.Add(new Run(newText.Substring(lastPos))); 86 | } 87 | 88 | private static void OnUrlClick(object sender, RoutedEventArgs e) 89 | { 90 | var link = (Hyperlink)sender; 91 | // Do something with link.NavigateUri like: 92 | Process.Start(link.NavigateUri.ToString()); 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Helper/PatchHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.IO; 4 | using SimpleDnsCrypt.Config; 5 | using SimpleDnsCrypt.Models; 6 | 7 | namespace SimpleDnsCrypt.Helper; 8 | 9 | /// 10 | /// Class to update the configuration file. 11 | /// 12 | public static class PatchHelper 13 | { 14 | private const int ConfigFileVersion = 1; 15 | 16 | public static void Patch() 17 | { 18 | if (!File.Exists(Global.DnsCryptConfigurationFilePath)) 19 | { 20 | File.Copy( 21 | Global.DnsCryptExampleConfigurationFilePath, 22 | Global.DnsCryptConfigurationFilePath, 23 | false); 24 | } 25 | else 26 | { 27 | var oldVersion = File.Exists(Global.DnsCryptConfigurationVersionFilePath) 28 | ? int.TryParse(File.ReadAllText(Global.DnsCryptConfigurationVersionFilePath).Trim(), out var parsed) 29 | ? parsed 30 | : 0 31 | : 0; 32 | if (oldVersion == ConfigFileVersion) 33 | { 34 | return; 35 | } 36 | 37 | File.Copy(Global.DnsCryptConfigurationFilePath, $"{Global.DnsCryptConfigurationFilePath}.{DateTime.Now:yyyyMMddTHHmmss}.bak", true); 38 | 39 | if (!DnscryptProxyConfigurationManager.LoadConfiguration()) 40 | { 41 | return; 42 | } 43 | 44 | if (oldVersion <= 0) 45 | { 46 | DnscryptProxyConfigurationManager.DnscryptProxyConfiguration.sources["public-resolvers"] = new Source 47 | { 48 | urls = new[] 49 | { 50 | "https://raw.githubusercontent.com/DNSCrypt/dnscrypt-resolvers/master/v3/public-resolvers.md", 51 | "https://download.dnscrypt.info/resolvers-list/v3/public-resolvers.md", 52 | "https://ipv6.download.dnscrypt.info/resolvers-list/v3/public-resolvers.md", 53 | }, 54 | cache_file = "public-resolvers.md", 55 | minisign_key = "RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3", 56 | prefix = "", 57 | }; 58 | DnscryptProxyConfigurationManager.DnscryptProxyConfiguration.sources["relays"] = new Source 59 | { 60 | urls = new[] 61 | { 62 | "https://raw.githubusercontent.com/DNSCrypt/dnscrypt-resolvers/master/v3/relays.md", 63 | "https://download.dnscrypt.info/resolvers-list/v3/relays.md", 64 | "https://ipv6.download.dnscrypt.info/resolvers-list/v3/relays.md", 65 | }, 66 | cache_file = "relays.md", 67 | minisign_key = "RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3", 68 | prefix = "", 69 | refresh_delay = 72, 70 | }; 71 | } 72 | 73 | DnscryptProxyConfigurationManager.SaveConfiguration(); 74 | } 75 | 76 | File.WriteAllText(Global.DnsCryptConfigurationVersionFilePath, ConfigFileVersion.ToString(CultureInfo.InvariantCulture)); 77 | } 78 | } -------------------------------------------------------------------------------- /SimpleDnsCrypt/Helper/RelayHelper.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | using SimpleDnsCrypt.Config; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using SimpleDnsCrypt.Utils; 7 | using SimpleDnsCrypt.Utils.Models; 8 | 9 | namespace SimpleDnsCrypt.Helper 10 | { 11 | public static class RelayHelper 12 | { 13 | private static readonly ILog Log = LogManagerHelper.Factory(); 14 | 15 | public static List GetRelays() 16 | { 17 | var relays = new List(); 18 | var relayFile = Path.Combine(Global.DnsCryptFolderPath, "relays.md"); 19 | try 20 | { 21 | if (File.Exists(relayFile)) 22 | { 23 | relays = StampTools.ReadStampFileEntries(relayFile); 24 | } 25 | } 26 | catch (Exception exception) 27 | { 28 | Log.Error(exception); 29 | } 30 | return relays; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Helper/UriYamlTypeConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using YamlDotNet.Core; 3 | using YamlDotNet.Core.Events; 4 | using YamlDotNet.Serialization; 5 | 6 | namespace SimpleDnsCrypt.Helper 7 | { 8 | internal sealed class UriYamlTypeConverter : IYamlTypeConverter 9 | { 10 | public bool Accepts(Type type) 11 | { 12 | return type == typeof(Uri); 13 | } 14 | 15 | public object ReadYaml(IParser parser, Type type) 16 | { 17 | var value = ((Scalar)parser.Current).Value; 18 | parser.MoveNext(); 19 | return new Uri(value); 20 | } 21 | 22 | public void WriteYaml(IEmitter emitter, object value, Type type) 23 | { 24 | var uri = (Uri)value; 25 | emitter.Emit(new Scalar(null, null, uri.ToString(), ScalarStyle.Any, true, false)); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Helper/ValidationHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Net; 4 | 5 | namespace SimpleDnsCrypt.Helper 6 | { 7 | public static class ValidationHelper 8 | { 9 | 10 | public static string ValidateIpEndpoint(string endpoint) 11 | { 12 | if (string.IsNullOrEmpty(endpoint)) 13 | { 14 | return null; 15 | } 16 | 17 | try 18 | { 19 | var ipEndPoint = CreateIpEndPoint(endpoint); 20 | return ipEndPoint.ToString(); 21 | } 22 | catch (Exception) 23 | { 24 | return null; 25 | } 26 | } 27 | 28 | private static IPEndPoint CreateIpEndPoint(string endPoint) 29 | { 30 | var ep = endPoint.Split(':'); 31 | if (ep.Length < 2) throw new FormatException("Invalid endpoint format"); 32 | IPAddress ip; 33 | if (ep.Length > 2) 34 | { 35 | if (!IPAddress.TryParse(string.Join(":", ep, 0, ep.Length - 1), out ip)) 36 | { 37 | throw new FormatException("Invalid ip-adress"); 38 | } 39 | } 40 | else 41 | { 42 | if (!IPAddress.TryParse(ep[0], out ip)) 43 | { 44 | throw new FormatException("Invalid ip-adress"); 45 | } 46 | } 47 | 48 | if (!int.TryParse(ep[ep.Length - 1], NumberStyles.None, NumberFormatInfo.CurrentInfo, out var port)) 49 | { 50 | throw new FormatException("Invalid port"); 51 | } 52 | return new IPEndPoint(ip, port); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Helper/VersionHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace SimpleDnsCrypt.Helper 5 | { 6 | /// 7 | /// Helper class to show retrieve the application version. 8 | /// 9 | public static class VersionHelper 10 | { 11 | /// 12 | /// Get the current Application version. 13 | /// 14 | public static string PublishVersion 15 | { 16 | get 17 | { 18 | try 19 | { 20 | var version = Assembly.GetExecutingAssembly().GetName().Version; 21 | return $"{version.Major}.{version.Minor}.{version.Build}"; 22 | } 23 | catch (FormatException) 24 | { 25 | return "0"; 26 | } 27 | catch (ArgumentNullException) 28 | { 29 | return "0"; 30 | } 31 | } 32 | } 33 | 34 | public static string PublishBuild => Environment.Is64BitProcess ? "(x64)" : "(x86)"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Images/128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/SimpleDnsCrypt/Images/128x128.png -------------------------------------------------------------------------------- /SimpleDnsCrypt/Images/simplednscrypt.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/SimpleDnsCrypt/Images/simplednscrypt.ico -------------------------------------------------------------------------------- /SimpleDnsCrypt/LogMode.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleDnsCrypt 2 | { 3 | public static class LogMode 4 | { 5 | public static bool Debug { get; set; } = false; 6 | public static bool Error { get; set; } = true; 7 | public static bool Warn { get; set; } = true; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Logger/NLogLogger.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | using System; 3 | 4 | namespace SimpleDnsCrypt.Logger 5 | { 6 | public class NLogLogger : ILog 7 | { 8 | private readonly NLog.Logger _nLogLogger; 9 | 10 | public NLogLogger(Type type) 11 | { 12 | _nLogLogger = NLog.LogManager.GetLogger(type.Name); 13 | } 14 | 15 | public void Error(Exception exception) 16 | { 17 | if (LogMode.Error) 18 | { 19 | _nLogLogger.Error(exception); 20 | } 21 | } 22 | public void Info(string format, params object[] args) 23 | { 24 | if (LogMode.Debug) 25 | { 26 | _nLogLogger.Debug(format, args); 27 | } 28 | } 29 | public void Warn(string format, params object[] args) 30 | { 31 | if (LogMode.Warn) 32 | { 33 | _nLogLogger.Warn(format, args); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Models/AddRuleWindowResult.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleDnsCrypt.Models 2 | { 3 | public class AddRuleWindowResult 4 | { 5 | public bool Result { get; set; } = false; 6 | public string RuleKey { get; set; } = string.Empty; 7 | public string RuleValue { get; set; } = string.Empty; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Models/AddressBlockLogLine.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SimpleDnsCrypt.Models 4 | { 5 | public class AddressBlockLogLine : LogLine 6 | { 7 | public DateTime Time { get; set; } 8 | public string Host { get; set; } 9 | public string QName { get; set; } 10 | public string Message { get; set; } 11 | 12 | public AddressBlockLogLine(string line) 13 | { 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /SimpleDnsCrypt/Models/BoxType.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleDnsCrypt.Models 2 | { 3 | /// 4 | /// Compatible box types. 5 | /// 6 | public enum BoxType 7 | { 8 | /// 9 | /// green 10 | /// 11 | Default, 12 | 13 | /// 14 | /// orange 15 | /// 16 | Warning, 17 | 18 | /// 19 | /// red 20 | /// 21 | Error 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Models/DnsServer.cs: -------------------------------------------------------------------------------- 1 | using System.Net.NetworkInformation; 2 | using Caliburn.Micro; 3 | 4 | namespace SimpleDnsCrypt.Models 5 | { 6 | public class DnsServer : PropertyChangedBase 7 | { 8 | private NetworkInterfaceComponent _type; 9 | private string _address; 10 | 11 | public NetworkInterfaceComponent Type 12 | { 13 | get => _type; 14 | set 15 | { 16 | _type = value; 17 | NotifyOfPropertyChange(() => Type); 18 | } 19 | } 20 | 21 | public string Address 22 | { 23 | get => _address; 24 | set 25 | { 26 | _address = value; 27 | NotifyOfPropertyChange(() => Address); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Models/DomainBlockLogLine.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SimpleDnsCrypt.Models 4 | { 5 | public class DomainBlockLogLine : LogLine 6 | { 7 | public DateTime Time { get; set; } 8 | public string Host { get; set; } 9 | public string QName { get; set; } 10 | public string Message { get; set; } 11 | 12 | public DomainBlockLogLine(string line) 13 | { 14 | try 15 | { 16 | //this only works with the ltsv log format: 17 | //time:1516794292 host:127.0.0.1 qname:stats.g.doubleclick.net message:stats.* 18 | var stringSeparators = new[] { "\t" }; 19 | var parts = line.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries); 20 | if (parts.Length != 4) return; 21 | if (parts[0].StartsWith("time:")) 22 | { 23 | Time = UnixTimeStampToDateTime(Convert.ToDouble(parts[0].Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1])); 24 | } 25 | if (parts[1].StartsWith("host:")) 26 | { 27 | Host = parts[1].Split(new[] { ':' }, 2)[1]; 28 | } 29 | if (parts[2].StartsWith("qname:")) 30 | { 31 | QName = parts[2].Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1].Trim(); 32 | } 33 | if (parts[3].StartsWith("message:")) 34 | { 35 | Message = parts[3].Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1].Trim(); 36 | } 37 | } 38 | catch 39 | { 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Models/Language.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleDnsCrypt.Models 2 | { 3 | public class Language 4 | { 5 | /// 6 | /// The name of the language. 7 | /// 8 | public string Name { get; set; } 9 | /// 10 | /// Example: en 11 | /// 12 | public string ShortCode { get; set; } 13 | /// 14 | /// Example: en-US 15 | /// 16 | public string CultureCode { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Models/License.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SimpleDnsCrypt.Models 4 | { 5 | /// 6 | /// Object to represent a license in the license view. 7 | /// 8 | public class License 9 | { 10 | /// 11 | /// Visible header Text. 12 | /// 13 | public string LicenseHeaderText { get; set; } 14 | 15 | /// 16 | /// Link to the code (github). 17 | /// 18 | public LicenseLink LicenseCodeLink { get; set; } 19 | 20 | /// 21 | /// Link to publisher website. 22 | /// 23 | public LicenseLink LicenseRegularLink { get; set; } 24 | 25 | /// 26 | /// The license text. 27 | /// 28 | public string LicenseText { get; set; } 29 | } 30 | 31 | /// 32 | /// A license link inside the a license. 33 | /// 34 | public class LicenseLink 35 | { 36 | /// 37 | /// Visible Text. 38 | /// 39 | public string LinkText { get; set; } 40 | 41 | /// 42 | /// Uri to browse. 43 | /// 44 | public Uri LinkUri { get; set; } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Models/LocalNetworkInterface.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | using System.Collections.Generic; 3 | using System.Net.NetworkInformation; 4 | 5 | namespace SimpleDnsCrypt.Models 6 | { 7 | public class LocalNetworkInterface : PropertyChangedBase 8 | { 9 | private string _name; 10 | private NetworkInterfaceType _type; 11 | private OperationalStatus _operationalStatus; 12 | private string _description; 13 | private List _dns; 14 | private bool _ipv6Support; 15 | private bool _ipv4Support; 16 | private bool _useDnsCrypt; 17 | private bool _isChangeable; 18 | 19 | public LocalNetworkInterface() 20 | { 21 | Dns = new List(); 22 | _isChangeable = true; 23 | } 24 | 25 | public string Name 26 | { 27 | get => _name; 28 | set 29 | { 30 | _name = value; 31 | NotifyOfPropertyChange(() => Name); 32 | } 33 | } 34 | 35 | /// 36 | /// The status of the network card (up/down) 37 | /// 38 | public OperationalStatus OperationalStatus 39 | { 40 | get => _operationalStatus; 41 | set 42 | { 43 | _operationalStatus = value; 44 | NotifyOfPropertyChange(() => OperationalStatus); 45 | } 46 | } 47 | 48 | public string Description 49 | { 50 | get => _description; 51 | set 52 | { 53 | _description = value; 54 | NotifyOfPropertyChange(() => Description); 55 | } 56 | } 57 | 58 | public NetworkInterfaceType Type 59 | { 60 | get => _type; 61 | set 62 | { 63 | _type = value; 64 | NotifyOfPropertyChange(() => Type); 65 | } 66 | } 67 | 68 | public List Dns 69 | { 70 | get => _dns; 71 | set 72 | { 73 | _dns = value; 74 | NotifyOfPropertyChange(() => Dns); 75 | } 76 | } 77 | 78 | public bool Ipv6Support 79 | { 80 | get => _ipv6Support; 81 | set 82 | { 83 | _ipv6Support = value; 84 | NotifyOfPropertyChange(() => Ipv6Support); 85 | } 86 | } 87 | 88 | public bool Ipv4Support 89 | { 90 | get => _ipv4Support; 91 | set 92 | { 93 | _ipv4Support = value; 94 | NotifyOfPropertyChange(() => Ipv4Support); 95 | } 96 | } 97 | 98 | public bool IsChangeable 99 | { 100 | get => _isChangeable; 101 | set 102 | { 103 | _isChangeable = value; 104 | NotifyOfPropertyChange(() => IsChangeable); 105 | } 106 | } 107 | 108 | public bool UseDnsCrypt 109 | { 110 | get => _useDnsCrypt; 111 | set 112 | { 113 | _useDnsCrypt = value; 114 | NotifyOfPropertyChange(() => UseDnsCrypt); 115 | } 116 | } 117 | 118 | public string IpAddresses { get; set; } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Models/ProcessResult.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleDnsCrypt.Models 2 | { 3 | public class ProcessResult 4 | { 5 | public bool Success { get; set; } 6 | public string StandardError { get; set; } 7 | public string StandardOutput { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Models/QueryLogLine.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | using SimpleDnsCrypt.Helper; 3 | using System; 4 | 5 | namespace SimpleDnsCrypt.Models 6 | { 7 | public abstract class LogLine 8 | { 9 | public static DateTime UnixTimeStampToDateTime(double unixTimeStamp) 10 | { 11 | // Unix timestamp is seconds past epoch 12 | var dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); 13 | dtDateTime = dtDateTime.AddSeconds(unixTimeStamp).ToLocalTime(); 14 | return dtDateTime; 15 | } 16 | } 17 | 18 | public enum QueryLogReturnCode 19 | { 20 | PASS, 21 | FORWARD, 22 | DROP, 23 | REJECT, 24 | SYNTH, 25 | PARSE_ERROR, 26 | NXDOMAIN, 27 | RESPONSE_ERROR, 28 | SERVER_ERROR, 29 | CLOAK 30 | } 31 | 32 | public class QueryLogLine : LogLine 33 | { 34 | private static readonly ILog Log = LogManagerHelper.Factory(); 35 | public DateTime Date { get; set; } 36 | public string Address { get; set; } 37 | public string Remote { get; set; } 38 | public QueryLogLineType Type { get; set; } 39 | public QueryLogReturnCode ReturnCode { get; set; } 40 | public bool Cached { get; set; } 41 | public string CachedText => Cached ? "cached" : "live"; 42 | public long Duration { get; set; } 43 | public string DurationText => $"{Duration}ms"; 44 | public string Server { get; set; } 45 | 46 | public QueryLogLine(string line) 47 | { 48 | try 49 | { 50 | //this only works with the ltsv log format: 51 | //time:1559589175 host:::1 message:www.test.de type:AAAA return:SYNTH cached:0 duration:0 server:freetsa.org 52 | var stringSeparators = new[] { "\t" }; 53 | var parts = line.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries); 54 | if (parts.Length != 8) return; 55 | if (parts[0].StartsWith("time:")) 56 | { 57 | Date = UnixTimeStampToDateTime(Convert.ToDouble(parts[0].Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1])); 58 | } 59 | if (parts[1].StartsWith("host:")) 60 | { 61 | Address = parts[1].Split(new[] { ':' }, 2)[1]; 62 | } 63 | if (parts[2].StartsWith("message:")) 64 | { 65 | Remote = parts[2].Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1].Trim(); 66 | } 67 | if (parts[3].StartsWith("type:")) 68 | { 69 | if (Enum.TryParse(parts[3].Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1].Trim(), 70 | out QueryLogLineType queryLogLineType)) 71 | { 72 | Type = queryLogLineType; 73 | } 74 | } 75 | if (parts[4].StartsWith("return:")) 76 | { 77 | if (Enum.TryParse(parts[4].Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1].Trim(), 78 | out QueryLogReturnCode queryLogReturnCode)) 79 | { 80 | ReturnCode = queryLogReturnCode; 81 | } 82 | } 83 | else 84 | { 85 | Type = QueryLogLineType.Unknown; 86 | } 87 | if (parts[5].StartsWith("cached:")) 88 | { 89 | Cached = Convert.ToBoolean(Convert.ToInt16(parts[5].Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1].Trim())); 90 | } 91 | if (parts[6].StartsWith("duration:")) 92 | { 93 | Duration = Convert.ToInt64(parts[6].Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1].Trim()); 94 | } 95 | if (parts[7].StartsWith("server:")) 96 | { 97 | Server = parts[7].Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1].Trim(); 98 | } 99 | } 100 | catch (Exception exception) 101 | { 102 | Log.Error(exception); 103 | } 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Models/QueryLogLineType.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleDnsCrypt.Models 2 | { 3 | public enum QueryLogLineType 4 | { 5 | Unknown, 6 | A, 7 | NS, 8 | CNAME, 9 | SOA, 10 | WKS, 11 | PTR, 12 | MX, 13 | TXT, 14 | AAAA, 15 | SRV, 16 | ANY 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Models/Rule.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleDnsCrypt.Models 2 | { 3 | public class Rule 4 | { 5 | public string Key { get; set; } 6 | public string Value { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Models/ValueDescription.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleDnsCrypt.Models 2 | { 3 | public class ValueDescription 4 | { 5 | public object Description { get; set; } 6 | public object Value { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/NLog.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using System.Windows; 3 | [assembly: ComVisible(false)] 4 | [assembly: ThemeInfo( 5 | ResourceDictionaryLocation.None, 6 | ResourceDictionaryLocation.SourceAssembly 7 | )] 8 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Dieser Code wurde von einem Tool generiert. 4 | // Laufzeitversion:4.0.30319.42000 5 | // 6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn 7 | // der Code erneut generiert wird. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SimpleDnsCrypt.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. 17 | /// 18 | // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert 19 | // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. 20 | // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen 21 | // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SimpleDnsCrypt.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle 51 | /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | True 7 | 8 | 9 | False 10 | 11 | 12 | False 13 | 14 | 15 | False 16 | 17 | 18 | False 19 | 20 | 21 | True 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | True 40 | 41 | 42 | False 43 | 44 | 45 | True 46 | 47 | 48 | 49 | 50 | 51 | False 52 | 53 | 54 | 55 | 56 | 57 | 825 58 | 59 | 60 | 875 61 | 62 | 63 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Properties/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/Baseclass.Contrib.Nuget.Output.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 baseclass Gmbh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/Caliburn.Micro.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2010 Blue Spire Consulting, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/ControlzEx.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Jan Karger, Bastian Schmidt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/Costura.Fody.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2012 Simon Cropp and contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/Fody.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) Simon Cropp and contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/MahApps.Metro.SimpleChildWindow.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 - 2018 Jan Karger 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/MahApps.Metro.txt: -------------------------------------------------------------------------------- 1 | MIT License (MIT) 2 | 3 | Copyright (c) 2016 MahApps 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/NLog.txt: -------------------------------------------------------------------------------- 1 |  2 | Copyright (c) 2004-2017 Jaroslaw Kowalski , Kim Christensen, Julian Verdurmen 3 | 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | * Neither the name of Jaroslaw Kowalski nor the names of its 18 | contributors may be used to endorse or promote products derived from this 19 | software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/Nett.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 paiden@outlook.com. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/Newtonsoft.Json.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2007 James Newton-King 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/SimpleDNSCrypt.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 - 2019 Christian Hermann & Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/WPFLocalizationExtension.txt: -------------------------------------------------------------------------------- 1 | Microsoft Public License (Ms-PL) 2 | 3 | This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. 4 | 5 | 1. Definitions 6 | 7 | The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. 8 | 9 | A "contribution" is the original software, or any additions or changes to the software. 10 | 11 | A "contributor" is any person that distributes its contribution under this license. 12 | 13 | "Licensed patents" are a contributor's patent claims that read directly on its contribution. 14 | 15 | 2. Grant of Rights 16 | 17 | (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. 18 | 19 | (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. 20 | 21 | 3. Conditions and Limitations 22 | 23 | (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. 24 | 25 | (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. 26 | 27 | (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. 28 | 29 | (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. 30 | 31 | (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/XAMLMarkupExtensions.txt: -------------------------------------------------------------------------------- 1 | Microsoft Public License (Ms-PL) 2 | 3 | This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. 4 | 5 | 1. Definitions 6 | 7 | The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. 8 | 9 | A "contribution" is the original software, or any additions or changes to the software. 10 | 11 | A "contributor" is any person that distributes its contribution under this license. 12 | 13 | "Licensed patents" are a contributor's patent claims that read directly on its contribution. 14 | 15 | 2. Grant of Rights 16 | 17 | (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. 18 | 19 | (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. 20 | 21 | 3. Conditions and Limitations 22 | 23 | (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. 24 | 25 | (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. 26 | 27 | (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. 28 | 29 | (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. 30 | 31 | (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/YamlDotNet.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Antoine Aubry and contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/dnscrypt-proxy.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * ISC License 3 | * 4 | * Copyright (c) 2018 5 | * Frank Denis 6 | * 7 | * Permission to use, copy, modify, and/or distribute this software for any 8 | * purpose with or without fee is hereby granted, provided that the above 9 | * copyright notice and this permission notice appear in all copies. 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 | */ -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/gong-wpf-dragdrop.txt: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2015-2019, Jan Karger (Steven Kirk) 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of gong-wpf-dragdrop nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/helper-net.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 - 2017 Christian Hermann & Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/libsodium-net.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 - 2016 Adam Caudill & Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Licenses/minisign-net.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 - 2017 Christian Hermann 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/ResourceDictionaries/ResourceLibrary.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Resources/Translation.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Dieser Code wurde von einem Tool generiert. 4 | // Laufzeitversion:4.0.30319.42000 5 | // 6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn 7 | // der Code erneut generiert wird. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SimpleDnsCrypt.Resources { 12 | using System; 13 | 14 | 15 | /// 16 | /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. 17 | /// 18 | // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert 19 | // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. 20 | // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen 21 | // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Translation { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Translation() { 33 | } 34 | 35 | /// 36 | /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SimpleDnsCrypt.Resources.Translation", typeof(Translation).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle 51 | /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Styles/CustomAccentedSquareButtonStyle.xaml: -------------------------------------------------------------------------------- 1 |  4 | 10 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Styles/CustomMetroListBoxItem.xaml: -------------------------------------------------------------------------------- 1 |  4 | 38 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Styles/HyperLink.xaml: -------------------------------------------------------------------------------- 1 |  4 | 15 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Styles/HyperlinkButton.xaml: -------------------------------------------------------------------------------- 1 |  4 | 13 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Styles/LinkHeaderStyle.xaml: -------------------------------------------------------------------------------- 1 |  4 | 11 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Styles/ModalStyle.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | 10 | 11 | 17 | 18 | 27 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/ViewModels/AddCustomResolverViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.Composition; 4 | using System.Linq; 5 | using System.Reactive; 6 | using System.Reactive.Linq; 7 | using Caliburn.Micro; 8 | using Reactive.Bindings; 9 | using ReactiveUI; 10 | using SimpleDnsCrypt.Utils; 11 | using ReactiveCommand = ReactiveUI.ReactiveCommand; 12 | 13 | namespace SimpleDnsCrypt.ViewModels 14 | { 15 | [Export(typeof(AddCustomResolverViewModel))] 16 | public class AddCustomResolverViewModel : Screen 17 | { 18 | public ReactiveCommand OkCommand { get; } 19 | public ReactiveCommand CancelCommand { get; } 20 | public ReactiveProperty Name { get; } 21 | 22 | public ReactiveProperty Stamp { get; } = new ReactiveProperty("").SetValidateNotifyError(s => 23 | { 24 | try 25 | { 26 | List issues; 27 | try 28 | { 29 | issues = StampTools.Decode(s)?.ValidationIssues.ToList(); 30 | } 31 | catch (Exception ex) 32 | { 33 | return $"Failed to decode the stamp: {ex.Message}"; 34 | } 35 | 36 | if (issues == null) 37 | { 38 | return "Failed to decode the stamp: stamp is too short or in invalid format"; 39 | } 40 | 41 | if (issues.Any()) 42 | { 43 | return string.Join("\n", issues); 44 | } 45 | 46 | return null; 47 | } 48 | catch (Exception ex) 49 | { 50 | return ex.Message; 51 | } 52 | }); 53 | 54 | public HashSet ExistingNames { get; set; } = new HashSet(); 55 | 56 | public AddCustomResolverViewModel() 57 | { 58 | Name = new ReactiveProperty("").SetValidateNotifyError(s => 59 | { 60 | if (string.IsNullOrWhiteSpace(s)) return "Name must not be empty"; 61 | return ExistingNames.Contains(s) ? $"Name {s} is already present in the server list" : null; 62 | }); 63 | OkCommand = ReactiveCommand.CreateFromTask(() => TryCloseAsync(true), Name.ObserveHasErrors.CombineLatest(Stamp.ObserveHasErrors, (a, b) => !a && !b)); 64 | CancelCommand = ReactiveCommand.CreateFromTask(() => TryCloseAsync(false)); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/ViewModels/AddressBlacklistViewModel.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | using System; 3 | using System.ComponentModel.Composition; 4 | 5 | namespace SimpleDnsCrypt.ViewModels 6 | { 7 | [Export(typeof(AddressBlacklistViewModel))] 8 | public class AddressBlacklistViewModel : Screen 9 | { 10 | 11 | private readonly IWindowManager _windowManager; 12 | private readonly IEventAggregator _events; 13 | 14 | private BindableCollection _addressBlacklist; 15 | private string _selectedAddressBlacklistEntry; 16 | 17 | /// 18 | /// Initializes a new instance of the class 19 | /// 20 | /// The window manager 21 | /// The events 22 | [ImportingConstructor] 23 | public AddressBlacklistViewModel(IWindowManager windowManager, IEventAggregator events) 24 | { 25 | _windowManager = windowManager; 26 | _events = events; 27 | _events.SubscribeOnPublishedThread(this); 28 | _addressBlacklist = new BindableCollection(); 29 | } 30 | 31 | public string SelectedAddressBlacklistEntry 32 | { 33 | get => _selectedAddressBlacklistEntry; 34 | set 35 | { 36 | if (value.Equals(_selectedAddressBlacklistEntry)) return; 37 | _selectedAddressBlacklistEntry = value; 38 | NotifyOfPropertyChange(() => SelectedAddressBlacklistEntry); 39 | } 40 | } 41 | 42 | public BindableCollection AddressBlacklist 43 | { 44 | get => _addressBlacklist; 45 | set 46 | { 47 | if (value.Equals(_addressBlacklist)) return; 48 | _addressBlacklist = value; 49 | NotifyOfPropertyChange(() => AddressBlacklist); 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/ViewModels/AddressBlockLogViewModel.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | using SimpleDnsCrypt.Helper; 3 | using SimpleDnsCrypt.Models; 4 | using System.Collections.ObjectModel; 5 | using System.ComponentModel.Composition; 6 | 7 | namespace SimpleDnsCrypt.ViewModels 8 | { 9 | [Export(typeof(AddressBlockLogViewModel))] 10 | public class AddressBlockLogViewModel : Screen 11 | { 12 | private readonly IWindowManager _windowManager; 13 | private readonly IEventAggregator _events; 14 | 15 | private ObservableCollection _addressBlockLogLines; 16 | private string _addressBlockLogFile; 17 | private bool _isAddressBlockLogLogging; 18 | private AddressBlockLogLine _selectedAddressBlockLogLine; 19 | 20 | [ImportingConstructor] 21 | public AddressBlockLogViewModel(IWindowManager windowManager, IEventAggregator events) 22 | { 23 | _windowManager = windowManager; 24 | _events = events; 25 | _events.SubscribeOnPublishedThread(this); 26 | _isAddressBlockLogLogging = false; 27 | _addressBlockLogLines = new ObservableCollection(); 28 | } 29 | 30 | private void AddLogLine(AddressBlockLogLine addressBlockLogLine) 31 | { 32 | Execute.OnUIThread(() => 33 | { 34 | AddressBlockLogLines.Add(addressBlockLogLine); 35 | }); 36 | } 37 | 38 | public void ClearAddressBlockLog() 39 | { 40 | Execute.OnUIThread(() => { AddressBlockLogLines.Clear(); }); 41 | } 42 | 43 | public ObservableCollection AddressBlockLogLines 44 | { 45 | get => _addressBlockLogLines; 46 | set 47 | { 48 | if (value.Equals(_addressBlockLogLines)) return; 49 | _addressBlockLogLines = value; 50 | NotifyOfPropertyChange(() => AddressBlockLogLines); 51 | } 52 | } 53 | 54 | public string AddressBlockLogFile 55 | { 56 | get => _addressBlockLogFile; 57 | set 58 | { 59 | if (value.Equals(_addressBlockLogFile)) return; 60 | _addressBlockLogFile = value; 61 | NotifyOfPropertyChange(() => AddressBlockLogFile); 62 | } 63 | } 64 | 65 | public AddressBlockLogLine SelectedAddressBlockLogLine 66 | { 67 | get => _selectedAddressBlockLogLine; 68 | set 69 | { 70 | _selectedAddressBlockLogLine = value; 71 | NotifyOfPropertyChange(() => SelectedAddressBlockLogLine); 72 | } 73 | } 74 | 75 | public bool IsAddressBlockLogLogging 76 | { 77 | get => _isAddressBlockLogLogging; 78 | set 79 | { 80 | _isAddressBlockLogLogging = value; 81 | AddressBlockLog(DnscryptProxyConfigurationManager.DnscryptProxyConfiguration); 82 | NotifyOfPropertyChange(() => IsAddressBlockLogLogging); 83 | } 84 | } 85 | 86 | private void AddressBlockLog(DnscryptProxyConfiguration dnscryptProxyConfiguration) 87 | { 88 | 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/ViewModels/FallbackResolversViewModel.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | using SimpleDnsCrypt.Config; 3 | using SimpleDnsCrypt.Helper; 4 | using System.Collections.ObjectModel; 5 | using System.ComponentModel.Composition; 6 | 7 | namespace SimpleDnsCrypt.ViewModels 8 | { 9 | [Export(typeof(FallbackResolversViewModel))] 10 | public class FallbackResolversViewModel : Screen 11 | { 12 | private string _windowTitle; 13 | private ObservableCollection _fallbackResolvers; 14 | private string _selectedFallbackResolver; 15 | private string _addressInput; 16 | 17 | 18 | [ImportingConstructor] 19 | public FallbackResolversViewModel() 20 | { 21 | _fallbackResolvers = new ObservableCollection(); 22 | } 23 | 24 | /// 25 | /// The title of the window. 26 | /// 27 | public string WindowTitle 28 | { 29 | get => _windowTitle; 30 | set 31 | { 32 | _windowTitle = value; 33 | NotifyOfPropertyChange(() => WindowTitle); 34 | } 35 | } 36 | 37 | public ObservableCollection FallbackResolvers 38 | { 39 | get => _fallbackResolvers; 40 | set 41 | { 42 | _fallbackResolvers = value; 43 | NotifyOfPropertyChange(() => FallbackResolvers); 44 | } 45 | } 46 | 47 | public string SelectedFallbackResolver 48 | { 49 | get => _selectedFallbackResolver; 50 | set 51 | { 52 | _selectedFallbackResolver = value; 53 | NotifyOfPropertyChange(() => SelectedFallbackResolver); 54 | } 55 | } 56 | 57 | public string AddressInput 58 | { 59 | get => _addressInput; 60 | set 61 | { 62 | _addressInput = value; 63 | NotifyOfPropertyChange(() => AddressInput); 64 | } 65 | } 66 | 67 | public void AddAddress() 68 | { 69 | var validatedAddress = ValidationHelper.ValidateIpEndpoint(_addressInput); 70 | if (string.IsNullOrEmpty(validatedAddress)) return; 71 | if (FallbackResolvers.Contains(validatedAddress)) return; 72 | FallbackResolvers.Add(validatedAddress); 73 | AddressInput = string.Empty; 74 | } 75 | 76 | public void RemoveAddress() 77 | { 78 | if (string.IsNullOrEmpty(_selectedFallbackResolver)) return; 79 | if (_fallbackResolvers.Count == 1) return; 80 | _fallbackResolvers.Remove(_selectedFallbackResolver); 81 | } 82 | 83 | public void RestoreDefault() 84 | { 85 | FallbackResolvers.Clear(); 86 | FallbackResolvers = new ObservableCollection(Global.DefaultFallbackResolvers); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/ViewModels/ListenAddressesViewModel.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | using SimpleDnsCrypt.Config; 3 | using System.Collections.ObjectModel; 4 | using System.ComponentModel.Composition; 5 | using SimpleDnsCrypt.Helper; 6 | 7 | namespace SimpleDnsCrypt.ViewModels 8 | { 9 | [Export(typeof(ListenAddressesViewModel))] 10 | public class ListenAddressesViewModel : Screen 11 | { 12 | private string _windowTitle; 13 | private ObservableCollection _listenAddresses; 14 | private string _selectedListenAddress; 15 | private string _addressInput; 16 | 17 | 18 | [ImportingConstructor] 19 | public ListenAddressesViewModel() 20 | { 21 | _listenAddresses = new ObservableCollection(); 22 | } 23 | 24 | /// 25 | /// The title of the window. 26 | /// 27 | public string WindowTitle 28 | { 29 | get => _windowTitle; 30 | set 31 | { 32 | _windowTitle = value; 33 | NotifyOfPropertyChange(() => WindowTitle); 34 | } 35 | } 36 | 37 | public ObservableCollection ListenAddresses 38 | { 39 | get => _listenAddresses; 40 | set 41 | { 42 | _listenAddresses = value; 43 | NotifyOfPropertyChange(() => ListenAddresses); 44 | } 45 | } 46 | 47 | public string SelectedListenAddress 48 | { 49 | get => _selectedListenAddress; 50 | set 51 | { 52 | _selectedListenAddress = value; 53 | NotifyOfPropertyChange(() => SelectedListenAddress); 54 | } 55 | } 56 | 57 | public string AddressInput 58 | { 59 | get => _addressInput; 60 | set 61 | { 62 | _addressInput = value; 63 | NotifyOfPropertyChange(() => AddressInput); 64 | } 65 | } 66 | 67 | public void AddAddress() 68 | { 69 | var validatedAddress = ValidationHelper.ValidateIpEndpoint(_addressInput); 70 | if (string.IsNullOrEmpty(validatedAddress)) return; 71 | if (ListenAddresses.Contains(validatedAddress)) return; 72 | ListenAddresses.Add(validatedAddress); 73 | AddressInput = string.Empty; 74 | } 75 | 76 | public void RemoveAddress() 77 | { 78 | if (string.IsNullOrEmpty(_selectedListenAddress)) return; 79 | if (_listenAddresses.Count == 1) return; 80 | _listenAddresses.Remove(_selectedListenAddress); 81 | } 82 | 83 | public void RestoreDefault() 84 | { 85 | ListenAddresses.Clear(); 86 | ListenAddresses.Add(Global.DefaultResolverIpv4); 87 | ListenAddresses.Add(Global.DefaultResolverIpv6); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/ViewModels/ProxiesViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | using Caliburn.Micro; 3 | 4 | namespace SimpleDnsCrypt.ViewModels 5 | { 6 | [Export(typeof(ListenAddressesViewModel))] 7 | public class ProxiesViewModel : Screen 8 | { 9 | private readonly IWindowManager _windowManager; 10 | private readonly IEventAggregator _events; 11 | private string _windowTitle; 12 | private string _httpProxyInput; 13 | private string _socksProxyInput; 14 | 15 | public ProxiesViewModel() 16 | { 17 | } 18 | 19 | [ImportingConstructor] 20 | public ProxiesViewModel(IWindowManager windowManager, IEventAggregator events) 21 | { 22 | _windowManager = windowManager; 23 | _events = events; 24 | _events.SubscribeOnPublishedThread(this); 25 | } 26 | 27 | /// 28 | /// The title of the window. 29 | /// 30 | public string WindowTitle 31 | { 32 | get => _windowTitle; 33 | set 34 | { 35 | _windowTitle = value; 36 | NotifyOfPropertyChange(() => WindowTitle); 37 | } 38 | } 39 | 40 | public string HttpProxyInput 41 | { 42 | get => _httpProxyInput; 43 | set 44 | { 45 | _httpProxyInput = value; 46 | NotifyOfPropertyChange(() => HttpProxyInput); 47 | } 48 | } 49 | 50 | public string SocksProxyInput 51 | { 52 | get => _socksProxyInput; 53 | set 54 | { 55 | _socksProxyInput = value; 56 | NotifyOfPropertyChange(() => SocksProxyInput); 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/ViewModels/RouteViewModel.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | using GongSolutions.Wpf.DragDrop; 3 | using System.Collections.ObjectModel; 4 | using System.ComponentModel.Composition; 5 | using System.Linq; 6 | using System.Windows; 7 | using SimpleDnsCrypt.Utils.Models; 8 | 9 | namespace SimpleDnsCrypt.ViewModels 10 | { 11 | [Export(typeof(RouteViewModel))] 12 | public class RouteViewModel : Screen, IDropTarget 13 | { 14 | private string _resolver; 15 | 16 | [ImportingConstructor] 17 | public RouteViewModel() 18 | { 19 | } 20 | 21 | public string Resolver 22 | { 23 | get => _resolver; 24 | set 25 | { 26 | _resolver = value; 27 | NotifyOfPropertyChange(() => Resolver); 28 | } 29 | } 30 | 31 | private ObservableCollection _route; 32 | 33 | public ObservableCollection Route 34 | { 35 | get => _route; 36 | set 37 | { 38 | _route = value; 39 | NotifyOfPropertyChange(() => Route); 40 | } 41 | } 42 | 43 | public BindableCollection Relays { get; internal set; } 44 | 45 | public void Remove(StampFileEntry stampFileEntry) 46 | { 47 | if (stampFileEntry != null) 48 | { 49 | Route.Remove(stampFileEntry); 50 | } 51 | } 52 | 53 | void IDropTarget.DragOver(IDropInfo dropInfo) 54 | { 55 | if (dropInfo.Data is StampFileEntry && dropInfo.TargetItem is StampFileEntry || dropInfo.TargetItem is null) 56 | { 57 | dropInfo.DropTargetAdorner = DropTargetAdorners.Highlight; 58 | dropInfo.Effects = DragDropEffects.Move; 59 | } 60 | } 61 | 62 | void IDropTarget.Drop(IDropInfo dropInfo) 63 | { 64 | var stampFileEntry = (StampFileEntry)dropInfo.Data; 65 | if (Route.Where(s => s.Name.Equals(stampFileEntry.Name)).FirstOrDefault() != null) return; 66 | Route.Add(stampFileEntry); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/ViewModels/SystemTrayViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reactive.Linq; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | using Caliburn.Micro; 6 | using System.Windows; 7 | using System.Windows.Input; 8 | using ReactiveUI; 9 | 10 | namespace SimpleDnsCrypt.ViewModels 11 | { 12 | public class SystemTrayViewModel : Screen 13 | { 14 | private readonly IWindowManager _windowManager; 15 | private readonly MainViewModel _mainViewModel; 16 | private readonly IEventAggregator _events; 17 | 18 | public SystemTrayViewModel(IWindowManager windowManager, IEventAggregator events, MainViewModel mainViewModel) 19 | { 20 | _windowManager = windowManager; 21 | _events = events; 22 | _mainViewModel = mainViewModel; 23 | ShowWindowCommand = ReactiveCommand.Create(ShowWindow); 24 | ToggleWindowStateCommand = ReactiveCommand.Create(ToggleWindowState); 25 | ExitApplicationCommand = ReactiveCommand.Create(() => Application.Current.Shutdown()); 26 | } 27 | 28 | public ICommand ExitApplicationCommand { get; } 29 | 30 | protected override async Task OnActivateAsync(CancellationToken cancellationToken) 31 | { 32 | await base.OnActivateAsync(cancellationToken); 33 | _mainViewModel.ObservableForProperty(x => x.IsActive).TakeWhile(_ => IsActive).Do(_ => RefreshState()).Subscribe(); 34 | RefreshState(); 35 | } 36 | 37 | public ICommand ToggleWindowStateCommand { get; } 38 | 39 | private void ToggleWindowState() 40 | { 41 | if (_mainViewModel.IsActive) 42 | { 43 | HideWindow(); 44 | } 45 | else 46 | { 47 | ShowWindow(); 48 | } 49 | } 50 | 51 | public ICommand ShowWindowCommand { get; } 52 | 53 | private void ShowWindow() 54 | { 55 | if (!_mainViewModel.IsActive) 56 | { 57 | _windowManager.ShowWindowAsync(_mainViewModel); 58 | } 59 | 60 | RefreshState(); 61 | } 62 | 63 | public void HideWindow() 64 | { 65 | _mainViewModel.TryCloseAsync(); 66 | RefreshState(); 67 | } 68 | 69 | private void RefreshState() 70 | { 71 | NotifyOfPropertyChange(() => CanShowWindow); 72 | NotifyOfPropertyChange(() => CanHideWindow); 73 | } 74 | 75 | public bool CanShowWindow => !_mainViewModel.IsActive; 76 | public bool CanHideWindow => _mainViewModel.IsActive; 77 | } 78 | } -------------------------------------------------------------------------------- /SimpleDnsCrypt/Views/LoaderView.xaml: -------------------------------------------------------------------------------- 1 |  17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 45 | 46 | 48 | 32 | 35 | 38 | 41 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Windows/BaseWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleDnsCrypt.Windows 2 | { 3 | public partial class BaseWindow 4 | { 5 | public BaseWindow() 6 | { 7 | InitializeComponent(); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Windows/SplashDialogWindow.xaml: -------------------------------------------------------------------------------- 1 |  18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/Windows/SplashDialogWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace SimpleDnsCrypt.Windows 2 | { 3 | public partial class SplashDialogWindow 4 | { 5 | public SplashDialogWindow() 6 | { 7 | InitializeComponent(); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/dnscrypt-proxy/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2018-2023, Frank Denis 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 10 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 11 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 12 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 14 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15 | PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /SimpleDnsCrypt/dnscrypt-proxy/dnscrypt-proxy.toml.example: -------------------------------------------------------------------------------- 1 | listen_addresses = ['127.0.0.1:53', '[::1]:53'] 2 | max_clients = 250 3 | ipv4_servers = true 4 | ipv6_servers = false 5 | dnscrypt_servers = true 6 | doh_servers = true 7 | require_dnssec = true 8 | require_nolog = true 9 | require_nofilter = true 10 | force_tcp = false 11 | timeout = 5000 12 | keepalive = 30 13 | cert_refresh_delay = 240 14 | fallback_resolvers = ['9.9.9.9:53', '8.8.8.8:53'] 15 | ignore_system_dns = true 16 | netprobe_timeout = 60 17 | netprobe_address = '9.9.9.9:53' 18 | log_files_max_size = 10 19 | log_files_max_age = 7 20 | log_files_max_backups = 1 21 | block_ipv6 = true 22 | block_unqualified = true 23 | block_undelegated = true 24 | reject_ttl = 600 25 | cache = true 26 | cache_size = 1024 27 | cache_min_ttl = 2400 28 | cache_max_ttl = 86400 29 | cache_neg_min_ttl = 60 30 | cache_neg_max_ttl = 600 31 | disabled_server_names = [] 32 | [query_log] 33 | format = 'ltsv' 34 | 35 | [nx_log] 36 | format = 'ltsv' 37 | 38 | [blocked_names] 39 | 40 | [blocked_ips] 41 | 42 | [broken_implementations] 43 | fragments_blocked = ['cisco', 'cisco-ipv6', 'cisco-familyshield', 'cisco-familyshield-ipv6', 'quad9-dnscrypt-ip4-filter-alt', 'quad9-dnscrypt-ip4-filter-pri', 'quad9-dnscrypt-ip4-nofilter-alt', 'quad9-dnscrypt-ip4-nofilter-pri', 'quad9-dnscrypt-ip6-filter-alt', 'quad9-dnscrypt-ip6-filter-pri', 'quad9-dnscrypt-ip6-nofilter-alt', 'quad9-dnscrypt-ip6-nofilter-pri', 'cleanbrowsing-adult', 'cleanbrowsing-family-ipv6', 'cleanbrowsing-family', 'cleanbrowsing-security'] 44 | 45 | [anonymized_dns] 46 | skip_incompatible = false 47 | 48 | [sources] 49 | 50 | [sources.'public-resolvers'] 51 | urls = ['https://raw.githubusercontent.com/DNSCrypt/dnscrypt-resolvers/master/v3/public-resolvers.md', 'https://download.dnscrypt.info/resolvers-list/v3/public-resolvers.md', 'https://ipv6.download.dnscrypt.info/resolvers-list/v3/public-resolvers.md'] 52 | cache_file = 'public-resolvers.md' 53 | minisign_key = 'RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3' 54 | prefix = '' 55 | 56 | [sources.'relays'] 57 | urls = ['https://raw.githubusercontent.com/DNSCrypt/dnscrypt-resolvers/master/v3/relays.md', 'https://download.dnscrypt.info/resolvers-list/v3/relays.md', 'https://ipv6.download.dnscrypt.info/resolvers-list/v3/relays.md'] 58 | cache_file = 'relays.md' 59 | minisign_key = 'RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3' 60 | refresh_delay = 72 61 | prefix = '' -------------------------------------------------------------------------------- /SimpleDnsCrypt/dnscrypt-proxy/dnscrypt-proxy64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/SimpleDnsCrypt/dnscrypt-proxy/dnscrypt-proxy64.exe -------------------------------------------------------------------------------- /SimpleDnsCrypt/dnscrypt-proxy/dnscrypt-proxy86.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/SimpleDnsCrypt/dnscrypt-proxy/dnscrypt-proxy86.exe -------------------------------------------------------------------------------- /Tests/StampDecodeTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using SimpleDnsCrypt.Utils; 3 | using SimpleDnsCrypt.Utils.Models; 4 | 5 | namespace Tests 6 | { 7 | public class StampDecodeTests 8 | { 9 | [Test] 10 | public void StampDecodeTest1() 11 | { 12 | const string stamp = "sdns://AQcAAAAAAAAADjIxMi40Ny4yMjguMTM2IOgBuE6mBr-wusDOQ0RbsV66ZLAvo8SqMa4QY2oHkDJNHzIuZG5zY3J5cHQtY2VydC5mci5kbnNjcnlwdC5vcmc"; 13 | var result = StampTools.Decode(stamp); 14 | Assert.AreEqual(StampProtocol.DnsCrypt, result.Protocol); 15 | Assert.AreEqual("2.dnscrypt-cert.fr.dnscrypt.org", result.ProviderName); 16 | } 17 | 18 | [Test] 19 | public void StampDecodeTest2() 20 | { 21 | const string stamp = "sdns://AgcAAAAAAAAADTM3LjU5LjIzOC4yMTMgwzRA_TfjYt0RwSHqBHwj7OM-D_x-CDgqIHeJHIoN1P0UZG9oLmZyLmRuc2NyeXB0LmluZm8KL2Rucy1xdWVyeQ"; 22 | var result = StampTools.Decode(stamp); 23 | Assert.AreEqual(StampProtocol.DoH, result.Protocol); 24 | Assert.AreEqual("doh.fr.dnscrypt.info", result.Hostname); 25 | } 26 | 27 | [Test] 28 | public void StampDecodeTest3() 29 | { 30 | const string stamp = "sdns://AgUAAAAAAAAAACDyXGrcc5eNecJ8nomJCJ-q6eCLTEn6bHic0hWGUwYQaA5kbnMuZ29vZ2xlLmNvbQ0vZXhwZXJpbWVudGFs"; 31 | var result = StampTools.Decode(stamp); 32 | Assert.AreEqual(StampProtocol.DoH, result.Protocol); 33 | Assert.AreEqual("dns.google.com", result.Hostname); 34 | } 35 | 36 | [Test] 37 | public void StampDecodeTestRelay() 38 | { 39 | const string stamp = "sdns://gQ84My43Ny44NS43Ojg0NDM"; 40 | var result = StampTools.Decode(stamp); 41 | Assert.AreEqual(StampProtocol.DNSCryptRelay, result.Protocol); 42 | Assert.AreEqual("83.77.85.7", result.Address); 43 | } 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Tests/StampEncodeTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using SimpleDnsCrypt.Utils; 3 | using SimpleDnsCrypt.Utils.Models; 4 | 5 | namespace Tests 6 | { 7 | public class StampEncodeTests 8 | { 9 | [Test] 10 | public void StampEncodeTest1() 11 | { 12 | var stampObject = new Stamp 13 | { 14 | Protocol = StampProtocol.DnsCrypt, 15 | ProviderName = "2.dnscrypt-cert.fr.dnscrypt.org", 16 | PublicKey = "e801b84ea606bfb0bac0ce43445bb15eba64b02fa3c4aa31ae10636a0790324d", 17 | Address = "212.47.228.136", 18 | Properties = new StampProperties 19 | { 20 | DnsSec = true, 21 | NoFilter = true, 22 | NoLog = true 23 | } 24 | }; 25 | var result = StampTools.Encode(stampObject); 26 | const string stamp = "sdns://AQcAAAAAAAAADjIxMi40Ny4yMjguMTM2IOgBuE6mBr-wusDOQ0RbsV66ZLAvo8SqMa4QY2oHkDJNHzIuZG5zY3J5cHQtY2VydC5mci5kbnNjcnlwdC5vcmc"; 27 | Assert.AreEqual(stamp, result); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Tests/Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8-windows10.0.19041 4 | false 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | all 13 | runtime; build; native; contentfiles; analyzers; buildtransitive 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Uninstall/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Net.NetworkInformation; 6 | 7 | namespace Uninstall 8 | { 9 | internal class Program 10 | { 11 | private static void Main() 12 | { 13 | try 14 | { 15 | ClearLocalNetworkInterfaces(); 16 | } 17 | finally 18 | { 19 | Environment.Exit(0); 20 | } 21 | } 22 | 23 | /// 24 | /// Execute process with arguments 25 | /// 26 | internal static void ExecuteWithArguments(string filename, string arguments) 27 | { 28 | try 29 | { 30 | const int timeout = 9000; 31 | using (var process = new Process()) 32 | { 33 | process.StartInfo.FileName = filename; 34 | process.StartInfo.Arguments = arguments; 35 | process.StartInfo.UseShellExecute = false; 36 | process.StartInfo.CreateNoWindow = true; 37 | process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; 38 | process.Start(); 39 | if (process.WaitForExit(timeout)) 40 | { 41 | if (process.ExitCode == 0) 42 | { 43 | //do nothing 44 | } 45 | } 46 | else 47 | { 48 | // Timed out. 49 | throw new Exception("Timed out"); 50 | } 51 | } 52 | } 53 | catch (Exception) { } 54 | } 55 | 56 | /// 57 | /// Clear all network interfaces. 58 | /// 59 | internal static void ClearLocalNetworkInterfaces() 60 | { 61 | try 62 | { 63 | string[] networkInterfaceBlacklist = 64 | { 65 | "Microsoft Virtual", 66 | "Hamachi Network", 67 | "VMware Virtual", 68 | "VirtualBox", 69 | "Software Loopback", 70 | "Microsoft ISATAP", 71 | "Microsoft-ISATAP", 72 | "Teredo Tunneling Pseudo-Interface", 73 | "Microsoft Wi-Fi Direct Virtual", 74 | "Microsoft Teredo Tunneling Adapter", 75 | "Von Microsoft gehosteter", 76 | "Microsoft hosted", 77 | "Virtueller Microsoft-Adapter", 78 | "TAP" 79 | }; 80 | 81 | var networkInterfaces = NetworkInterface.GetAllNetworkInterfaces() 82 | .Where(nic => nic.OperationalStatus == OperationalStatus.Up) 83 | .Where(nic => !networkInterfaceBlacklist.Any(blacklistEntry => nic.Description.Contains(blacklistEntry) || nic.Name.Contains(blacklistEntry))) 84 | .ToList(); 85 | 86 | foreach (var networkInterface in networkInterfaces) 87 | { 88 | ExecuteWithArguments("netsh", $"interface ipv4 delete dns \"{networkInterface.Name}\" all"); 89 | ExecuteWithArguments("netsh", $"interface ipv6 delete dns \"{networkInterface.Name}\" all"); 90 | } 91 | } 92 | catch 93 | { 94 | } 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /Uninstall/Properties/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Uninstall/Uninstall.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Exe 4 | net8-windows10.0.19041 5 | Uninstall helper for Simple DNSCrypt 6 | Uninstall helper for Simple DNSCrypt 7 | Uninstall helper for Simple DNSCrypt 8 | Copyright © 2015 - 2020 Christian Hermann, 2021 - 2023 instant.sc 9 | 0.8.2 10 | 0.8.2 11 | simplednscrypt.ico 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Uninstall/simplednscrypt.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/Uninstall/simplednscrypt.ico -------------------------------------------------------------------------------- /img/icons/128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/icons/128x128.png -------------------------------------------------------------------------------- /img/icons/16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/icons/16x16.png -------------------------------------------------------------------------------- /img/icons/24x24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/icons/24x24.png -------------------------------------------------------------------------------- /img/icons/256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/icons/256x256.png -------------------------------------------------------------------------------- /img/icons/32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/icons/32x32.png -------------------------------------------------------------------------------- /img/icons/48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/icons/48x48.png -------------------------------------------------------------------------------- /img/icons/64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/icons/64x64.png -------------------------------------------------------------------------------- /img/icons/96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/icons/96x96.png -------------------------------------------------------------------------------- /img/logo_with_text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/logo_with_text.png -------------------------------------------------------------------------------- /img/old/about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/old/about.png -------------------------------------------------------------------------------- /img/old/advanced.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/old/advanced.png -------------------------------------------------------------------------------- /img/old/analyse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/old/analyse.png -------------------------------------------------------------------------------- /img/old/blacklist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/old/blacklist.png -------------------------------------------------------------------------------- /img/old/livelog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/old/livelog.png -------------------------------------------------------------------------------- /img/old/livelog_modal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/old/livelog_modal.png -------------------------------------------------------------------------------- /img/old/plugins.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/old/plugins.png -------------------------------------------------------------------------------- /img/old/standard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/old/standard.png -------------------------------------------------------------------------------- /img/preview/advancedsettings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/preview/advancedsettings.png -------------------------------------------------------------------------------- /img/preview/blacklist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/preview/blacklist.png -------------------------------------------------------------------------------- /img/preview/blocklog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/preview/blocklog.png -------------------------------------------------------------------------------- /img/preview/custom_resolver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/preview/custom_resolver.png -------------------------------------------------------------------------------- /img/preview/mainmenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/preview/mainmenu.png -------------------------------------------------------------------------------- /img/preview/resolvers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/preview/resolvers.png -------------------------------------------------------------------------------- /img/preview/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/preview/settings.png -------------------------------------------------------------------------------- /img/simplednscrypt_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instantsc/SimpleDnsCrypt/580257bfd0d19fe3b18321640c59642771a57c56/img/simplednscrypt_256.png --------------------------------------------------------------------------------