Browse Source

📃 Exclude @cn from PAC proxied list

- PAC proxied list only contains domain names from geolocation-!cn without a `cn` attribute
tags/4.2.1.0
database64128 4 years ago
parent
commit
2002c29ee3
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      shadowsocks-csharp/Controller/Service/GeositeUpdater.cs

+ 9
- 3
shadowsocks-csharp/Controller/Service/GeositeUpdater.cs View File

@@ -39,15 +39,18 @@ namespace Shadowsocks.Controller
private static HttpClient httpClient; private static HttpClient httpClient;
private static readonly string GEOSITE_URL = "https://github.com/v2fly/domain-list-community/raw/release/dlc.dat"; private static readonly string GEOSITE_URL = "https://github.com/v2fly/domain-list-community/raw/release/dlc.dat";
private static readonly string GEOSITE_SHA256SUM_URL = "https://github.com/v2fly/domain-list-community/raw/release/dlc.dat.sha256sum"; private static readonly string GEOSITE_SHA256SUM_URL = "https://github.com/v2fly/domain-list-community/raw/release/dlc.dat.sha256sum";
private static readonly DomainObject.Types.Attribute geositeExcludeAttribute;
private static byte[] geositeDB; private static byte[] geositeDB;


public static readonly Dictionary<string, IList<DomainObject>> Geosites = new Dictionary<string, IList<DomainObject>>(); public static readonly Dictionary<string, IList<DomainObject>> Geosites = new Dictionary<string, IList<DomainObject>>();


static GeositeUpdater() static GeositeUpdater()
{ {
//socketsHttpHandler = new SocketsHttpHandler();
//httpClient = new HttpClient(socketsHttpHandler);
geositeExcludeAttribute = new DomainObject.Types.Attribute
{
Key = "cn",
BoolValue = true
};
if (File.Exists(DATABASE_PATH) && new FileInfo(DATABASE_PATH).Length > 0) if (File.Exists(DATABASE_PATH) && new FileInfo(DATABASE_PATH).Length > 0)
{ {
geositeDB = File.ReadAllBytes(DATABASE_PATH); geositeDB = File.ReadAllBytes(DATABASE_PATH);
@@ -241,6 +244,9 @@ var __RULES__ = {JsonConvert.SerializeObject(gfwLines, Formatting.Indented)};
List<string> ret = new List<string>(domains.Count + 100);// 100 overhead List<string> ret = new List<string>(domains.Count + 100);// 100 overhead
foreach (var d in domains) foreach (var d in domains)
{ {
if (d.Attribute.Contains(geositeExcludeAttribute))
continue;

string domain = d.Value; string domain = d.Value;


switch (d.Type) switch (d.Type)


Loading…
Cancel
Save