Skip to content

Commit 982dd66

Browse files
committed
Cloaking
- Added Views and Logic
1 parent 0360ac6 commit 982dd66

19 files changed

Lines changed: 887 additions & 6 deletions

SimpleDnsCrypt/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@
8383
<setting name="BackupAndRestoreConfigOnUpdate" serializeAs="String">
8484
<value>True</value>
8585
</setting>
86+
<setting name="CloakingRulesFile" serializeAs="String">
87+
<value />
88+
</setting>
89+
<setting name="IsCloakAndForwardTabVisible" serializeAs="String">
90+
<value>False</value>
91+
</setting>
8692
</SimpleDnsCrypt.Properties.Settings>
8793
</userSettings>
8894
</configuration>

SimpleDnsCrypt/Config/Global.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ public static class Global
7575
public const string BlacklistRuleFileName = "domain-blacklist.txt";
7676
public const string BlacklistFileName = "blacklist.txt";
7777

78-
public const string GlobalResolver = "0.0.0.0:53";
78+
public const string CloakingRulesFileName = "cloaking-rules.txt";
79+
80+
81+
public const string GlobalResolver = "0.0.0.0:53";
7982
public const string DefaultResolverIpv4 = "127.0.0.1:53";
8083
public const string DefaultResolverIpv6 = "[::1]:53";
8184

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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+
}

SimpleDnsCrypt/Models/DnscryptProxyConfiguration.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public class DnscryptProxyConfiguration : PropertyChangedBase
3838
private int _log_files_max_backups;
3939
private bool _block_ipv6;
4040
private string _forwarding_rules;
41+
private string _cloaking_rules;
4142
private int _cache_neg_ttl;
4243
private int _cache_max_ttl;
4344
private int _cache_min_ttl;
@@ -485,6 +486,19 @@ public string forwarding_rules
485486
}
486487
}
487488

489+
/// <summary>
490+
/// Cloaking rule file.
491+
/// </summary>
492+
public string cloaking_rules
493+
{
494+
get => _cloaking_rules;
495+
set
496+
{
497+
_cloaking_rules = value;
498+
NotifyOfPropertyChange(() => cloaking_rules);
499+
}
500+
}
501+
488502
/// <summary>
489503
/// Enable a DNS cache to reduce latency and outgoing traffic.
490504
/// </summary>

SimpleDnsCrypt/Models/Rule.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace SimpleDnsCrypt.Models
2+
{
3+
public class Rule
4+
{
5+
public string Key { get; set; }
6+
public string Value { get; set; }
7+
}
8+
}

