use v2ray geosite to replace gfwlisttags/4.2.0.0
@@ -0,0 +1,203 @@ | |||
using NLog; | |||
using Shadowsocks.Properties; | |||
using Shadowsocks.Util; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.IO; | |||
using System.Linq; | |||
using System.Text; | |||
using Newtonsoft.Json; | |||
using Shadowsocks.Model; | |||
using System.Net; | |||
namespace Shadowsocks.Controller | |||
{ | |||
public class GeositeResultEventArgs : EventArgs | |||
{ | |||
public bool Success; | |||
public GeositeResultEventArgs(bool success) | |||
{ | |||
this.Success = success; | |||
} | |||
} | |||
public static class GeositeUpdater | |||
{ | |||
private static Logger logger = LogManager.GetCurrentClassLogger(); | |||
public static event EventHandler<GeositeResultEventArgs> UpdateCompleted; | |||
public static event ErrorEventHandler Error; | |||
private static readonly string DATABASE_PATH = Utils.GetTempPath("dlc.dat"); | |||
private static readonly string GEOSITE_URL = "https://github.com/v2ray/domain-list-community/raw/release/dlc.dat"; | |||
public static readonly Dictionary<string, IList<DomainObject>> Geosites = new Dictionary<string, IList<DomainObject>>(); | |||
static GeositeUpdater() | |||
{ | |||
if (!File.Exists(DATABASE_PATH)) | |||
{ | |||
File.WriteAllBytes(DATABASE_PATH, Resources.dlc_dat); | |||
} | |||
LoadGeositeList(); | |||
} | |||
static void LoadGeositeList(byte[] data = null) | |||
{ | |||
data = data ?? File.ReadAllBytes(DATABASE_PATH); | |||
var list = GeositeList.Parser.ParseFrom(data); | |||
foreach (var item in list.Entries) | |||
{ | |||
Geosites[item.GroupName.ToLower()] = item.Domains; | |||
} | |||
} | |||
public static void ResetEvent() | |||
{ | |||
UpdateCompleted = null; | |||
Error = null; | |||
} | |||
public static void UpdatePACFromGeosite(Configuration config) | |||
{ | |||
string geositeUrl = GEOSITE_URL; | |||
string group = config.geositeGroup; | |||
bool blacklist = config.geositeBlacklistMode; | |||
if (!string.IsNullOrWhiteSpace(config.geositeUrl)) | |||
{ | |||
logger.Info("Found custom Geosite URL in config file"); | |||
geositeUrl = config.geositeUrl; | |||
} | |||
logger.Info($"Checking Geosite from {geositeUrl}"); | |||
WebClient http = new WebClient(); | |||
if (config.enabled) | |||
{ | |||
http.Proxy = new WebProxy( | |||
config.isIPv6Enabled | |||
? $"[{IPAddress.IPv6Loopback}]" | |||
: IPAddress.Loopback.ToString(), | |||
config.localPort); | |||
} | |||
http.DownloadDataCompleted += (o, e) => | |||
{ | |||
try | |||
{ | |||
File.WriteAllBytes(DATABASE_PATH, e.Result); | |||
LoadGeositeList(); | |||
bool pacFileChanged = MergeAndWritePACFile(group, blacklist); | |||
UpdateCompleted?.Invoke(null, new GeositeResultEventArgs(pacFileChanged)); | |||
} | |||
catch (Exception ex) | |||
{ | |||
Error?.Invoke(null, new ErrorEventArgs(ex)); | |||
} | |||
}; | |||
http.DownloadDataAsync(new Uri(geositeUrl)); | |||
} | |||
public static bool MergeAndWritePACFile(string group, bool blacklist) | |||
{ | |||
IList<DomainObject> domains = Geosites[group]; | |||
string abpContent = MergePACFile(domains, blacklist); | |||
if (File.Exists(PACDaemon.PAC_FILE)) | |||
{ | |||
string original = FileManager.NonExclusiveReadAllText(PACDaemon.PAC_FILE, Encoding.UTF8); | |||
if (original == abpContent) | |||
{ | |||
return false; | |||
} | |||
} | |||
File.WriteAllText(PACDaemon.PAC_FILE, abpContent, Encoding.UTF8); | |||
return true; | |||
} | |||
private static string MergePACFile(IList<DomainObject> domains, bool blacklist) | |||
{ | |||
string abpContent; | |||
if (File.Exists(PACDaemon.USER_ABP_FILE)) | |||
{ | |||
abpContent = FileManager.NonExclusiveReadAllText(PACDaemon.USER_ABP_FILE, Encoding.UTF8); | |||
} | |||
else | |||
{ | |||
abpContent = Resources.abp_js; | |||
} | |||
List<string> userruleLines = new List<string>(); | |||
if (File.Exists(PACDaemon.USER_RULE_FILE)) | |||
{ | |||
string userrulesString = FileManager.NonExclusiveReadAllText(PACDaemon.USER_RULE_FILE, Encoding.UTF8); | |||
userruleLines = PreProcessGFWList(userrulesString); | |||
} | |||
List<string> gfwLines = GeositeToGFWList(domains, blacklist); | |||
abpContent = | |||
$@"var __USERRULES__ = {JsonConvert.SerializeObject(userruleLines, Formatting.Indented)}; | |||
var __RULES__ = {JsonConvert.SerializeObject(gfwLines, Formatting.Indented)}; | |||
{abpContent}"; | |||
return abpContent; | |||
} | |||
private static readonly IEnumerable<char> IgnoredLineBegins = new[] { '!', '[' }; | |||
private static List<string> PreProcessGFWList(string content) | |||
{ | |||
List<string> valid_lines = new List<string>(); | |||
using (var sr = new StringReader(content)) | |||
{ | |||
foreach (var line in sr.NonWhiteSpaceLines()) | |||
{ | |||
if (line.BeginWithAny(IgnoredLineBegins)) | |||
continue; | |||
valid_lines.Add(line); | |||
} | |||
} | |||
return valid_lines; | |||
} | |||
private static List<string> GeositeToGFWList(IList<DomainObject> domains, bool blacklist) | |||
{ | |||
return blacklist ? GeositeToGFWListBlack(domains) : GeositeToGFWListWhite(domains); | |||
} | |||
private static List<string> GeositeToGFWListBlack(IList<DomainObject> domains) | |||
{ | |||
List<string> ret = new List<string>(domains.Count + 100);// 100 overhead | |||
foreach (var d in domains) | |||
{ | |||
string domain = d.Value; | |||
switch (d.Type) | |||
{ | |||
case DomainObject.Types.Type.Plain: | |||
ret.Add(domain); | |||
break; | |||
case DomainObject.Types.Type.Regex: | |||
ret.Add($"/{domain}/"); | |||
break; | |||
case DomainObject.Types.Type.Domain: | |||
ret.Add($"||{domain}"); | |||
break; | |||
case DomainObject.Types.Type.Full: | |||
ret.Add($"|http://{domain}"); | |||
ret.Add($"|https://{domain}"); | |||
break; | |||
} | |||
} | |||
return ret; | |||
} | |||
private static List<string> GeositeToGFWListWhite(IList<DomainObject> domains) | |||
{ | |||
return GeositeToGFWListBlack(domains) | |||
.Select(r => $"@@{r}") // convert to whitelist | |||
.Prepend("/.*/") // blacklist all other site | |||
.ToList(); | |||
} | |||
} | |||
} |
@@ -1,137 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.IO; | |||
using System.Net; | |||
using System.Text; | |||
using Newtonsoft.Json; | |||
using NLog; | |||
using Shadowsocks.Model; | |||
using Shadowsocks.Properties; | |||
using Shadowsocks.Util; | |||
namespace Shadowsocks.Controller | |||
{ | |||
public class GFWListUpdater | |||
{ | |||
private static Logger logger = LogManager.GetCurrentClassLogger(); | |||
private const string GFWLIST_URL = "https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt"; | |||
public event EventHandler<ResultEventArgs> UpdateCompleted; | |||
public event ErrorEventHandler Error; | |||
public class ResultEventArgs : EventArgs | |||
{ | |||
public bool Success; | |||
public ResultEventArgs(bool success) | |||
{ | |||
this.Success = success; | |||
} | |||
} | |||
private static readonly IEnumerable<char> IgnoredLineBegins = new[] { '!', '[' }; | |||
private void http_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) | |||
{ | |||
try | |||
{ | |||
File.WriteAllText(Utils.GetTempPath("gfwlist.txt"), e.Result, Encoding.UTF8); | |||
bool pacFileChanged = MergeAndWritePACFile(e.Result); | |||
UpdateCompleted?.Invoke(this, new ResultEventArgs(pacFileChanged)); | |||
} | |||
catch (Exception ex) | |||
{ | |||
Error?.Invoke(this, new ErrorEventArgs(ex)); | |||
} | |||
} | |||
public static bool MergeAndWritePACFile(string gfwListResult) | |||
{ | |||
string abpContent = MergePACFile(gfwListResult); | |||
if (File.Exists(PACDaemon.PAC_FILE)) | |||
{ | |||
string original = FileManager.NonExclusiveReadAllText(PACDaemon.PAC_FILE, Encoding.UTF8); | |||
if (original == abpContent) | |||
{ | |||
return false; | |||
} | |||
} | |||
File.WriteAllText(PACDaemon.PAC_FILE, abpContent, Encoding.UTF8); | |||
return true; | |||
} | |||
private static string MergePACFile(string gfwListResult) | |||
{ | |||
string abpContent; | |||
if (File.Exists(PACDaemon.USER_ABP_FILE)) | |||
{ | |||
abpContent = FileManager.NonExclusiveReadAllText(PACDaemon.USER_ABP_FILE, Encoding.UTF8); | |||
} | |||
else | |||
{ | |||
abpContent = Resources.abp_js; | |||
} | |||
List<string> userruleLines = new List<string>(); | |||
if (File.Exists(PACDaemon.USER_RULE_FILE)) | |||
{ | |||
string userrulesString = FileManager.NonExclusiveReadAllText(PACDaemon.USER_RULE_FILE, Encoding.UTF8); | |||
userruleLines = ParseToValidList(userrulesString); | |||
} | |||
List<string> gfwLines = new List<string>(); | |||
gfwLines = ParseBase64ToValidList(gfwListResult); | |||
abpContent = | |||
$@"var __USERRULES__ = {JsonConvert.SerializeObject(userruleLines, Formatting.Indented)}; | |||
var __RULES__ = {JsonConvert.SerializeObject(gfwLines, Formatting.Indented)}; | |||
{abpContent}"; | |||
return abpContent; | |||
} | |||
public void UpdatePACFromGFWList(Configuration config) | |||
{ | |||
string gfwListUrl = GFWLIST_URL; | |||
if (!string.IsNullOrWhiteSpace(config.gfwListUrl)) | |||
{ | |||
logger.Info("Found custom GFWListURL in config file"); | |||
gfwListUrl = config.gfwListUrl; | |||
} | |||
logger.Info($"Checking GFWList from {gfwListUrl}"); | |||
WebClient http = new WebClient(); | |||
if (config.enabled) | |||
{ | |||
http.Proxy = new WebProxy( | |||
config.isIPv6Enabled | |||
? $"[{IPAddress.IPv6Loopback.ToString()}]" | |||
: IPAddress.Loopback.ToString(), | |||
config.localPort); | |||
} | |||
http.DownloadStringCompleted += http_DownloadStringCompleted; | |||
http.DownloadStringAsync(new Uri(gfwListUrl)); | |||
} | |||
public static List<string> ParseBase64ToValidList(string response) | |||
{ | |||
byte[] bytes = Convert.FromBase64String(response); | |||
string content = Encoding.ASCII.GetString(bytes); | |||
return ParseToValidList(content); | |||
} | |||
private static List<string> ParseToValidList(string content) | |||
{ | |||
List<string> valid_lines = new List<string>(); | |||
using (var sr = new StringReader(content)) | |||
{ | |||
foreach (var line in sr.NonWhiteSpaceLines()) | |||
{ | |||
if (line.BeginWithAny(IgnoredLineBegins)) | |||
continue; | |||
valid_lines.Add(line); | |||
} | |||
} | |||
return valid_lines; | |||
} | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using NLog; | |||
using Shadowsocks.Model; | |||
using Shadowsocks.Properties; | |||
using Shadowsocks.Util; | |||
using System; | |||
@@ -21,6 +22,7 @@ namespace Shadowsocks.Controller | |||
public const string PAC_FILE = "pac.txt"; | |||
public const string USER_RULE_FILE = "user-rule.txt"; | |||
public const string USER_ABP_FILE = "abp.txt"; | |||
private Configuration config; | |||
FileSystemWatcher PACFileWatcher; | |||
FileSystemWatcher UserRuleFileWatcher; | |||
@@ -28,8 +30,9 @@ namespace Shadowsocks.Controller | |||
public event EventHandler PACFileChanged; | |||
public event EventHandler UserRuleFileChanged; | |||
public PACDaemon() | |||
public PACDaemon(Configuration config) | |||
{ | |||
this.config = config; | |||
TouchPACFile(); | |||
TouchUserRuleFile(); | |||
@@ -42,7 +45,7 @@ namespace Shadowsocks.Controller | |||
{ | |||
if (!File.Exists(PAC_FILE)) | |||
{ | |||
File.WriteAllText(PAC_FILE, Resources.default_abp_rule + Resources.abp_js); | |||
GeositeUpdater.MergeAndWritePACFile(config.geositeGroup, config.geositeBlacklistMode); | |||
} | |||
return PAC_FILE; | |||
} | |||
@@ -58,14 +61,11 @@ namespace Shadowsocks.Controller | |||
internal string GetPACContent() | |||
{ | |||
if (File.Exists(PAC_FILE)) | |||
{ | |||
return File.ReadAllText(PAC_FILE, Encoding.UTF8); | |||
} | |||
else | |||
if (!File.Exists(PAC_FILE)) | |||
{ | |||
return Resources.default_abp_rule + Resources.abp_js; | |||
GeositeUpdater.MergeAndWritePACFile(config.geositeGroup, config.geositeBlacklistMode); | |||
} | |||
return File.ReadAllText(PAC_FILE, Encoding.UTF8); | |||
} | |||
@@ -35,7 +35,6 @@ namespace Shadowsocks.Controller | |||
private Configuration _config; | |||
private StrategyManager _strategyManager; | |||
private PrivoxyRunner privoxyRunner; | |||
private GFWListUpdater gfwListUpdater; | |||
private readonly ConcurrentDictionary<Server, Sip003Plugin> _pluginsByServer; | |||
public AvailabilityStatistics availabilityStatistics = AvailabilityStatistics.Instance; | |||
@@ -80,9 +79,9 @@ namespace Shadowsocks.Controller | |||
public event EventHandler<PathEventArgs> PACFileReadyToOpen; | |||
public event EventHandler<PathEventArgs> UserRuleFileReadyToOpen; | |||
public event EventHandler<GFWListUpdater.ResultEventArgs> UpdatePACFromGFWListCompleted; | |||
public event EventHandler<GeositeResultEventArgs> UpdatePACFromGeositeCompleted; | |||
public event ErrorEventHandler UpdatePACFromGFWListError; | |||
public event ErrorEventHandler UpdatePACFromGeositeError; | |||
public event ErrorEventHandler Errored; | |||
@@ -416,12 +415,9 @@ namespace Shadowsocks.Controller | |||
return $"ss://{url}{tag}"; | |||
} | |||
public void UpdatePACFromGFWList() | |||
public void UpdatePACFromGeosite() | |||
{ | |||
if (gfwListUpdater != null) | |||
{ | |||
gfwListUpdater.UpdatePACFromGFWList(_config); | |||
} | |||
GeositeUpdater.UpdatePACFromGeosite(_config); | |||
} | |||
public void UpdateStatisticsConfiguration(bool enabled) | |||
@@ -531,15 +527,15 @@ namespace Shadowsocks.Controller | |||
privoxyRunner = privoxyRunner ?? new PrivoxyRunner(); | |||
_pacDaemon = _pacDaemon ?? new PACDaemon(); | |||
_pacDaemon = _pacDaemon ?? new PACDaemon(_config); | |||
_pacDaemon.PACFileChanged += PacDaemon_PACFileChanged; | |||
_pacDaemon.UserRuleFileChanged += PacDaemon_UserRuleFileChanged; | |||
_pacServer = _pacServer ?? new PACServer(_pacDaemon); | |||
_pacServer.UpdatePACURL(_config); // So PACServer works when system proxy disabled. | |||
gfwListUpdater = gfwListUpdater ?? new GFWListUpdater(); | |||
gfwListUpdater.UpdateCompleted += PacServer_PACUpdateCompleted; | |||
gfwListUpdater.Error += PacServer_PACUpdateError; | |||
GeositeUpdater.ResetEvent(); | |||
GeositeUpdater.UpdateCompleted += PacServer_PACUpdateCompleted; | |||
GeositeUpdater.Error += PacServer_PACUpdateError; | |||
availabilityStatistics.UpdateConfiguration(this); | |||
_listener?.Stop(); | |||
@@ -621,27 +617,20 @@ namespace Shadowsocks.Controller | |||
UpdateSystemProxy(); | |||
} | |||
private void PacServer_PACUpdateCompleted(object sender, GFWListUpdater.ResultEventArgs e) | |||
private void PacServer_PACUpdateCompleted(object sender, GeositeResultEventArgs e) | |||
{ | |||
UpdatePACFromGFWListCompleted?.Invoke(this, e); | |||
UpdatePACFromGeositeCompleted?.Invoke(this, e); | |||
} | |||
private void PacServer_PACUpdateError(object sender, ErrorEventArgs e) | |||
{ | |||
UpdatePACFromGFWListError?.Invoke(this, e); | |||
UpdatePACFromGeositeError?.Invoke(this, e); | |||
} | |||
private static readonly IEnumerable<char> IgnoredLineBegins = new[] { '!', '[' }; | |||
private void PacDaemon_UserRuleFileChanged(object sender, EventArgs e) | |||
{ | |||
if (!File.Exists(Utils.GetTempPath("gfwlist.txt"))) | |||
{ | |||
UpdatePACFromGFWList(); | |||
} | |||
else | |||
{ | |||
GFWListUpdater.MergeAndWritePACFile(FileManager.NonExclusiveReadAllText(Utils.GetTempPath("gfwlist.txt"))); | |||
} | |||
GeositeUpdater.MergeAndWritePACFile(_config.geositeGroup, _config.geositeBlacklistMode); | |||
UpdateSystemProxy(); | |||
} | |||
@@ -786,6 +786,10 @@ function FindProxyForURL(url, host) { | |||
if (userrulesMatcher.matchesAny(url, host) instanceof WhitelistFilter) { | |||
return direct; | |||
} | |||
// Hack for Geosite, it provides a whitelist... | |||
if (defaultMatcher.matchesAny(url, host) instanceof WhitelistFilter) { | |||
return direct; | |||
} | |||
if (defaultMatcher.matchesAny(url, host) instanceof BlockingFilter) { | |||
return proxy; | |||
} | |||
@@ -24,8 +24,8 @@ Allow other Devices to connect,Общий доступ к подключению | |||
Local PAC,Локальный PAC,使用本地 PAC,使用本機 PAC,ローカル PAC,로컬 프록시 자동 구성,PAC local | |||
Online PAC,Удаленный PAC,使用在线 PAC,使用線上 PAC,オンライン PAC,온라인 프록시 자동 구성,PAC en ligne | |||
Edit Local PAC File...,Редактировать локальный PAC…,编辑本地 PAC 文件...,編輯本機 PAC 檔案...,ローカル PAC ファイルの編集...,로컬 프록시 자동 구성 파일 수정,Modifier le fichier PAC local ... | |||
Update Local PAC from GFWList,Обновить локальный PAC из GFWList,从 GFWList 更新本地 PAC,從 GFWList 更新本機 PAC,GFWList からローカル PAC を更新,GFWList에서 로컬 프록시 자동 구성 파일 업데이트,Mettre à jour le PAC local à partir de GFWList | |||
Edit User Rule for GFWList...,Редактировать свои правила для GFWList,编辑 GFWList 的用户规则...,編輯 GFWList 的使用者規則...,ユーザールールの編集...,GFWList 사용자 수정,Modifier la règle utilisateur pour GFWList ... | |||
Update Local PAC from Geosite,Обновить локальный PAC из Geosite,从 Geosite 更新本地 PAC,從 Geosite 更新本機 PAC,Geosite からローカル PAC を更新,Geosite에서 로컬 프록시 자동 구성 파일 업데이트,Mettre à jour le PAC local à partir de Geosite | |||
Edit User Rule for Geosite...,Редактировать свои правила для Geosite,编辑 Geosite 的用户规则...,編輯 Geosite 的使用者規則...,ユーザールールの編集...,Geosite 사용자 수정,Modifier la règle utilisateur pour Geosite ... | |||
Secure Local PAC,Безопасный URL локального PAC,保护本地 PAC,安全本機 PAC,ローカル PAC を保護,로컬 프록시 자동 구성 파일 암호화,Sécuriser PAC local | |||
Copy Local PAC URL,Копировать URL локального PAC,复制本地 PAC 网址,複製本機 PAC 網址,ローカル PAC URL をコピー,로컬 프록시 자동 구성 파일 URL 복사,Copier l'URL du PAC local | |||
Share Server Config...,Поделиться конфигурацией сервера…,分享服务器配置...,分享伺服器設定檔...,サーバーの設定を共有...,서버 설정 공유,Partager la configuration du serveur ... | |||
@@ -178,7 +178,7 @@ System Proxy Enabled,Системный прокси включен,系统代理 | |||
System Proxy Disabled,Системный прокси отключен,系统代理未启用,系統 Proxy 未啟用,システム プロキシが無効です。,시스템 프록시가 비활성화되었습니다.,Proxy système désactivé | |||
Failed to update PAC file ,Не удалось обновить PAC файл,更新 PAC 文件失败,更新 PAC 檔案失敗,PAC の更新に失敗しました。,프록시 자동 구성 파일을 업데이트하는데 실패했습니다.,Impossible de mettre à jour le fichier PAC | |||
PAC updated,PAC файл обновлен,更新 PAC 成功,更新 PAC 成功,PAC を更新しました。,프록시 자동 구성 파일이 업데이트되었습니다.,PAC mis à jour | |||
No updates found. Please report to GFWList if you have problems with it.,Обновлений не найдено. Сообщите авторам GFWList если у вас возникли проблемы.,未发现更新。如有问题请提交给 GFWList。,未發現更新。如有問題請報告至 GFWList。,お使いのバージョンは最新です。問題がある場合は、GFWList に報告して下さい。,사용 가능한 업데이트를 찾지 못했습니다. 문제가 있다면 GFWList로 전송해주세요.,Aucune mise à jour trouvée. Veuillez signaler à GFWList si vous avez des problèmes concernant. | |||
No updates found. Please report to Geosite if you have problems with it.,Обновлений не найдено. Сообщите авторам Geosite если у вас возникли проблемы.,未发现更新。如有问题请提交给 Geosite。,未發現更新。如有問題請報告至 Geosite。,お使いのバージョンは最新です。問題がある場合は、Geosite に報告して下さい。,사용 가능한 업데이트를 찾지 못했습니다. 문제가 있다면 Geosite로 전송해주세요.,Aucune mise à jour trouvée. Veuillez signaler à Geosite si vous avez des problèmes concernant. | |||
No QRCode found. Try to zoom in or move it to the center of the screen.,QRCode не обнаружен. Попробуйте увеличить изображение или переместить его в центр экрана.,未发现二维码,尝试把它放大或移动到靠近屏幕中间的位置,未發現 QR 碼,嘗試把它放大或移動到靠近熒幕中間的位置,QR コードが見つかりませんでした。コードを大きくするか、画面の中央に移動して下さい。,QR코드를 찾을 수 없습니다. 가운데로 화면을 이동시키거나 확대해보세요.,Aucun QRCode trouvé. Essayez de zoomer ou de le déplacer vers le centre de l'écran. | |||
Shadowsocks is already running.,Shadowsocks уже запущен.,Shadowsocks 已经在运行。,Shadowsocks 已經在執行。,Shadowsocks 実行中,Shadowsocks가 이미 실행 중입니다.,Shadowsocks est déjà en cours d'exécution. | |||
Find Shadowsocks icon in your notify tray.,Значок Shadowsocks можно найти в области уведомлений.,请在任务栏里寻找 Shadowsocks 图标。,請在工作列裡尋找 Shadowsocks 圖示。,通知領域には Shadowsocks のアイコンがあります。,트레이에서 Shadowsocks를 찾아주세요.,Trouvez l'icône Shadowsocks dans votre barre de notification. | |||
@@ -29,7 +29,10 @@ namespace Shadowsocks.Model | |||
public bool portableMode = true; | |||
public bool showPluginOutput; | |||
public string pacUrl; | |||
public string gfwListUrl; | |||
public string geositeUrl; | |||
public string geositeGroup = "geolocation-!cn"; | |||
public bool geositeBlacklistMode = true; | |||
public bool useOnlinePac; | |||
public bool secureLocalPac = true; | |||
public bool availabilityStatistics; | |||
@@ -0,0 +1,753 @@ | |||
// <auto-generated> | |||
// Generated by the protocol buffer compiler. DO NOT EDIT! | |||
// source: geosite.proto | |||
// </auto-generated> | |||
#pragma warning disable 1591, 0612, 3021 | |||
#region Designer generated code | |||
using pb = global::Google.Protobuf; | |||
using pbc = global::Google.Protobuf.Collections; | |||
using pbr = global::Google.Protobuf.Reflection; | |||
using scg = global::System.Collections.Generic; | |||
/// <summary>Holder for reflection information generated from geosite.proto</summary> | |||
public static partial class GeositeReflection { | |||
#region Descriptor | |||
/// <summary>File descriptor for geosite.proto</summary> | |||
public static pbr::FileDescriptor Descriptor { | |||
get { return descriptor; } | |||
} | |||
private static pbr::FileDescriptor descriptor; | |||
static GeositeReflection() { | |||
byte[] descriptorData = global::System.Convert.FromBase64String( | |||
string.Concat( | |||
"Cg1nZW9zaXRlLnByb3RvIvMBCgxEb21haW5PYmplY3QSIAoEdHlwZRgBIAEo", | |||
"DjISLkRvbWFpbk9iamVjdC5UeXBlEg0KBXZhbHVlGAIgASgJEioKCWF0dHJp", | |||
"YnV0ZRgDIAMoCzIXLkRvbWFpbk9iamVjdC5BdHRyaWJ1dGUaUgoJQXR0cmli", | |||
"dXRlEgsKA2tleRgBIAEoCRIUCgpib29sX3ZhbHVlGAIgASgISAASEwoJaW50", | |||
"X3ZhbHVlGAMgASgDSABCDQoLdHlwZWRfdmFsdWUiMgoEVHlwZRIJCgVQbGFp", | |||
"bhAAEgkKBVJlZ2V4EAESCgoGRG9tYWluEAISCAoERnVsbBADIj0KB0dlb3Np", | |||
"dGUSEgoKZ3JvdXBfbmFtZRgBIAEoCRIeCgdkb21haW5zGAIgAygLMg0uRG9t", | |||
"YWluT2JqZWN0IigKC0dlb3NpdGVMaXN0EhkKB2VudHJpZXMYASADKAsyCC5H", | |||
"ZW9zaXRlYgZwcm90bzM=")); | |||
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, | |||
new pbr::FileDescriptor[] { }, | |||
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { | |||
new pbr::GeneratedClrTypeInfo(typeof(global::DomainObject), global::DomainObject.Parser, new[]{ "Type", "Value", "Attribute" }, null, new[]{ typeof(global::DomainObject.Types.Type) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::DomainObject.Types.Attribute), global::DomainObject.Types.Attribute.Parser, new[]{ "Key", "BoolValue", "IntValue" }, new[]{ "TypedValue" }, null, null, null)}), | |||
new pbr::GeneratedClrTypeInfo(typeof(global::Geosite), global::Geosite.Parser, new[]{ "GroupName", "Domains" }, null, null, null, null), | |||
new pbr::GeneratedClrTypeInfo(typeof(global::GeositeList), global::GeositeList.Parser, new[]{ "Entries" }, null, null, null, null) | |||
})); | |||
} | |||
#endregion | |||
} | |||
#region Messages | |||
/// <summary> | |||
/// DomainObject for routing decision. | |||
/// </summary> | |||
public sealed partial class DomainObject : pb::IMessage<DomainObject> { | |||
private static readonly pb::MessageParser<DomainObject> _parser = new pb::MessageParser<DomainObject>(() => new DomainObject()); | |||
private pb::UnknownFieldSet _unknownFields; | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public static pb::MessageParser<DomainObject> Parser { get { return _parser; } } | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public static pbr::MessageDescriptor Descriptor { | |||
get { return global::GeositeReflection.Descriptor.MessageTypes[0]; } | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
pbr::MessageDescriptor pb::IMessage.Descriptor { | |||
get { return Descriptor; } | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public DomainObject() { | |||
OnConstruction(); | |||
} | |||
partial void OnConstruction(); | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public DomainObject(DomainObject other) : this() { | |||
type_ = other.type_; | |||
value_ = other.value_; | |||
attribute_ = other.attribute_.Clone(); | |||
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public DomainObject Clone() { | |||
return new DomainObject(this); | |||
} | |||
/// <summary>Field number for the "type" field.</summary> | |||
public const int TypeFieldNumber = 1; | |||
private global::DomainObject.Types.Type type_ = global::DomainObject.Types.Type.Plain; | |||
/// <summary> | |||
/// DomainObject matching type. | |||
/// </summary> | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public global::DomainObject.Types.Type Type { | |||
get { return type_; } | |||
set { | |||
type_ = value; | |||
} | |||
} | |||
/// <summary>Field number for the "value" field.</summary> | |||
public const int ValueFieldNumber = 2; | |||
private string value_ = ""; | |||
/// <summary> | |||
/// DomainObject value. | |||
/// </summary> | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public string Value { | |||
get { return value_; } | |||
set { | |||
value_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); | |||
} | |||
} | |||
/// <summary>Field number for the "attribute" field.</summary> | |||
public const int AttributeFieldNumber = 3; | |||
private static readonly pb::FieldCodec<global::DomainObject.Types.Attribute> _repeated_attribute_codec | |||
= pb::FieldCodec.ForMessage(26, global::DomainObject.Types.Attribute.Parser); | |||
private readonly pbc::RepeatedField<global::DomainObject.Types.Attribute> attribute_ = new pbc::RepeatedField<global::DomainObject.Types.Attribute>(); | |||
/// <summary> | |||
/// Attributes of this domain. May be used for filtering. | |||
/// </summary> | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public pbc::RepeatedField<global::DomainObject.Types.Attribute> Attribute { | |||
get { return attribute_; } | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public override bool Equals(object other) { | |||
return Equals(other as DomainObject); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public bool Equals(DomainObject other) { | |||
if (ReferenceEquals(other, null)) { | |||
return false; | |||
} | |||
if (ReferenceEquals(other, this)) { | |||
return true; | |||
} | |||
if (Type != other.Type) return false; | |||
if (Value != other.Value) return false; | |||
if(!attribute_.Equals(other.attribute_)) return false; | |||
return Equals(_unknownFields, other._unknownFields); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public override int GetHashCode() { | |||
int hash = 1; | |||
if (Type != global::DomainObject.Types.Type.Plain) hash ^= Type.GetHashCode(); | |||
if (Value.Length != 0) hash ^= Value.GetHashCode(); | |||
hash ^= attribute_.GetHashCode(); | |||
if (_unknownFields != null) { | |||
hash ^= _unknownFields.GetHashCode(); | |||
} | |||
return hash; | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public override string ToString() { | |||
return pb::JsonFormatter.ToDiagnosticString(this); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public void WriteTo(pb::CodedOutputStream output) { | |||
if (Type != global::DomainObject.Types.Type.Plain) { | |||
output.WriteRawTag(8); | |||
output.WriteEnum((int) Type); | |||
} | |||
if (Value.Length != 0) { | |||
output.WriteRawTag(18); | |||
output.WriteString(Value); | |||
} | |||
attribute_.WriteTo(output, _repeated_attribute_codec); | |||
if (_unknownFields != null) { | |||
_unknownFields.WriteTo(output); | |||
} | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public int CalculateSize() { | |||
int size = 0; | |||
if (Type != global::DomainObject.Types.Type.Plain) { | |||
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type); | |||
} | |||
if (Value.Length != 0) { | |||
size += 1 + pb::CodedOutputStream.ComputeStringSize(Value); | |||
} | |||
size += attribute_.CalculateSize(_repeated_attribute_codec); | |||
if (_unknownFields != null) { | |||
size += _unknownFields.CalculateSize(); | |||
} | |||
return size; | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public void MergeFrom(DomainObject other) { | |||
if (other == null) { | |||
return; | |||
} | |||
if (other.Type != global::DomainObject.Types.Type.Plain) { | |||
Type = other.Type; | |||
} | |||
if (other.Value.Length != 0) { | |||
Value = other.Value; | |||
} | |||
attribute_.Add(other.attribute_); | |||
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public void MergeFrom(pb::CodedInputStream input) { | |||
uint tag; | |||
while ((tag = input.ReadTag()) != 0) { | |||
switch(tag) { | |||
default: | |||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); | |||
break; | |||
case 8: { | |||
Type = (global::DomainObject.Types.Type) input.ReadEnum(); | |||
break; | |||
} | |||
case 18: { | |||
Value = input.ReadString(); | |||
break; | |||
} | |||
case 26: { | |||
attribute_.AddEntriesFrom(input, _repeated_attribute_codec); | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
#region Nested types | |||
/// <summary>Container for nested types declared in the DomainObject message type.</summary> | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public static partial class Types { | |||
/// <summary> | |||
/// Type of domain value. | |||
/// </summary> | |||
public enum Type { | |||
/// <summary> | |||
/// The value is used as is. | |||
/// </summary> | |||
[pbr::OriginalName("Plain")] Plain = 0, | |||
/// <summary> | |||
/// The value is used as a regular expression. | |||
/// </summary> | |||
[pbr::OriginalName("Regex")] Regex = 1, | |||
/// <summary> | |||
/// The value is a root domain. | |||
/// </summary> | |||
[pbr::OriginalName("Domain")] Domain = 2, | |||
/// <summary> | |||
/// The value is a domain. | |||
/// </summary> | |||
[pbr::OriginalName("Full")] Full = 3, | |||
} | |||
public sealed partial class Attribute : pb::IMessage<Attribute> { | |||
private static readonly pb::MessageParser<Attribute> _parser = new pb::MessageParser<Attribute>(() => new Attribute()); | |||
private pb::UnknownFieldSet _unknownFields; | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public static pb::MessageParser<Attribute> Parser { get { return _parser; } } | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public static pbr::MessageDescriptor Descriptor { | |||
get { return global::DomainObject.Descriptor.NestedTypes[0]; } | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
pbr::MessageDescriptor pb::IMessage.Descriptor { | |||
get { return Descriptor; } | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public Attribute() { | |||
OnConstruction(); | |||
} | |||
partial void OnConstruction(); | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public Attribute(Attribute other) : this() { | |||
key_ = other.key_; | |||
switch (other.TypedValueCase) { | |||
case TypedValueOneofCase.BoolValue: | |||
BoolValue = other.BoolValue; | |||
break; | |||
case TypedValueOneofCase.IntValue: | |||
IntValue = other.IntValue; | |||
break; | |||
} | |||
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public Attribute Clone() { | |||
return new Attribute(this); | |||
} | |||
/// <summary>Field number for the "key" field.</summary> | |||
public const int KeyFieldNumber = 1; | |||
private string key_ = ""; | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public string Key { | |||
get { return key_; } | |||
set { | |||
key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); | |||
} | |||
} | |||
/// <summary>Field number for the "bool_value" field.</summary> | |||
public const int BoolValueFieldNumber = 2; | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public bool BoolValue { | |||
get { return typedValueCase_ == TypedValueOneofCase.BoolValue ? (bool) typedValue_ : false; } | |||
set { | |||
typedValue_ = value; | |||
typedValueCase_ = TypedValueOneofCase.BoolValue; | |||
} | |||
} | |||
/// <summary>Field number for the "int_value" field.</summary> | |||
public const int IntValueFieldNumber = 3; | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public long IntValue { | |||
get { return typedValueCase_ == TypedValueOneofCase.IntValue ? (long) typedValue_ : 0L; } | |||
set { | |||
typedValue_ = value; | |||
typedValueCase_ = TypedValueOneofCase.IntValue; | |||
} | |||
} | |||
private object typedValue_; | |||
/// <summary>Enum of possible cases for the "typed_value" oneof.</summary> | |||
public enum TypedValueOneofCase { | |||
None = 0, | |||
BoolValue = 2, | |||
IntValue = 3, | |||
} | |||
private TypedValueOneofCase typedValueCase_ = TypedValueOneofCase.None; | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public TypedValueOneofCase TypedValueCase { | |||
get { return typedValueCase_; } | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public void ClearTypedValue() { | |||
typedValueCase_ = TypedValueOneofCase.None; | |||
typedValue_ = null; | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public override bool Equals(object other) { | |||
return Equals(other as Attribute); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public bool Equals(Attribute other) { | |||
if (ReferenceEquals(other, null)) { | |||
return false; | |||
} | |||
if (ReferenceEquals(other, this)) { | |||
return true; | |||
} | |||
if (Key != other.Key) return false; | |||
if (BoolValue != other.BoolValue) return false; | |||
if (IntValue != other.IntValue) return false; | |||
if (TypedValueCase != other.TypedValueCase) return false; | |||
return Equals(_unknownFields, other._unknownFields); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public override int GetHashCode() { | |||
int hash = 1; | |||
if (Key.Length != 0) hash ^= Key.GetHashCode(); | |||
if (typedValueCase_ == TypedValueOneofCase.BoolValue) hash ^= BoolValue.GetHashCode(); | |||
if (typedValueCase_ == TypedValueOneofCase.IntValue) hash ^= IntValue.GetHashCode(); | |||
hash ^= (int) typedValueCase_; | |||
if (_unknownFields != null) { | |||
hash ^= _unknownFields.GetHashCode(); | |||
} | |||
return hash; | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public override string ToString() { | |||
return pb::JsonFormatter.ToDiagnosticString(this); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public void WriteTo(pb::CodedOutputStream output) { | |||
if (Key.Length != 0) { | |||
output.WriteRawTag(10); | |||
output.WriteString(Key); | |||
} | |||
if (typedValueCase_ == TypedValueOneofCase.BoolValue) { | |||
output.WriteRawTag(16); | |||
output.WriteBool(BoolValue); | |||
} | |||
if (typedValueCase_ == TypedValueOneofCase.IntValue) { | |||
output.WriteRawTag(24); | |||
output.WriteInt64(IntValue); | |||
} | |||
if (_unknownFields != null) { | |||
_unknownFields.WriteTo(output); | |||
} | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public int CalculateSize() { | |||
int size = 0; | |||
if (Key.Length != 0) { | |||
size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); | |||
} | |||
if (typedValueCase_ == TypedValueOneofCase.BoolValue) { | |||
size += 1 + 1; | |||
} | |||
if (typedValueCase_ == TypedValueOneofCase.IntValue) { | |||
size += 1 + pb::CodedOutputStream.ComputeInt64Size(IntValue); | |||
} | |||
if (_unknownFields != null) { | |||
size += _unknownFields.CalculateSize(); | |||
} | |||
return size; | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public void MergeFrom(Attribute other) { | |||
if (other == null) { | |||
return; | |||
} | |||
if (other.Key.Length != 0) { | |||
Key = other.Key; | |||
} | |||
switch (other.TypedValueCase) { | |||
case TypedValueOneofCase.BoolValue: | |||
BoolValue = other.BoolValue; | |||
break; | |||
case TypedValueOneofCase.IntValue: | |||
IntValue = other.IntValue; | |||
break; | |||
} | |||
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public void MergeFrom(pb::CodedInputStream input) { | |||
uint tag; | |||
while ((tag = input.ReadTag()) != 0) { | |||
switch(tag) { | |||
default: | |||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); | |||
break; | |||
case 10: { | |||
Key = input.ReadString(); | |||
break; | |||
} | |||
case 16: { | |||
BoolValue = input.ReadBool(); | |||
break; | |||
} | |||
case 24: { | |||
IntValue = input.ReadInt64(); | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
public sealed partial class Geosite : pb::IMessage<Geosite> { | |||
private static readonly pb::MessageParser<Geosite> _parser = new pb::MessageParser<Geosite>(() => new Geosite()); | |||
private pb::UnknownFieldSet _unknownFields; | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public static pb::MessageParser<Geosite> Parser { get { return _parser; } } | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public static pbr::MessageDescriptor Descriptor { | |||
get { return global::GeositeReflection.Descriptor.MessageTypes[1]; } | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
pbr::MessageDescriptor pb::IMessage.Descriptor { | |||
get { return Descriptor; } | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public Geosite() { | |||
OnConstruction(); | |||
} | |||
partial void OnConstruction(); | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public Geosite(Geosite other) : this() { | |||
groupName_ = other.groupName_; | |||
domains_ = other.domains_.Clone(); | |||
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public Geosite Clone() { | |||
return new Geosite(this); | |||
} | |||
/// <summary>Field number for the "group_name" field.</summary> | |||
public const int GroupNameFieldNumber = 1; | |||
private string groupName_ = ""; | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public string GroupName { | |||
get { return groupName_; } | |||
set { | |||
groupName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); | |||
} | |||
} | |||
/// <summary>Field number for the "domains" field.</summary> | |||
public const int DomainsFieldNumber = 2; | |||
private static readonly pb::FieldCodec<global::DomainObject> _repeated_domains_codec | |||
= pb::FieldCodec.ForMessage(18, global::DomainObject.Parser); | |||
private readonly pbc::RepeatedField<global::DomainObject> domains_ = new pbc::RepeatedField<global::DomainObject>(); | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public pbc::RepeatedField<global::DomainObject> Domains { | |||
get { return domains_; } | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public override bool Equals(object other) { | |||
return Equals(other as Geosite); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public bool Equals(Geosite other) { | |||
if (ReferenceEquals(other, null)) { | |||
return false; | |||
} | |||
if (ReferenceEquals(other, this)) { | |||
return true; | |||
} | |||
if (GroupName != other.GroupName) return false; | |||
if(!domains_.Equals(other.domains_)) return false; | |||
return Equals(_unknownFields, other._unknownFields); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public override int GetHashCode() { | |||
int hash = 1; | |||
if (GroupName.Length != 0) hash ^= GroupName.GetHashCode(); | |||
hash ^= domains_.GetHashCode(); | |||
if (_unknownFields != null) { | |||
hash ^= _unknownFields.GetHashCode(); | |||
} | |||
return hash; | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public override string ToString() { | |||
return pb::JsonFormatter.ToDiagnosticString(this); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public void WriteTo(pb::CodedOutputStream output) { | |||
if (GroupName.Length != 0) { | |||
output.WriteRawTag(10); | |||
output.WriteString(GroupName); | |||
} | |||
domains_.WriteTo(output, _repeated_domains_codec); | |||
if (_unknownFields != null) { | |||
_unknownFields.WriteTo(output); | |||
} | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public int CalculateSize() { | |||
int size = 0; | |||
if (GroupName.Length != 0) { | |||
size += 1 + pb::CodedOutputStream.ComputeStringSize(GroupName); | |||
} | |||
size += domains_.CalculateSize(_repeated_domains_codec); | |||
if (_unknownFields != null) { | |||
size += _unknownFields.CalculateSize(); | |||
} | |||
return size; | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public void MergeFrom(Geosite other) { | |||
if (other == null) { | |||
return; | |||
} | |||
if (other.GroupName.Length != 0) { | |||
GroupName = other.GroupName; | |||
} | |||
domains_.Add(other.domains_); | |||
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public void MergeFrom(pb::CodedInputStream input) { | |||
uint tag; | |||
while ((tag = input.ReadTag()) != 0) { | |||
switch(tag) { | |||
default: | |||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); | |||
break; | |||
case 10: { | |||
GroupName = input.ReadString(); | |||
break; | |||
} | |||
case 18: { | |||
domains_.AddEntriesFrom(input, _repeated_domains_codec); | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
public sealed partial class GeositeList : pb::IMessage<GeositeList> { | |||
private static readonly pb::MessageParser<GeositeList> _parser = new pb::MessageParser<GeositeList>(() => new GeositeList()); | |||
private pb::UnknownFieldSet _unknownFields; | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public static pb::MessageParser<GeositeList> Parser { get { return _parser; } } | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public static pbr::MessageDescriptor Descriptor { | |||
get { return global::GeositeReflection.Descriptor.MessageTypes[2]; } | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
pbr::MessageDescriptor pb::IMessage.Descriptor { | |||
get { return Descriptor; } | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public GeositeList() { | |||
OnConstruction(); | |||
} | |||
partial void OnConstruction(); | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public GeositeList(GeositeList other) : this() { | |||
entries_ = other.entries_.Clone(); | |||
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public GeositeList Clone() { | |||
return new GeositeList(this); | |||
} | |||
/// <summary>Field number for the "entries" field.</summary> | |||
public const int EntriesFieldNumber = 1; | |||
private static readonly pb::FieldCodec<global::Geosite> _repeated_entries_codec | |||
= pb::FieldCodec.ForMessage(10, global::Geosite.Parser); | |||
private readonly pbc::RepeatedField<global::Geosite> entries_ = new pbc::RepeatedField<global::Geosite>(); | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public pbc::RepeatedField<global::Geosite> Entries { | |||
get { return entries_; } | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public override bool Equals(object other) { | |||
return Equals(other as GeositeList); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public bool Equals(GeositeList other) { | |||
if (ReferenceEquals(other, null)) { | |||
return false; | |||
} | |||
if (ReferenceEquals(other, this)) { | |||
return true; | |||
} | |||
if(!entries_.Equals(other.entries_)) return false; | |||
return Equals(_unknownFields, other._unknownFields); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public override int GetHashCode() { | |||
int hash = 1; | |||
hash ^= entries_.GetHashCode(); | |||
if (_unknownFields != null) { | |||
hash ^= _unknownFields.GetHashCode(); | |||
} | |||
return hash; | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public override string ToString() { | |||
return pb::JsonFormatter.ToDiagnosticString(this); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public void WriteTo(pb::CodedOutputStream output) { | |||
entries_.WriteTo(output, _repeated_entries_codec); | |||
if (_unknownFields != null) { | |||
_unknownFields.WriteTo(output); | |||
} | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public int CalculateSize() { | |||
int size = 0; | |||
size += entries_.CalculateSize(_repeated_entries_codec); | |||
if (_unknownFields != null) { | |||
size += _unknownFields.CalculateSize(); | |||
} | |||
return size; | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public void MergeFrom(GeositeList other) { | |||
if (other == null) { | |||
return; | |||
} | |||
entries_.Add(other.entries_); | |||
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); | |||
} | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] | |||
public void MergeFrom(pb::CodedInputStream input) { | |||
uint tag; | |||
while ((tag = input.ReadTag()) != 0) { | |||
switch(tag) { | |||
default: | |||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); | |||
break; | |||
case 10: { | |||
entries_.AddEntriesFrom(input, _repeated_entries_codec); | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
#endregion | |||
#endregion Designer generated code |
@@ -0,0 +1,43 @@ | |||
syntax = "proto3"; | |||
// DomainObject for routing decision. | |||
message DomainObject { | |||
// Type of domain value. | |||
enum Type { | |||
// The value is used as is. | |||
Plain = 0; | |||
// The value is used as a regular expression. | |||
Regex = 1; | |||
// The value is a root domain. | |||
Domain = 2; | |||
// The value is a domain. | |||
Full = 3; | |||
} | |||
// DomainObject matching type. | |||
Type type = 1; | |||
// DomainObject value. | |||
string value = 2; | |||
message Attribute { | |||
string key = 1; | |||
oneof typed_value { | |||
bool bool_value = 2; | |||
int64 int_value = 3; | |||
} | |||
} | |||
// Attributes of this domain. May be used for filtering. | |||
repeated Attribute attribute = 3; | |||
} | |||
message Geosite { | |||
string group_name = 1; | |||
repeated DomainObject domains = 2; | |||
} | |||
message GeositeList{ | |||
repeated Geosite entries = 1; | |||
} |
@@ -155,7 +155,6 @@ namespace Shadowsocks | |||
{ | |||
MainController.AskAddServerBySSURL(addedUrl); | |||
} | |||
Application.Run(); | |||
} | |||
@@ -1,10 +1,10 @@ | |||
//------------------------------------------------------------------------------ | |||
// <auto-generated> | |||
// This code was generated by a tool. | |||
// Runtime Version:4.0.30319.42000 | |||
// 此代码由工具生成。 | |||
// 运行时版本:4.0.30319.42000 | |||
// | |||
// Changes to this file may cause incorrect behavior and will be lost if | |||
// the code is regenerated. | |||
// 对此文件的更改可能会导致不正确的行为,并且如果 | |||
// 重新生成代码,这些更改将会丢失。 | |||
// </auto-generated> | |||
//------------------------------------------------------------------------------ | |||
@@ -13,12 +13,12 @@ namespace Shadowsocks.Properties { | |||
/// <summary> | |||
/// A strongly-typed resource class, for looking up localized strings, etc. | |||
/// 一个强类型的资源类,用于查找本地化的字符串等。 | |||
/// </summary> | |||
// This class was auto-generated by the StronglyTypedResourceBuilder | |||
// class via a tool like ResGen or Visual Studio. | |||
// To add or remove a member, edit your .ResX file then rerun ResGen | |||
// with the /str option, or rebuild your VS project. | |||
// 此类是由 StronglyTypedResourceBuilder | |||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 | |||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen | |||
// (以 /str 作为命令选项),或重新生成 VS 项目。 | |||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] | |||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | |||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | |||
@@ -33,7 +33,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Returns the cached ResourceManager instance used by this class. | |||
/// 返回此类使用的缓存的 ResourceManager 实例。 | |||
/// </summary> | |||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | |||
internal static global::System.Resources.ResourceManager ResourceManager { | |||
@@ -47,8 +47,8 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Overrides the current thread's CurrentUICulture property for all | |||
/// resource lookups using this strongly typed resource class. | |||
/// 重写当前线程的 CurrentUICulture 属性 | |||
/// 重写当前线程的 CurrentUICulture 属性。 | |||
/// </summary> | |||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | |||
internal static global::System.Globalization.CultureInfo Culture { | |||
@@ -61,7 +61,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized string similar to /* eslint-disable */ | |||
/// 查找类似 /* eslint-disable */ | |||
///// Was generated by gfwlist2pac in precise mode | |||
///// https://github.com/clowwindy/gfwlist2pac | |||
/// | |||
@@ -76,7 +76,7 @@ namespace Shadowsocks.Properties { | |||
///* This file is part of Adblock Plus <http://adblockplus.org/>, | |||
///* Copyright (C) 2006-2014 Eyeo GmbH | |||
///* | |||
///* Adblock Plus is free software: you can redistribute it and/or [rest of string was truncated]";. | |||
///* Adblock Plus is free software: you can redistribute it and/or [字符串的其余部分被截断]"; 的本地化字符串。 | |||
/// </summary> | |||
internal static string abp_js { | |||
get { | |||
@@ -85,55 +85,29 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized string similar to var __USERRULES__ = []; | |||
///var __RULES__ = [ | |||
/// "|http://85.17.73.31/", | |||
/// "||agnesb.fr", | |||
/// "||akiba-web.com", | |||
/// "||altrec.com", | |||
/// "||angela-merkel.de", | |||
/// "||angola.org", | |||
/// "||apartmentratings.com", | |||
/// "||apartments.com", | |||
/// "||arena.taipei", | |||
/// "||asianspiss.com", | |||
/// "||assimp.org", | |||
/// "||athenaeizou.com", | |||
/// "||azubu.tv", | |||
/// "||bankmobilevibe.com", | |||
/// "||banorte.com", | |||
/// "||bash-hackers.org", | |||
/// "||beeg.com", | |||
/// "||global.bing.com", | |||
/// "||bloombergview.com", | |||
/// "||booktopia.com.au", | |||
/// [rest of string was truncated]";. | |||
/// 查找 System.Byte[] 类型的本地化资源。 | |||
/// </summary> | |||
internal static string default_abp_rule { | |||
internal static byte[] dlc_dat { | |||
get { | |||
return ResourceManager.GetString("default_abp_rule", resourceCulture); | |||
object obj = ResourceManager.GetObject("dlc_dat", resourceCulture); | |||
return ((byte[])(obj)); | |||
} | |||
} | |||
/// <summary> | |||
/// Looks up a localized string similar to en,zh-CN,zh-TW,ja | |||
///#Restart program to apply translation,,, | |||
///#This is comment line,,, | |||
///#Always keep language name at head of file,,, | |||
///#Language name is output in log,,, | |||
///"#You can find it by search ""Current language is:""",,, | |||
///#Please use UTF-8 with BOM encoding so we can edit it in Excel,,, | |||
///,,, | |||
///Shadowsocks,Shadowsocks,Shadowsocks,Shadowsocks | |||
///,,, | |||
///#Menu,,, | |||
///,,, | |||
///System Proxy,系统代理,系統代理,システムプロキシ | |||
///Disable,禁用,禁用,無効 | |||
///PAC,PAC 模式,PAC 模式,PAC | |||
///Global,全局模式,全局模式,全般 | |||
///Servers,服务器,伺服器,サーバー | |||
///Edit Servers...,编辑服务器...,編輯伺服器...,サーバーの編集.. [rest of string was truncated]";. | |||
/// 查找类似 en,ru-RU,zh-CN,zh-TW,ja,ko,fr | |||
///#Restart program to apply translation,,,,,, | |||
///#This is comment line,,,,,, | |||
///#Always keep language name at head of file,,,,,, | |||
///#Language name is output in log,,,,,, | |||
///"#You can find it by search ""Current language is:""",,,,,, | |||
///#Please use UTF-8 with BOM encoding so we can edit it in Excel,,,,,, | |||
///,,,,,, | |||
///Shadowsocks,Shadowsocks,Shadowsocks,Shadowsocks,Shadowsocks,Shadowsocks,Shadowsocks | |||
///,,,,,, | |||
///#Menu,,,,,, | |||
///,,,,,, | |||
///System Proxy,Системный прокси-сервер,系统代理,系統代理,システムプロキシ,시스템 프록시,P [字符串的其余部分被截断]"; 的本地化字符串。 | |||
/// </summary> | |||
internal static string i18n_csv { | |||
get { | |||
@@ -142,7 +116,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized resource of type System.Byte[]. | |||
/// 查找 System.Byte[] 类型的本地化资源。 | |||
/// </summary> | |||
internal static byte[] libsscrypto_dll { | |||
get { | |||
@@ -152,16 +126,13 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8" ?> | |||
/// 查找类似 <?xml version="1.0" encoding="utf-8" ?> | |||
///<!-- Warning: Configuration may reset after shadowsocks upgrade. --> | |||
///<!-- If you messed it up, delete this file and Shadowsocks will create a new one. --> | |||
///<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||
/// <targets> | |||
/// <target name="file" xsi:type="File" fileName="shadowsocks.log"/> | |||
/// | |||
/// </targets> | |||
/// <rules> | |||
/// <logger name="Name.Space.Class1" minlevel="Debug" writeTo="f1" /> | |||
/// </rules> | |||
///</nlog>. | |||
/// <!-- This line is managed by Shadowsocks. Do not modify it unless you know what you are doing.--> | |||
/// <target name="file" xsi:type="File" fileName="ss_win_temp\shadowsocks.log" writ [字符串的其余部分被截断]"; 的本地化字符串。 | |||
/// </summary> | |||
internal static string NLog_config { | |||
get { | |||
@@ -170,7 +141,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized string similar to listen-address __PRIVOXY_BIND_IP__:__PRIVOXY_BIND_PORT__ | |||
/// 查找类似 listen-address __PRIVOXY_BIND_IP__:__PRIVOXY_BIND_PORT__ | |||
///toggle 0 | |||
///logfile ss_privoxy.log | |||
///show-on-task-bar 0 | |||
@@ -178,7 +149,7 @@ namespace Shadowsocks.Properties { | |||
///forward-socks5 / __SOCKS_HOST__:__SOCKS_PORT__ . | |||
///max-client-connections 2048 | |||
///hide-console | |||
///. | |||
/// 的本地化字符串。 | |||
/// </summary> | |||
internal static string privoxy_conf { | |||
get { | |||
@@ -187,7 +158,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized resource of type System.Byte[]. | |||
/// 查找 System.Byte[] 类型的本地化资源。 | |||
/// </summary> | |||
internal static byte[] privoxy_exe { | |||
get { | |||
@@ -197,7 +168,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized resource of type System.Drawing.Bitmap. | |||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。 | |||
/// </summary> | |||
internal static System.Drawing.Bitmap ss32Fill { | |||
get { | |||
@@ -207,7 +178,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized resource of type System.Drawing.Bitmap. | |||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。 | |||
/// </summary> | |||
internal static System.Drawing.Bitmap ss32In { | |||
get { | |||
@@ -217,7 +188,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized resource of type System.Drawing.Bitmap. | |||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。 | |||
/// </summary> | |||
internal static System.Drawing.Bitmap ss32Out { | |||
get { | |||
@@ -227,7 +198,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized resource of type System.Drawing.Bitmap. | |||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。 | |||
/// </summary> | |||
internal static System.Drawing.Bitmap ss32Outline { | |||
get { | |||
@@ -237,7 +208,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized resource of type System.Drawing.Bitmap. | |||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。 | |||
/// </summary> | |||
internal static System.Drawing.Bitmap ssw128 { | |||
get { | |||
@@ -247,7 +218,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized resource of type System.Byte[]. | |||
/// 查找 System.Byte[] 类型的本地化资源。 | |||
/// </summary> | |||
internal static byte[] sysproxy_exe { | |||
get { | |||
@@ -257,7 +228,7 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized resource of type System.Byte[]. | |||
/// 查找 System.Byte[] 类型的本地化资源。 | |||
/// </summary> | |||
internal static byte[] sysproxy64_exe { | |||
get { | |||
@@ -267,9 +238,9 @@ namespace Shadowsocks.Properties { | |||
} | |||
/// <summary> | |||
/// Looks up a localized string similar to ! Put user rules line by line in this file. | |||
/// 查找类似 ! Put user rules line by line in this file. | |||
///! See https://adblockplus.org/en/filter-cheatsheet | |||
///. | |||
/// 的本地化字符串。 | |||
/// </summary> | |||
internal static string user_rule { | |||
get { | |||
@@ -121,8 +121,8 @@ | |||
<data name="abp_js" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||
<value>..\Data\abp.js;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;gb2312</value> | |||
</data> | |||
<data name="default_abp_rule" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||
<value>..\Data\default-abp-rule.js;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> | |||
<data name="dlc_dat" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||
<value>..\data\dlc.dat;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
</data> | |||
<data name="i18n_csv" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||
<value>..\Data\i18n.csv;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value> | |||
@@ -46,7 +46,7 @@ namespace Shadowsocks.View | |||
private MenuItem localPACItem; | |||
private MenuItem onlinePACItem; | |||
private MenuItem editLocalPACItem; | |||
private MenuItem updateFromGFWListItem; | |||
private MenuItem updateFromGeositeItem; | |||
private MenuItem editGFWUserRuleItem; | |||
private MenuItem editOnlinePACItem; | |||
private MenuItem secureLocalPacUrlToggleItem; | |||
@@ -86,8 +86,8 @@ namespace Shadowsocks.View | |||
controller.ShowPluginOutputChanged += controller_ShowPluginOutputChanged; | |||
controller.EnableGlobalChanged += controller_EnableGlobalChanged; | |||
controller.Errored += controller_Errored; | |||
controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted; | |||
controller.UpdatePACFromGFWListError += controller_UpdatePACFromGFWListError; | |||
controller.UpdatePACFromGeositeCompleted += controller_UpdatePACFromGeositeCompleted; | |||
controller.UpdatePACFromGeositeError += controller_UpdatePACFromGeositeError; | |||
_notifyIcon = new NotifyIcon(); | |||
UpdateTrayIconAndNotifyText(); | |||
@@ -307,8 +307,8 @@ namespace Shadowsocks.View | |||
this.onlinePACItem = CreateMenuItem("Online PAC", new EventHandler(this.OnlinePACItem_Click)), | |||
new MenuItem("-"), | |||
this.editLocalPACItem = CreateMenuItem("Edit Local PAC File...", new EventHandler(this.EditPACFileItem_Click)), | |||
this.updateFromGFWListItem = CreateMenuItem("Update Local PAC from GFWList", new EventHandler(this.UpdatePACFromGFWListItem_Click)), | |||
this.editGFWUserRuleItem = CreateMenuItem("Edit User Rule for GFWList...", new EventHandler(this.EditUserRuleFileForGFWListItem_Click)), | |||
this.updateFromGeositeItem = CreateMenuItem("Update Local PAC from Geosite", new EventHandler(this.UpdatePACFromGeositeItem_Click)), | |||
this.editGFWUserRuleItem = CreateMenuItem("Edit User Rule for Geosite...", new EventHandler(this.EditUserRuleFileForGeositeItem_Click)), | |||
this.secureLocalPacUrlToggleItem = CreateMenuItem("Secure Local PAC", new EventHandler(this.SecureLocalPacUrlToggleItem_Click)), | |||
CreateMenuItem("Copy Local PAC URL", new EventHandler(this.CopyLocalPacUrlItem_Click)), | |||
this.editOnlinePACItem = CreateMenuItem("Edit Online PAC URL...", new EventHandler(this.UpdateOnlinePACURLItem_Click)), | |||
@@ -387,17 +387,17 @@ namespace Shadowsocks.View | |||
_notifyIcon.ShowBalloonTip(timeout); | |||
} | |||
void controller_UpdatePACFromGFWListError(object sender, System.IO.ErrorEventArgs e) | |||
void controller_UpdatePACFromGeositeError(object sender, System.IO.ErrorEventArgs e) | |||
{ | |||
ShowBalloonTip(I18N.GetString("Failed to update PAC file"), e.GetException().Message, ToolTipIcon.Error, 5000); | |||
logger.LogUsefulException(e.GetException()); | |||
} | |||
void controller_UpdatePACFromGFWListCompleted(object sender, GFWListUpdater.ResultEventArgs e) | |||
void controller_UpdatePACFromGeositeCompleted(object sender, GeositeResultEventArgs e) | |||
{ | |||
string result = e.Success | |||
? I18N.GetString("PAC updated") | |||
: I18N.GetString("No updates found. Please report to GFWList if you have problems with it."); | |||
: I18N.GetString("No updates found. Please report to Geosite if you have problems with it."); | |||
ShowBalloonTip(I18N.GetString("Shadowsocks"), result, ToolTipIcon.Info, 1000); | |||
} | |||
@@ -685,12 +685,12 @@ namespace Shadowsocks.View | |||
controller.TouchPACFile(); | |||
} | |||
private void UpdatePACFromGFWListItem_Click(object sender, EventArgs e) | |||
private void UpdatePACFromGeositeItem_Click(object sender, EventArgs e) | |||
{ | |||
controller.UpdatePACFromGFWList(); | |||
controller.UpdatePACFromGeosite(); | |||
} | |||
private void EditUserRuleFileForGFWListItem_Click(object sender, EventArgs e) | |||
private void EditUserRuleFileForGeositeItem_Click(object sender, EventArgs e) | |||
{ | |||
controller.TouchUserRuleFile(); | |||
} | |||
@@ -917,14 +917,14 @@ namespace Shadowsocks.View | |||
if (this.localPACItem.Checked) | |||
{ | |||
this.editLocalPACItem.Enabled = true; | |||
this.updateFromGFWListItem.Enabled = true; | |||
this.updateFromGeositeItem.Enabled = true; | |||
this.editGFWUserRuleItem.Enabled = true; | |||
this.editOnlinePACItem.Enabled = false; | |||
} | |||
else | |||
{ | |||
this.editLocalPACItem.Enabled = false; | |||
this.updateFromGFWListItem.Enabled = false; | |||
this.updateFromGeositeItem.Enabled = false; | |||
this.editGFWUserRuleItem.Enabled = false; | |||
this.editOnlinePACItem.Enabled = true; | |||
} | |||
@@ -4,8 +4,13 @@ | |||
<package id="Costura.Fody" version="3.3.3" targetFramework="net472" /> | |||
<package id="Fody" version="4.2.1" targetFramework="net472" developmentDependency="true" /> | |||
<package id="GlobalHotKey" version="1.1.0" targetFramework="net472" /> | |||
<package id="Google.Protobuf" version="3.11.4" targetFramework="net472" /> | |||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" /> | |||
<package id="NLog" version="4.6.8" targetFramework="net472" /> | |||
<package id="StringEx.CS" version="0.3.1" targetFramework="net472" developmentDependency="true" /> | |||
<package id="System.Buffers" version="4.4.0" targetFramework="net472" /> | |||
<package id="System.Memory" version="4.5.2" targetFramework="net472" /> | |||
<package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net472" /> | |||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net472" /> | |||
<package id="ZXing.Net" version="0.16.5" targetFramework="net472" /> | |||
</packages> |
@@ -77,6 +77,9 @@ | |||
<Reference Include="GlobalHotKey, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\GlobalHotKey.1.1.0\lib\GlobalHotKey.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Google.Protobuf, Version=3.11.4.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\Google.Protobuf.3.11.4\lib\net45\Google.Protobuf.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Microsoft.CSharp" /> | |||
<Reference Include="Microsoft.VisualBasic" /> | |||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | |||
@@ -87,13 +90,26 @@ | |||
</Reference> | |||
<Reference Include="PresentationCore" /> | |||
<Reference Include="System" /> | |||
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath> | |||
</Reference> | |||
<Reference Include="System.Configuration" /> | |||
<Reference Include="System.Data" /> | |||
<Reference Include="System.Data.DataSetExtensions" /> | |||
<Reference Include="System.Drawing" /> | |||
<Reference Include="System.IO.Compression" /> | |||
<Reference Include="System.Management" /> | |||
<Reference Include="System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\System.Memory.4.5.2\lib\netstandard2.0\System.Memory.dll</HintPath> | |||
</Reference> | |||
<Reference Include="System.Net" /> | |||
<Reference Include="System.Numerics" /> | |||
<Reference Include="System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll</HintPath> | |||
</Reference> | |||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath> | |||
</Reference> | |||
<Reference Include="System.Runtime.Serialization" /> | |||
<Reference Include="System.ServiceModel" /> | |||
<Reference Include="System.Transactions" /> | |||
@@ -112,6 +128,7 @@ | |||
<ItemGroup> | |||
<Compile Include="Controller\HotkeyReg.cs" /> | |||
<Compile Include="Controller\LoggerExtension.cs" /> | |||
<Compile Include="Controller\Service\GeositeUpdater.cs" /> | |||
<Compile Include="Controller\Service\PACDaemon.cs" /> | |||
<Compile Include="Controller\Service\NamedPipeServer.cs" /> | |||
<Compile Include="Controller\System\ProtocolHandler.cs" /> | |||
@@ -133,6 +150,7 @@ | |||
<Compile Include="Encryption\Stream\StreamMbedTLSEncryptor.cs" /> | |||
<Compile Include="Encryption\Stream\StreamOpenSSLEncryptor.cs" /> | |||
<Compile Include="Encryption\Stream\StreamSodiumEncryptor.cs" /> | |||
<Compile Include="Model\Geosite\Geosite.cs" /> | |||
<Compile Include="Model\HotKeyConfig.cs" /> | |||
<Compile Include="Model\NLogConfig.cs" /> | |||
<Compile Include="Model\ProxyConfig.cs" /> | |||
@@ -155,7 +173,6 @@ | |||
<Compile Include="Controller\Strategy\StatisticsStrategy.cs" /> | |||
<Compile Include="Controller\System\AutoStartup.cs" /> | |||
<Compile Include="Controller\FileManager.cs" /> | |||
<Compile Include="Controller\Service\GFWListUpdater.cs" /> | |||
<Compile Include="Controller\I18N.cs" /> | |||
<Compile Include="Controller\Service\Listener.cs" /> | |||
<Compile Include="Controller\Service\PortForwarder.cs" /> | |||
@@ -267,10 +284,12 @@ | |||
<None Include="app.manifest"> | |||
<SubType>Designer</SubType> | |||
</None> | |||
<None Include="Data\dlc.dat" /> | |||
<None Include="Data\i18n.csv" /> | |||
<None Include="Data\libsscrypto.dll.gz" /> | |||
<None Include="Data\NLog.config" /> | |||
<None Include="Data\privoxy.exe.gz" /> | |||
<None Include="Model\Geosite\geosite.proto" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<None Include="Data\sysproxy.exe.gz" /> | |||
@@ -283,7 +302,6 @@ | |||
</None> | |||
<None Include="Resources\ssw128.png" /> | |||
<Content Include="Data\abp.js" /> | |||
<Content Include="Data\default-abp-rule.js" /> | |||
<Content Include="Data\privoxy_conf.txt" /> | |||
<Content Include="Data\user-rule.txt" /> | |||
<None Include="FodyWeavers.xml"> | |||
@@ -322,6 +340,7 @@ | |||
<Install>true</Install> | |||
</BootstrapperPackage> | |||
</ItemGroup> | |||
<ItemGroup /> | |||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
<Import Project="..\packages\Fody.4.2.1\build\Fody.targets" Condition="Exists('..\packages\Fody.4.2.1\build\Fody.targets')" /> | |||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | |||