Proxy Auto Config for Firefox (PAC) @ Calomel.org - Open Source Research and Reference - 0 views
-
Agripino Petit Miguel on 16 Feb 11Dado que myIpAddress(), en linux, siempre devuelve 127.0.0.1, la forma que se me ha ocurrido de detectar que estoy en la red del trabajo es emplear isResolvable() con el nombre del proxy: function FindProxyForURL(url, host) {// variable strings to returnvar proxy_yes = "PROXY proxy.germinus.com:8080";var proxy_no = "DIRECT"; // alert("Local IP address is: " + myIpAddress()); // Proxy if PC is on local LAN if (isResolvable("proxy.germinus.com")) {// if (isInNet(myIpAddress(), "192.168.4.0", "255.255.248.0")) { // OJO!!! myIpAddress() siempre devuelve 127.0.0.1 en Linux // localhost;127.0.0.0/8;*.local;*.lab.germinus.com;172.16.0.0/16;192.168.*;*.local.*;www.grupogesfor.com;www.gesfor.es;cmmijira.gesfor.es if ((host == "localhost") || (shExpMatch(host, "localhost.*")) || (host == "127.0.0.1")) { return proxy_no; } if (shExpMatch(url, "http://*.lab.germinus.com")) { return proxy_no; } if (isInNet(host, "172.16.0.0", "255.255.255.0")) { return proxy_no; } if (isInNet(host, "192.168.0.0", "255.255.248.0")) { return proxy_no; } if (shExpMatch(url, "http://cmmijira.gesfor.es*")) { return proxy_no; } return proxy_yes; } else { return proxy_no; }}