Skip to content

Instantly share code, notes, and snippets.

@b4tman
Last active January 31, 2018 10:26
Show Gist options
  • Save b4tman/b9560c62bd0be4bf402cd5345a6c27f1 to your computer and use it in GitHub Desktop.
Save b4tman/b9560c62bd0be4bf402cd5345a6c27f1 to your computer and use it in GitHub Desktop.
proxy autoconfig - raspberry
function FindProxyForURL(url, host) {
host_ip = dnsResolve(host)
// local net
if (isInNet(host_ip, "10.0.0.0", "255.0.0.0") ||
isInNet(host_ip, "172.16.0.0", "255.240.0.0") ||
isInNet(host_ip, "192.168.0.0", "255.255.0.0"))
{
return "DIRECT";
}
// Rosintel + Yandex = love
if (dnsDomainIs(host, ".yandex.ru") || dnsDomainIs(host, ".yandex.net") || dnsDomainIs(host, "yastatic.net") || dnsDomainIs(host, "yadi.sk") || shExpMatch(host, "yandex.(ru|net|com)")) return "DIRECT";
if ("127.0.0.1" == host_ip) return "DIRECT";
return "PROXY 172.31.0.135:3128; DIRECT";
}
function FindProxyForURL(url, host) {
host_ip = dnsResolve(host)
// local net
if (isInNet(host_ip, "10.0.0.0", "255.0.0.0") ||
isInNet(host_ip, "172.16.0.0", "255.240.0.0") ||
isInNet(host_ip, "192.168.0.0", "255.255.0.0"))
{
return "DIRECT";
}
// Rosintel + Yandex = love
if (dnsDomainIs(host, ".yandex.ru") || dnsDomainIs(host, ".yandex.net") || dnsDomainIs(host, "yastatic.net") || dnsDomainIs(host, "yadi.sk") || shExpMatch(host, "yandex.(ru|net|com)")) return "DIRECT";
if ("127.0.0.1" == host_ip) return "DIRECT";
// All other requests go through port 8080 of 192.168.0.222
// should that fail to respond, go directly to the WWW:
return "PROXY 192.168.0.222:8080; DIRECT";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment