Created
October 17, 2012 19:36
-
-
Save arbeitandy/3907633 to your computer and use it in GitHub Desktop.
sample pacfile for work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function FindProxyForURL(url, host) { | |
| var lhost = host.toLowerCase(); | |
| var proxy_yes = "SOCKS5 127.0.0.1:18080"; | |
| var blackhole = "PROXY 127.0.0.1:80"; | |
| var proxy_no = "DIRECT"; | |
| host = lhost; | |
| if ((host == "locahost") || | |
| (shExpMatch(host, "locahost.*")) || | |
| (host == "127.0.0.1")) { | |
| return proxy_no; | |
| } | |
| if (dnsDomainIs(host, "twitter.com") || dnsDomainIs(host, ".twitter.com") || shExpMatch(url, "twitter.com")) { | |
| return blackhole; | |
| } else if (dnsDomainIs(host, ".facebook.com") || shExpMatch(host, "facebook.com")) { | |
| return blackhole; | |
| } else if (dnsDomainIs(host, ".youtube.com") || shExpMatch(host, "youtube.com")) { | |
| return blackhole; | |
| } else if (dnsDomainIs(host, ".ytimg.com") || shExpMatch(host, "ytimg.com")) { | |
| return blackhole; | |
| } else if (dnsDomainIs(host, ".tumblr.com") || shExpMatch(host, "tumblr.com")) { | |
| return proxy_yes; | |
| } | |
| return proxy_no; | |
| } |
arbeitandy
commented
Oct 17, 2012
Author
- inspired by http://findproxyforurl.com/pac-functions/
- enable
- networksetup -setautoproxyurl Wi-Fi $raw_address_of_this_gist
- check status
- scutil --proxy
- disable
- networksetup -setautoproxyurl Wi-Fi off
- enable
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment