openwrt之shadowsock做PAC代理
安装配置shadowsocks+ChinaDNS+dns-forwarder
添加软件源
- 添加证书
1 | wget http://openwrt-dist.sourceforge.net/openwrt-dist.pub |
- 编辑
/etc/opkg/customfeeds.conf,添加软件源
1 | src/gz openwrt_dist http://openwrt-dist.sourceforge.net/packages/base/x86_64 |
在线安装
1 | opkg update |
离线安装
1 | opkg update |
配置shadowsocks
添加服务器

设置
访问控制

配置ChinaDNS

配置dns-forwarder

安装配置HTTP代理privoxy(可选)
安装
1 | opkg install privoxy |
配置 方式一(注意先,先配置好再启动)


配置 方式二
编辑/etc/config/privoxy
1 | config privoxy 'privoxy' |
配置PAC文件
安装pip
1 | opkg install python3-pip |
安装genpac
1 | pip install genpac |
生成SOCKS5代理方式
1 | genpac --proxy="SOCKS5 192.168.3.2:1080" --gfwlist-proxy="SOCKS5 192.168.3.2:1080" -o /www/gfwlist.pac |
生成HTTP代理方式
1 | genpac --proxy="SOCKS5 192.168.3.2:1080" --gfwlist-proxy="PROXY 192.168.3.2:8118" -o /www/gfwlist.pac |
自动更新配置
新建脚本
/etc/script/gen_pac.sh
1 | /usr/bin/genpac --proxy="SOCKS5 192.168.3.2:1080" --gfwlist-proxy="SOCKS5 192.168.3.2:1080" -o /www/gfwlist.pac |
/etc/script/gen_chnroute.sh
1 | /bin/wget -O- 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' | awk -F\| '/CN\|ipv4/ { printf("%s/%d\n", $4, 32-log($5)/log(2)) }' > /etc/chinadns_chnroute.txt |
更改权限
系统 >> 计划任务
1 | chmod +x /etc/script/gen_pac.sh |
添加定时任务
1 | 14 4 8 * * sh /etc/script/gen_chnroute.sh |

使用
macos系统

参考文献
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Maktub_Blog!