Skip to content

Commit 1295caf

Browse files
committed
Some code cleanup
1 parent ab78dfc commit 1295caf

3 files changed

Lines changed: 45 additions & 2 deletions

File tree

SimpleDnsCrypt/Config/Global.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ public static class Global
4242
/// </summary>
4343
public const string SecondaryResolverAddress = "127.0.0.2";
4444

45+
/// <summary>
46+
/// Local address the primary resolver will listen on.
47+
/// </summary>
48+
public const string PrimaryResolverAddress6 = "::FFFF:127.0.0.1";
49+
50+
/// <summary>
51+
/// Local address the secondary resolver will listen on.
52+
/// </summary>
53+
public const string SecondaryResolverAddress6 = "::FFFF:127.0.0.2";
54+
4555
/// <summary>
4656
/// Address for the global gateway.
4757
/// </summary>

SimpleDnsCrypt/Tools/LocalNetworkInterfaceManager.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,15 @@ internal static List<LocalNetworkInterface> GetLocalNetworkInterfaces(bool showH
7070
internal static bool IsUsingDnsCrypt(LocalNetworkInterface localNetworkInterface)
7171
{
7272
var dns = new List<string> {Global.PrimaryResolverAddress, Global.SecondaryResolverAddress};
73+
var dns6 = new List<string> { Global.PrimaryResolverAddress6, Global.SecondaryResolverAddress6 };
7374
if ((localNetworkInterface.Ipv4Dns.Contains(dns[0])) || (localNetworkInterface.Ipv4Dns.Contains(dns[1])))
7475
{
7576
return true;
7677
}
78+
if ((localNetworkInterface.Ipv6Dns.Contains(dns6[0])) || (localNetworkInterface.Ipv6Dns.Contains(dns6[1])))
79+
{
80+
return true;
81+
}
7782
return false;
7883
}
7984

@@ -110,7 +115,7 @@ internal static List<string> GetDnsServerList(string localNetworkInterface,
110115
}
111116

112117
/// <summary>
113-
/// Set's the IPv4 DNS Servers of an interface.
118+
/// Set's the IPv4 or IPv6 DNS Servers of an interface.
114119
/// </summary>
115120
/// <param name="localNetworkInterface">The interface to work with.</param>
116121
/// <param name="dnsServers">List of dns servers to set.</param>

SimpleDnsCrypt/ViewModels/MainViewModel.cs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,17 @@ public MainViewModel()
5959
/// </summary>
6060
/// <param name="windowManager">The current window manager.</param>
6161
/// <param name="eventAggregator">The event aggregator.</param>
62-
/// <param name="dnsCrypt"></param>
6362
[ImportingConstructor]
6463
private MainViewModel(IWindowManager windowManager, IEventAggregator eventAggregator)
6564
{
6665
_windowManager = windowManager;
6766
eventAggregator.Subscribe(this);
6867

68+
// automatically use the correct translations if available (fallback: en)
6969
LocalizeDictionary.Instance.SetCurrentThreadCulture = true;
7070
LocalizeDictionary.Instance.Culture = Thread.CurrentThread.CurrentCulture;
7171

72+
// this is already defined in the app.manifest, but to be sure check it again
7273
if (!IsAdministrator())
7374
{
7475
_windowManager.ShowMetroMessageBox(
@@ -261,6 +262,9 @@ public List<DnsCryptProxyEntry> Resolvers
261262
}
262263
}
263264

265+
/// <summary>
266+
/// The selected primary resolver.
267+
/// </summary>
264268
public DnsCryptProxyEntry PrimaryResolver
265269
{
266270
get { return _primaryResolver; }
@@ -273,6 +277,9 @@ public DnsCryptProxyEntry PrimaryResolver
273277
}
274278
}
275279

280+
/// <summary>
281+
/// The selected secondary resolver.
282+
/// </summary>
276283
public DnsCryptProxyEntry SecondaryResolver
277284
{
278285
get { return _secondaryResolver; }
@@ -285,6 +292,9 @@ public DnsCryptProxyEntry SecondaryResolver
285292
}
286293
}
287294

295+
/// <summary>
296+
/// Show or hide the filtered network cards.
297+
/// </summary>
288298
public bool ShowHiddenCards
289299
{
290300
get { return _showHiddenCards; }
@@ -296,6 +306,9 @@ public bool ShowHiddenCards
296306
}
297307
}
298308

309+
/// <summary>
310+
/// Formatted name of the primary resolver.
311+
/// </summary>
299312
public string PrimaryResolverTitle
300313
{
301314
get { return _primaryResolverTitle; }
@@ -306,6 +319,9 @@ public string PrimaryResolverTitle
306319
}
307320
}
308321

322+
/// <summary>
323+
/// Formatted name of the secondary resolver.
324+
/// </summary>
309325
public string SecondaryResolverTitle
310326
{
311327
get { return _secondaryResolverTitle; }
@@ -316,6 +332,9 @@ public string SecondaryResolverTitle
316332
}
317333
}
318334

335+
/// <summary>
336+
/// Controls the primary resolver.
337+
/// </summary>
319338
public bool IsPrimaryResolverRunning
320339
{
321340
get { return _isPrimaryResolverRunning; }
@@ -326,6 +345,9 @@ public bool IsPrimaryResolverRunning
326345
}
327346
}
328347

348+
/// <summary>
349+
/// Controls the secondary resolver.
350+
/// </summary>
329351
public bool IsSecondaryResolverRunning
330352
{
331353
get { return _isSecondaryResolverRunning; }
@@ -336,6 +358,9 @@ public bool IsSecondaryResolverRunning
336358
}
337359
}
338360

361+
/// <summary>
362+
/// Show or hide the progress bar for the primary resolver.
363+
/// </summary>
339364
public bool IsWorkingOnPrimaryService
340365
{
341366
get { return _isWorkingOnPrimaryService; }
@@ -346,6 +371,9 @@ public bool IsWorkingOnPrimaryService
346371
}
347372
}
348373

374+
/// <summary>
375+
/// Show or hide the progress bar for the secondary resolver.
376+
/// </summary>
349377
public bool IsWorkingOnSecondaryService
350378
{
351379
get { return _isWorkingOnSecondaryService; }

0 commit comments

Comments
 (0)