Skip to content

Instantly share code, notes, and snippets.

@lai32290
Created May 8, 2017 11:10
Show Gist options
  • Save lai32290/f924387e2f4acfd64e9890468e1ef6f7 to your computer and use it in GitHub Desktop.
Save lai32290/f924387e2f4acfd64e9890468e1ef6f7 to your computer and use it in GitHub Desktop.
Ubuntu auto detect proxy pac config file
function FindProxyForURL(url, host)
{
if (isInNet(myIpAddress(), "1.2.3.0", "255.255.255.0")) {
if (isInNet(host, "192.168.0.0", "255.255.0.0"))
return "DIRECT";
if (shExpMatch(url, "http:*"))
return "PROXY my.proxy.com:8000" ;
if (shExpMatch(url, "https:*"))
return "PROXY my.proxy.com:8000" ;
if (shExpMatch(url, "ftp:*"))
return "PROXY my.proxy.com:8000" ;
return "DIRECT";
} else {
return "DIRECT";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment