Browse Source

🔀 Merge pull request #3008 from shadowsocks/pac-private-ip

🎃 PAC: workaround to exempt private IP ranges in whitelist mode
tags/4.3.2.0
database64128 GitHub 4 years ago
parent
commit
73fa9205ed
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
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