Proxy.pac debug
Zur Navigation springen
Zur Suche springen
function FindProxyForURL(url, host)
{
var worf="10.80.0.2"
var nagus="10.80.0.3"
var myip=myIpAddress()
var ipbits=myip.split(".")
var myseg=parseInt(ipbits[3])
debugPAC ="PAC Debug Information\n";
debugPAC +="-----------------------------------\n";
debugPAC +="Machine IP: " + myIpAddress() + "\n";
debugPAC +="Hostname: " + host + "\n";
if (isResolvable(host)) {resolvableHost = "True"} else {resolvableHost = "False"};
debugPAC +="Host Resolvable: " + resolvableHost + "\n";
debugPAC +="Hostname IP: " + dnsResolve(host) + "\n";
if (isPlainHostName(host)) {plainHost = "True"} else {plainHost = "False"};
debugPAC +="Plain Hostname: " + plainHost + "\n";
debugPAC +="Domain Levels: " + dnsDomainLevels(host) + "\n";
debugPAC +="URL: " + url + "\n";
// Protocol can only be determined by reading the entire URL.
if (url.substring(0,5)=="http:") {protocol="HTTP";} else
if (url.substring(0,6)=="https:") {protocol="HTTPS";} else
if (url.substring(0,4)=="ftp:") {protocol="FTP";}
else {protocol="Unknown";}
debugPAC +="Protocol: " + protocol + "\n";
// Reduce volume of alerts to a useable level, e.g. only alert on static text pages.
if (!shExpMatch(url,"*.(js|xml|ico|gif|png|jpg|jpeg|css|swf)*")) {alert(debugPAC);}
if(myseg==Math.floor(myseg/2)*2)
{
var proxone=worf
var proxtwo=nagus
}
else
{
var proxone=nagus
var proxtwo=worf
}
if (isPlainHostName(host) || dnsDomainIs(host, ".xinux.lan")) {
return "DIRECT";
}
if (isInNet(host, "10.0.0.0", "255.0.0.0.0")) {
return "DIRECT";
}
if (isInNet(host, "192.168.0.0", "255.255.0.0")) {
return "DIRECT";
}
if (isInNet(host, "172.16.0.0", "255.240.0.0")) {
return "DIRECT";
}
return "PROXY "+proxone+":3128" ;
}