openwrt之shadowsock做PAC代理
安装配置shadowsocks
+ChinaDNS
+dns-forwarder
添加软件源
- 添加证书
wget http://openwrt-dist.sourceforge.net/openwrt-dist.pub
opkg-key add openwrt-dist.pub - 编辑
/etc/opkg/customfeeds.conf
,添加软件源src/gz openwrt_dist http://openwrt-dist.sourceforge.net/packages/base/x86_64
src/gz openwrt_dist_luci http://openwrt-dist.sourceforge.net/packages/luci
在线安装
opkg update |
离线安装
opkg update |
配置shadowsocks
添加服务器
设置
访问控制
配置ChinaDNS
配置dns-forwarder
安装配置HTTP代理privoxy
(可选)
安装
opkg install privoxy |
配置 方式一(注意先,先配置好再启动)
配置 方式二
编辑/etc/config/privoxy
config privoxy 'privoxy' |
配置PAC
文件
安装pip
opkg install python3-pip |
安装genpac
pip install genpac |
生成SOCKS5
代理方式
genpac --proxy="SOCKS5 192.168.3.2:1080" --gfwlist-proxy="SOCKS5 192.168.3.2:1080" -o /www/gfwlist.pac |
生成HTTP
代理方式
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
/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
/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
更改权限
系统
>> 计划任务
chmod +x /etc/script/gen_pac.sh |
添加定时任务
14 4 8 * * sh /etc/script/gen_chnroute.sh |
使用
macos系统
参考文献
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Maktub_Blog!