function FindProxyForURL(url, host) {
// If the hostname matches, send direct.
if (dnsDomainIs(host, "
test.com") ||
shExpMatch(host, "(*.test.com|
test.com)"))
return "DIRECT";
// If the requested website is hosted within China, send direct.
if (isPlainHostName(host) ||
shExpMatch(host, "*.local") ||
isInNet(dnsResolve(host), "10.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "172.16.0.0", "255.240.0.0") ||
isInNet(dnsResolve(host), "192.168.0.0", "255.255.0.0") ||
isInNet(dnsResolve(host), "127.0.0.0", "255.255.255.0") ||
isInNet(dnsResolve(host), "111.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "123.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "180.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "220.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "103.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "205.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "140.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "110.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "202.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "211.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "117.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "42.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "103.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "125.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "61.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "203.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "123.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "140.0.0.0", "255.0.0.0") ||
isInNet(dnsResolve(host), "14.0.0.0", "255.0.0.0"))
return "DIRECT";
// DEFAULT RULE: All other traffic, use below socks proxies, in fail-over order.
return "SOCKS 127.0.0.1:7070, 192.168.20.27:7070";
}
默认流量都走 proxy ,自定义的 IP block 走直连。我只是写了一点我要上的中国的 IP 段,你可以自己修改。