SimpleDnsCrypt/Properties/Settings.Designer.cs

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SimpleDnsCrypt/Properties/Settings.settings

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,11 @@
5959
<Setting Name="BackupAndRestoreConfigOnUpdate" Type="System.Boolean" Scope="User">
6060
<Value Profile="(Default)">True</Value>
6161
</Setting>
62+
<Setting Name="CloakingRulesFile" Type="System.String" Scope="User">
63+
<Value Profile="(Default)" />
64+
</Setting>
65+
<Setting Name="IsCloakAndForwardTabVisible" Type="System.Boolean" Scope="User">
66+
<Value Profile="(Default)">False</Value>
67+
</Setting>
6268
</Settings>
6369
</SettingsFile>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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/SimpleDnsCrypt.csproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@
8282
<Reference Include="MahApps.Metro.IconPacks.Material, Version=2.3.0.4, Culture=neutral, processorArchitecture=MSIL">
8383
<HintPath>..\packages\MahApps.Metro.IconPacks.Material.2.3.0\lib\net46\MahApps.Metro.IconPacks.Material.dll</HintPath>
8484
</Reference>
85+
<Reference Include="MahApps.Metro.SimpleChildWindow, Version=1.5.0.16, Culture=neutral, processorArchitecture=MSIL">
86+
<HintPath>..\packages\MahApps.Metro.SimpleChildWindow.1.5.0\lib\net45\MahApps.Metro.SimpleChildWindow.dll</HintPath>
87+
</Reference>
8588
<Reference Include="minisign, Version=0.1.2.0, Culture=neutral, processorArchitecture=MSIL">
8689
<HintPath>..\packages\minisign-net.0.1.2\lib\net\minisign.dll</HintPath>
8790
</Reference>
@@ -185,6 +188,7 @@
185188
<Compile Include="Logger\NLogLogger.cs" />
186189
<Compile Include="LogMode.cs" />
187190
<Compile Include="Models\AddressBlockLogLine.cs" />
191+
<Compile Include="Models\AddRuleWindowResult.cs" />
188192
<Compile Include="Models\AvailableResolver.cs" />
189193
<Compile Include="Models\BoxType.cs" />
190194
<Compile Include="Models\DomainBlockLogLine.cs" />
@@ -197,6 +201,7 @@
197201
<Compile Include="Models\QueryLogLine.cs" />
198202
<Compile Include="Models\QueryLogLineType.cs" />
199203
<Compile Include="Models\RemoteUpdate.cs" />
204+
<Compile Include="Models\Rule.cs" />
200205
<Compile Include="Models\Stamp.cs" />
201206
<Compile Include="Models\ValueDescription.cs" />
202207
<Compile Include="Resources\Translation.Designer.cs">
@@ -222,6 +227,7 @@
222227
</Page>
223228
<Compile Include="ViewModels\AddressBlacklistViewModel.cs" />
224229
<Compile Include="ViewModels\AddressBlockLogViewModel.cs" />
230+
<Compile Include="ViewModels\CloakAndForwardViewModel.cs" />
225231
<Compile Include="ViewModels\ListenAddressesViewModel.cs" />
226232
<Compile Include="ViewModels\MetroMessageBoxViewModel.cs" />
227233
<Compile Include="ViewModels\ProxiesViewModel.cs" />
@@ -237,6 +243,9 @@
237243
<SubType>Code</SubType>
238244
</Compile>
239245
<Compile Include="ViewModels\SystemTrayViewModel.cs" />
246+
<Compile Include="Windows\AddRuleWindow.xaml.cs">
247+
<DependentUpon>AddRuleWindow.xaml</DependentUpon>
248+
</Compile>
240249
<Compile Include="Windows\BaseMessageDialogWindow.xaml.cs">
241250
<DependentUpon>BaseMessageDialogWindow.xaml</DependentUpon>
242251
</Compile>
@@ -300,6 +309,10 @@
300309
<SubType>Designer</SubType>
301310
<Generator>MSBuild:Compile</Generator>
302311
</Page>
312+
<Page Include="Windows\AddRuleWindow.xaml">
313+
<SubType>Designer</SubType>
314+
<Generator>MSBuild:Compile</Generator>
315+
</Page>
303316
<Page Include="Windows\BaseMessageDialogWindow.xaml">
304317
<SubType>Designer</SubType>
305318
<Generator>MSBuild:Compile</Generator>
@@ -505,6 +518,7 @@
505518
<ItemGroup>
506519
<Content Include="DNSx64\dnscrypt-proxy.exe" />
507520
<Content Include="DNSx86\dnscrypt-proxy.exe" />
521+
<EmbeddedResource Include="Resources\Licenses\MahApps.Metro.SimpleChildWindow.txt" />
508522
<EmbeddedResource Include="Resources\Licenses\Hardcodet.NotifyIcon.txt" />
509523
<EmbeddedResource Include="Resources\Licenses\NLog.txt" />
510524
<EmbeddedResource Include="Resources\Licenses\Baseclass.Contrib.Nuget.Output.txt" />

SimpleDnsCrypt/ViewModels/AboutViewModel.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,16 @@ private async void AddLicenses()
284284
LinkText = LocalizationEx.GetUiString("about_view_on_github", Thread.CurrentThread.CurrentCulture),
285285
LinkUri = new Uri("https://github.com/nlog/NLog")
286286
}
287+
},
288+
new License
289+
{
290+
LicenseHeaderText = "MahApps.Metro.SimpleChildWindow",
291+
LicenseText = await LoadLicense("MahApps.Metro.SimpleChildWindow.txt").ConfigureAwait(false),
292+
LicenseCodeLink = new LicenseLink
293+
{
294+
LinkText = LocalizationEx.GetUiString("about_view_on_github", Thread.CurrentThread.CurrentCulture),
295+
LinkUri = new Uri("https://github.com/punker76/MahApps.Metro.SimpleChildWindow")
296+
}
287297
}
288298
};
289299
var orderedList = tmpList.OrderBy(l => l.LicenseHeaderText);

0 commit comments

Comments
 (0)