PAC script (was: Banking Transactions through Squid using IPCHAINS)

From: Tilman Schmidt <Tilman.Schmidt@dont-contact.us>
Date: Fri, 11 Feb 2000 10:27:46 +0100

At 23:34 10.02.00 +0100, Lars Holmström wrote:
>Is a copy of a PAC script available ?

PAC scripts are very dependent on the specific network environment,
but here's mine; feel free to take what you can use from it. This
is for a network where direct access to the Internet is blocked by
the firewall, therefore there's no fallback ";DIRECT" clause in the
"PROXY ..." return value. It has been in use for about half a year
now for both Netscape and MSIE clients without any complaints. YMMV.

----------8<----------8<----------8<----------8<----------8<----------
function FindProxyForURL(url, host)
{
// If the client is not on one of the local networks (such as a roaming
// client), do not use the proxy server.
// local networks are mostly in 192.168.* but also some historical ones
if (!isInNet(myIpAddress(), "192.168.0.0", "255.255.0.0") &&
    !isInNet(myIpAddress(), "200.1.1.0", "255.255.255.0") &&
    !isInNet(myIpAddress(), "200.1.2.0", "255.255.255.0") &&
    !isInNet(myIpAddress(), "2.14.2.0", "255.255.255.0"))
        return "DIRECT";

// Clients in ZVK LAN need proxy for regular in-house LAN. They cannot
// resolve almost anything properly, so avoid isInNet(host, ...) entirely.
if (isInNet(myIpAddress(), "192.168.69.0", "255.255.255.0"))
{
        if (shExpMatch(host, "127.0.0.*") ||
            shExpMatch(host, "192.168.69.*"))
                return "DIRECT";

        return "PROXY igate.sema.de:3128";
}

// Go direct for hosts on local LAN and for "localhost" (used by many
// applications relying on a browser for their user interface).
// - Hosts specified by name are only checked if the domain part is local
// or absent, because isInNet() freezes Netscape during DNS lookups
// and external lookups tend to take so much time that users will
// complain about the frozen browser.
if ((isPlainHostName(host) || dnsDomainIs(host, ".sema.de"))
    && (isInNet(host, "127.0.0.0", "255.0.0.0") ||
        isInNet(host, "192.168.70.0", "255.255.254.0")))
        return "DIRECT";

// - Hosts specified by numeric address are easy.
if (shExpMatch(host, "127.0.0.*") ||
    shExpMatch(host, "192.168.70.*") ||
    shExpMatch(host, "192.168.71.*"))
        return "DIRECT";

// everything else goes through proxy
return "PROXY igate.sema.de:3128";
}
---------->8---------->8---------->8---------->8---------->8----------

-- 
Tilman Schmidt          E-Mail: Tilman.Schmidt@sema.de (office)
Sema Group Koeln, Germany       tilman@schmidt.bn.uunet.de (private)
Received on Fri Feb 11 2000 - 02:42:16 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:51:11 MST