Browse Source

Add IPv6 param flag to config

tags/4.1.7
Yifei0727 5 years ago
parent
commit
da9af1cf72
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      shadowsocks-csharp/Model/Configuration.cs

+ 9
- 0
shadowsocks-csharp/Model/Configuration.cs View File

@@ -21,6 +21,7 @@ namespace Shadowsocks.Model
public bool enabled;
public bool shareOverLan;
public bool isDefault;
public bool isIPv6Enabled = false;
public int localPort;
public bool portableMode = true;
public string pacUrl;
@@ -36,6 +37,10 @@ namespace Shadowsocks.Model
private static string CONFIG_FILE = "gui-config.json";
public string LocalHost => GetLocalHost();
private string GetLocalHost() {
return isIPv6Enabled ? "[::1]" : "127.0.0.1";
}
public Server GetCurrentServer()
{
if (index >= 0 && index < configs.Count)
@@ -74,6 +79,10 @@ namespace Shadowsocks.Model
config.proxy = new ProxyConfig();
if (config.hotkey == null)
config.hotkey = new HotkeyConfig();
if (!System.Net.Sockets.Socket.OSSupportsIPv6) {
config.isIPv6Enabled = false; // disable IPv6 if os not support
}
//TODO if remote host(server) do not support IPv6 (or DNS resolve AAAA TYPE record) disable IPv6?
config.proxy.CheckConfig();


Loading…
Cancel
Save