Skip to content

Instantly share code, notes, and snippets.

@rainbowbird
Forked from lwr/autopac.sh
Created February 22, 2018 06:03
Show Gist options
  • Save rainbowbird/4bdf357171c9f22f8e8d57a7d41547f4 to your computer and use it in GitHub Desktop.
Save rainbowbird/4bdf357171c9f22f8e8d57a7d41547f4 to your computer and use it in GitHub Desktop.
使用 https://github.com/clowwindy/gfwlist2pac 生成自定义 PAC 的辅助脚本
#!/bin/bash
GFWLIST=https://autoproxy-gfwlist.googlecode.com/svn/trunk/gfwlist.txt
PROXY=127.0.0.1:7070
cd `dirname "${BASH_SOURCE[0]}"`
echo "Downloading gfwlist from $GFWLIST"
curl "$GFWLIST" --socks5-hostname "$PROXY" > /tmp/gfwlist.txt
/usr/local/bin/gfwlist2pac \
--input /tmp/gfwlist.txt \
--file proxy.pac \
--proxy "SOCKS5 $PROXY; SOCKS $PROXY; DIRECT" \
--user-rule user_rule.txt
rm -f /tmp/gfwlist.txt
! clowwindy's buildin rules !
google.com
google.co.jp
google.co.hk
github.com
wikipedia.org
! rules for me !
t.co
fb.me
bit.ly
sourceforge.net
nytimes.com
jetbrains.com
intellij.net
wikipedia.org
wikimedia.org
tumblr.com
fqrouter.com
feedly.com
dropbox.com
mshcdn.com
bootply.com
feedsportal.com
twimg.com

Installation

  • Place this script autopac.sh to: $HOME/Dropbox/Apps/dev/pac

  • Place user_rule.txt to the same location

  • Then use crontab -e to add a scheduling work like this:

    10 14 * * * nohup $HOME/Dropbox/Apps/dev/pac/autopac.sh
    

    which will schedule this script to run every day at 2:10pm

  • You must install @clowwindy's gfwlist2pac first, using this command

    pip install gfwlist2pac
    

    or

    sudo easy_install gfwlist2pac
    

You now could configure your GoAgentX to use this custom PAC instead. Now we could stop complaining that @ohdarling88 drops the gfwlist supports in his GoAgentX version2

Enjoy it.

Thanks to @ohdarling88, @clowwindy

More works need to do

  • add user rule supports for multiple proxies (such as u2b should go through GAE instead of shadowsocks)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment