Browse Source

🎃 PAC: direct connection for private IP ranges by @studentmain

tags/4.3.2.0
database64128 3 years ago
parent
commit
701032bb4f
No known key found for this signature in database GPG Key ID: 1CA27546BEDB8B01
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      shadowsocks-csharp/Data/abp.js

+ 15
- 0
shadowsocks-csharp/Data/abp.js View File

@@ -793,7 +793,22 @@ for (var i = 0; i < rules.length; i++) {
defaultMatcher.add(Filter.fromText(rules[i]));
}
// PAC has no v6 support, it sucks
var ip4Re = /^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/
var privateNet = [
["10.0.0.0", "255.0.0.0"],
["127.0.0.0", "255.0.0.0"],
["172.16.0.0", "255.240.0.0"],
["192.168.0.0", "255.255.0.0"],
]
function FindProxyForURL(url, host) {
if (host.match(ip4Re)) {
for (var i = 0; i < privateNet.length; i++) {
if (isInNet(host, privateNet[i][0], privateNet[i][1])) return direct;
}
}
if (userrulesMatcher.matchesAny(url, host) instanceof BlockingFilter) {
return proxy;
}


Loading…
Cancel
Save