Skip to content

Home_chi

R0uter edited this page Apr 15, 2016 · 5 revisions

GFW 域名白名单

autoproxy.pac (GFW List) 是一个包含被墙网站域名的黑名单,你需要经常更新它才能正常使用,如果不这样做,你就有可能无法访问最近被墙的网站了。

现在越来越多的网站都被墙了,你需要每隔几小时就更新 GFWList 以保证名单有效。所以说,是时候使用白名单了。

我使用白名单生成了一个 PAC 文件,它包含了那些能直接访问的域名,对于没有包含的域名则走代理。

要使用这个 PAC 文件,你可能得需要一个不计流量的代理服务。

域名白名单列表来自这个项目felixonmars dnsmasq-china-list

如何使用

下载whitelist.pac,编辑服务器 IP 地址以及代理类型,然后配置你的浏览器加载whitelist.pac即可。

var proxy = new Array( "SOCKS5 127.0.0.1:1080; SOCKS 127.0.0.1:1080;",
Change the type of proxy,it also can be 'HTTPS'
注意要同时编辑 SOCKS5 和 SOCKS 的配置。

使用脚本生成 PAC 文件

执行终端命令 $python main.py.

然后whitelist.pac就会被更新了。

负载均衡

你可以更改 okToLoadBalance 值为 true 来打开负载均衡特性,编辑whitelist.pac的时候你会发现其实有三条代理配置。如果你不启用负载均衡则只有第一条是生效的,不过你要是启用了负载均衡,则需要编辑所有代理配置条目才行。

"SOCKS5 127.0.0.1:1083; SOCKS 127.0.0.1:1083;",
使用不同的IP或者端口,注意别丢了逗号!

如你所见,proxy是一个数组,你可以添加最多十条代理来做负载均衡!不过三条已经足够多了。

最后一点,负载均衡只是简单粗暴的基于域名的负载均衡,所以它不会对下载和视频生效。同时也要注意:如果你的代理速度不能做到基本一致,那你不应该使用它。

PAC 的性能 (100,000 次重复)

Firefox  
whitelist.pac 50ms 
load balabce: whitelist.pac 40ms

Chrome  
whitelist.pac 70ms
load balabce: whitelist.pac 68ms

Safari  
whitelist.pac 50ms  
load balabce: whitelist.pac 44ms  

感谢

breakwa11 gfw_whitelist
n0wa11 gfw_whitelist
clowwindy gfwlist2pac
felixonmars dnsmasq-china-list

##MIT License (MIT)

The MIT License (MIT)

Copyright (c) 2016 R0uter

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.