// vim: syntax=javascript

//
// Sample proxy.pac file
//

function FindProxyForURL(url, host) 
{ 

    if (shExpMatch( host, "blah.example.com" )
    ||  shExpMatch( host, "blah2.example.com" )) {
	return "PROXY myproxy.example.com:8080"; 
    }

    if (shExpMatch( host, "blah3.example.com" )
    ||  shExpMatch( host, "blah4.example.com" )) {
	return "DIRECT";
    }

    if (shExpMatch( host, "*.example.org" )
    ||  shExpMatch( host, "192.168.1.*" )) {
	return "PROXY myproxy2.example.com:8080; PROXY 192.168.1.1:8080; DIRECT;"; 
    }

    // isPlainHostName() and dnsDomainIs() may cause DNS lookups - i'm not sure
    if (shExpMatch( host, "10.*" )
    ||  shExpMatch( host, "127.*" )
    ||  shExpMatch( host, "localhost" )
    ||  isPlainHostName( host )
    ||  dnsDomainIs( host, ".example.com" )) {
	return "DIRECT"; 
    }

    // this causes a DNS lookup and so is not recommended
    if (isInNet(host, "10.0.0.0", "255.255.0.0")) {
	return "DIRECT"; 
    }

    return "PROXY myproxy.example.com:8080";
}
