]> 91.132.146.200 Git - klimbim.git/commitdiff
proxy.pac file example.
authorBanana <banana@starscream.de>
Wed, 11 Nov 2015 10:13:29 +0000 (11:13 +0100)
committerBanana <banana@starscream.de>
Wed, 11 Nov 2015 10:13:29 +0000 (11:13 +0100)
Readme update

README
proxy/README [new file with mode: 0644]
proxy/proxy.pac [new file with mode: 0644]

diff --git a/README b/README
index 12ece9895fcb29a79a936e7ecda780bcccd77282..6bf93de7f09ca4fea077a1f02f060543116d6cd4 100644 (file)
--- a/README
+++ b/README
@@ -1 +1,3 @@
 A bag full of things
+
+Use the file browse function to see what is inside.
diff --git a/proxy/README b/proxy/README
new file mode 100644 (file)
index 0000000..635c338
--- /dev/null
@@ -0,0 +1 @@
+This is an example proxy.pac file which can be used as the proxy configuration by URL
diff --git a/proxy/proxy.pac b/proxy/proxy.pac
new file mode 100644 (file)
index 0000000..1f4310f
--- /dev/null
@@ -0,0 +1,40 @@
+// file syntax is javascript
+
+// this is the return value if we do not use the proxy
+var direct = "DIRECT";
+// this is the return value if we use the proxy. 
+// this returns multiple proxyies
+var proxy = "PROXY 10.0.1.12:80; PROXY 10.0.1.10:80; PROXY 10.0.1.11:80";
+
+function FindProxyForURL(url, host) {
+
+       var lhost = host.toLowerCase();
+       var resolved_ip = dnsResolve(host);
+       host = lhost;
+
+       var lurl = url.toLowerCase();
+       url = lurl;
+
+       if(isPlainHostName(host)) {
+               return direct;
+       }
+
+       // local networks do not use a proxy
+       if(
+               (isInNet(resolved_ip, "10.0.0.0", "255.0.0.0")) || 
+               (isInNet(resolved_ip, "192.168.0.0", "255.255.0.0")) ||
+               (isInNet(resolved_ip, "127.0.0.1", "255.255.255.255"))
+       ) { 
+               return direct; 
+       }
+
+       // the local network uses some special tlds
+       if(     
+               (host == "some.special.tld") ||
+           (host == "some.special.interne.tld") 
+       ) { 
+               return direct;
+       }
+
+       return proxy;
+}