3
3
using Shadowsocks . Model ;
4
4
using Shadowsocks . Properties ;
5
5
using System ;
6
+ using System . Collections . Generic ;
6
7
using System . Diagnostics ;
7
8
using System . IO ;
9
+ using System . Linq ;
8
10
using System . Text ;
9
11
using System . Threading ;
10
12
@@ -14,6 +16,31 @@ public static class Sysproxy
14
16
{
15
17
private const string _userWininetConfigFile = "user-wininet.json" ;
16
18
19
+ private static string [ ] _lanIP = {
20
+ "<local>" ,
21
+ "localhost" ,
22
+ "127.*" ,
23
+ "10.*" ,
24
+ "172.16.*" ,
25
+ "172.17.*" ,
26
+ "172.18.*" ,
27
+ "172.19.*" ,
28
+ "172.20.*" ,
29
+ "172.21.*" ,
30
+ "172.22.*" ,
31
+ "172.23.*" ,
32
+ "172.24.*" ,
33
+ "172.25.*" ,
34
+ "172.26.*" ,
35
+ "172.27.*" ,
36
+ "172.28.*" ,
37
+ "172.29.*" ,
38
+ "172.30.*" ,
39
+ "172.31.*" ,
40
+ "192.168.*"
41
+ } ;
42
+
43
+
17
44
private static string _queryStr ;
18
45
19
46
// In general, this won't change
@@ -61,8 +88,13 @@ public static void SetIEProxy(bool enable, bool global, string proxyServer, stri
61
88
string arguments ;
62
89
if ( enable )
63
90
{
91
+ List < string > customBypass = new List < string > ( _userSettings . BypassList . Split ( new char [ ] { ';' } , StringSplitOptions . RemoveEmptyEntries ) ) ;
92
+ customBypass . AddRange ( _lanIP ) ;
93
+ string [ ] realBypassStrings = customBypass . Distinct ( ) . ToArray ( ) ;
94
+ string realBypassString = string . Join ( ";" , realBypassStrings ) ;
95
+
64
96
arguments = global
65
- ? $ "global { proxyServer } <local>;localhost;127.*;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;192.168.* "
97
+ ? $ "global { proxyServer } { realBypassString } "
66
98
: $ "pac { pacURL } ";
67
99
}
68
100
else
@@ -88,11 +120,11 @@ public static bool ResetIEProxy()
88
120
{
89
121
try
90
122
{
91
- // clear user-wininet.json
92
- _userSettings = new SysproxyConfig ( ) ;
93
- Save ( ) ;
94
- // clear system setting
95
- ExecSysproxy ( "set 1 - - -" ) ;
123
+ // clear user-wininet.json
124
+ _userSettings = new SysproxyConfig ( ) ;
125
+ Save ( ) ;
126
+ // clear system setting
127
+ ExecSysproxy ( "set 1 - - -" ) ;
96
128
}
97
129
catch ( Exception e )
98
130
{
0 commit comments