Browse Source

update detector works when update from v4.1.2 and before

Configuration.version added in 0e426ffe, only 1 year ago
tags/4.1.9.3
Student Main 5 years ago
parent
commit
a8b11ea30b
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      shadowsocks-csharp/Model/Configuration.cs

+ 6
- 4
shadowsocks-csharp/Model/Configuration.cs View File

@@ -43,7 +43,8 @@ namespace Shadowsocks.Model
[JsonIgnore]
public string localHost => GetLocalHost();
private string GetLocalHost() {
private string GetLocalHost()
{
return isIPv6Enabled ? "[::1]" : "127.0.0.1";
}
public Server GetCurrentServer()
@@ -82,9 +83,9 @@ namespace Shadowsocks.Model
string configContent = File.ReadAllText(CONFIG_FILE);
Configuration config = JsonConvert.DeserializeObject<Configuration>(configContent);
config.isDefault = false;
if (UpdateChecker.Asset.CompareVersion(UpdateChecker.Version, config.version) > 0)
if (UpdateChecker.Asset.CompareVersion(UpdateChecker.Version, config.version ?? "0") > 0)
{
config.updated = true;
config.updated = true;
}
if (config.configs == null)
@@ -101,7 +102,8 @@ namespace Shadowsocks.Model
config.proxy = new ProxyConfig();
if (config.hotkey == null)
config.hotkey = new HotkeyConfig();
if (!System.Net.Sockets.Socket.OSSupportsIPv6) {
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?


Loading…
Cancel
Save