Skip to content

Commit a073662

Browse files
committed
添加排除服务器功能。
1 parent 3a7dad3 commit a073662

File tree

5 files changed

+62
-7
lines changed

5 files changed

+62
-7
lines changed

shadowsocks-csharp/Controller/UpdateChecker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class UpdateChecker
2121

2222
public const string Name = "ShadowsocksR";
2323
public const string Copyright = "Copyright © BreakWa11 2017. Fork from Shadowsocks by clowwindy";
24-
public const string Version = "4.7.0";
24+
public const string Version = "4.7.3";
2525
#if !_DOTNET_4_0
2626
public const string NetVer = "2.0";
2727
#elif !_CONSOLE

shadowsocks-csharp/Data/cn.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Allow Clients from LAN=允许来自局域网的连接
2828
Load balance=服务器负载均衡
2929
Same host for same address=优先相同节点连接同一地址
3030
Enable domain white list(http proxy only)=使用域名白名单(仅http代理)
31-
Update local PAC from User Defined List=更新PAC为用户自定义的列表
31+
Update local PAC from User Defined List=更新PAC为用户自定义的列表(同目录下pac-url.ini)
3232
Update local PAC from Lan IP list=更新PAC为绕过局域网IP
3333
Update local PAC from Chn White list=更新PAC为绕过大陆常见域名列表
3434
Update local PAC from Chn IP list=更新PAC为绕过大陆IP(慎用)

shadowsocks-csharp/View/MenuViewController.cs

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,14 @@ private void LoadMenu()
298298
// HotKeys ab = new HotKeys();
299299
GlobalKeyForm gkf = new GlobalKeyForm(controller);
300300
//gkf.Show();
301-
301+
302+
303+
// System.Timers.Timer autoUpdate = new System.Timers.Timer();
304+
305+
302306

303307
}
304-
308+
305309

306310
private void controller_ConfigChanged(object sender, EventArgs e)
307311
{
@@ -467,6 +471,25 @@ void updateFreeNodeChecker_NewFreeNodeFound(object sender, EventArgs e)
467471
}
468472
}
469473

474+
475+
476+
//load servers that should be excluded from file excluded-servers.ini
477+
478+
479+
string[] excluded_parts = { "alsjflawjglajwelfjawlfjlawjfajwefljlgawefaefuoioio" }; // magic string: in case no server will match to this exlcuded string .
480+
String excludedFilePath = "excluded-servers.ini";
481+
if (System.IO.File.Exists(excludedFilePath))
482+
{
483+
string text = System.IO.File.ReadAllText(excludedFilePath);
484+
excluded_parts = text.Split(new string[] { "\r\n" }, StringSplitOptions.None);
485+
foreach (string ep in excluded_parts)
486+
{
487+
Debug.WriteLine(ep);
488+
}
489+
}
490+
491+
492+
470493
// import all, find difference
471494
{
472495
Dictionary<string, Server> old_servers = new Dictionary<string, Server>();
@@ -484,7 +507,23 @@ void updateFreeNodeChecker_NewFreeNodeFound(object sender, EventArgs e)
484507
{
485508
try
486509
{
487-
Server server = new Server(url, curGroup);
510+
Server server = new Server(url, curGroup); //url is ssurl or ssrurl
511+
512+
//Debug.WriteLine(server.server);
513+
//Debug.WriteLine(server.remarks);
514+
515+
bool isExcluded = false;
516+
foreach (string ep in excluded_parts)
517+
{
518+
if (server.remarks.Contains(ep) || server.server.Contains(ep))
519+
isExcluded = true;
520+
}
521+
if (isExcluded) {
522+
Debug.WriteLine("Exclude: " + server.remarks + "\t " + server.server);
523+
continue;
524+
}
525+
526+
488527
bool match = false;
489528
foreach (KeyValuePair<string, Server> pair in old_servers)
490529
{
@@ -499,6 +538,7 @@ void updateFreeNodeChecker_NewFreeNodeFound(object sender, EventArgs e)
499538
}
500539
if (!match)
501540
{
541+
502542
config.configs.Add(server);
503543
++count;
504544
}

shadowsocks-csharp/shadowsocks-csharp.csproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,18 @@
6161
<ErrorReport>prompt</ErrorReport>
6262
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
6363
</PropertyGroup>
64+
<PropertyGroup>
65+
<SignManifests>true</SignManifests>
66+
</PropertyGroup>
67+
<PropertyGroup>
68+
<SignAssembly>false</SignAssembly>
69+
</PropertyGroup>
70+
<PropertyGroup>
71+
<ManifestCertificateThumbprint>ADF40F5C0FC659D3DEC8DB025320979894A9F736</ManifestCertificateThumbprint>
72+
</PropertyGroup>
73+
<PropertyGroup>
74+
<ManifestKeyFile>shadowsocks-csharp_1_TemporaryKey.pfx</ManifestKeyFile>
75+
</PropertyGroup>
6476
<ItemGroup>
6577
<Reference Include="Microsoft.VisualBasic" />
6678
<Reference Include="System" />
@@ -295,6 +307,8 @@
295307
<None Include="Data\libsscrypto64.dll.gz" />
296308
<None Include="Data\mgwz.dll.gz" />
297309
<None Include="Data\privoxy.exe.gz" />
310+
<None Include="shadowsocks-csharp_1_TemporaryKey.pfx" />
311+
<None Include="shadowsocks-csharp_TemporaryKey.pfx" />
298312
</ItemGroup>
299313
<ItemGroup>
300314
<None Include="Data\proxy.pac.txt.gz" />

shadowsocks-csharp/shadowsocks-csharp4.0.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@
6464
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
6565
</PropertyGroup>
6666
<PropertyGroup>
67-
<ManifestCertificateThumbprint>4A922898E7E518837AD2D181625224F999227BDC</ManifestCertificateThumbprint>
67+
<ManifestCertificateThumbprint>70133AC87B2082C04CF2B3117DA40BA13E5D4588</ManifestCertificateThumbprint>
6868
</PropertyGroup>
6969
<PropertyGroup>
70-
<ManifestKeyFile>shadowsocks-csharp4.0_TemporaryKey.pfx</ManifestKeyFile>
70+
<ManifestKeyFile>shadowsocks-csharp4.0_1_TemporaryKey.pfx</ManifestKeyFile>
7171
</PropertyGroup>
7272
<PropertyGroup>
7373
<GenerateManifests>true</GenerateManifests>
@@ -308,6 +308,7 @@
308308
<None Include="Data\libsscrypto.dll.gz" />
309309
<None Include="Data\mgwz.dll.gz" />
310310
<None Include="Data\privoxy.exe.gz" />
311+
<None Include="shadowsocks-csharp4.0_1_TemporaryKey.pfx" />
311312
<None Include="shadowsocks-csharp4.0_TemporaryKey.pfx" />
312313
</ItemGroup>
313314
<ItemGroup>

0 commit comments

Comments
 (0)