Browse Source

Merge pull request #2728 from celeron533/config_gfwlist

Support custom GFWListUrl defined in config file
tags/4.1.9.0
Allen Zhu GitHub 4 years ago
parent
commit
8d9c9ca13e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions
  1. +8
    -2
      shadowsocks-csharp/Controller/Service/GfwListUpdater.cs
  2. +1
    -0
      shadowsocks-csharp/Model/Configuration.cs

+ 8
- 2
shadowsocks-csharp/Controller/Service/GfwListUpdater.cs View File

@@ -90,7 +90,13 @@ var __RULES__ = {JsonConvert.SerializeObject(gfwLines, Formatting.Indented)};

public void UpdatePACFromGFWList(Configuration config)
{
Logging.Info($"Checking GFWList from {GFWLIST_URL}");
string gfwListUrl = GFWLIST_URL;
if (!string.IsNullOrWhiteSpace(config.gfwListUrl))
{
Logging.Info("Found custom GFWListURL in config file");
gfwListUrl = config.gfwListUrl;
}
Logging.Info($"Checking GFWList from {gfwListUrl}");
WebClient http = new WebClient();
if (config.enabled)
{
@@ -101,7 +107,7 @@ var __RULES__ = {JsonConvert.SerializeObject(gfwLines, Formatting.Indented)};
config.localPort);
}
http.DownloadStringCompleted += http_DownloadStringCompleted;
http.DownloadStringAsync(new Uri(GFWLIST_URL));
http.DownloadStringAsync(new Uri(gfwListUrl));
}

public static List<string> ParseBase64ToValidList(string response)


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

@@ -25,6 +25,7 @@ namespace Shadowsocks.Model
public bool portableMode = true;
public bool showPluginOutput;
public string pacUrl;
public string gfwListUrl;
public bool useOnlinePac;
public bool secureLocalPac = true;
public bool availabilityStatistics;


Loading…
Cancel
Save