Skip to content

Instantly share code, notes, and snippets.

@dubiao
Forked from lwr/autopac.sh
Created May 31, 2016 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dubiao/c87b68ca550eb7e9dbd0cf178af6d77a to your computer and use it in GitHub Desktop.
Save dubiao/c87b68ca550eb7e9dbd0cf178af6d77a 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