标签: WPAD

  • PAC/WPAD

    http://findproxyforurl.com/wpad-introduction/

    https://code.google.com/p/pacparser/

    Note:

    IETF draft Spec expired at 1999

    Socks not supported officially

     

    Testing:

    pactester -p pad.dat  -f url.list

     

    cat pad.dat:

    function FindProxyForURL(url, host)  
    {
            if (isInNet(host, “172.16.0.0”, “255.240.0.0”)||
                isInNet(host, “192.168.0.0”, “255.255.0.0”)||
                isInNet(host, “10.0.0.0”,”255.0.0.0″)||
                isInNet(host, “127.0.0.0”,”255.0.0.0″)||
                dnsDomainIs(host, “clouddevice.zhenglei.net”)||
                dnsDomainIs(host, “blogdevice.zhenglei.net”)||
                dnsDomainIs(host, “pydiodevice.zhenglei.net”)||
                dnsDomainIs(host, “cloudhost.zhenglei.net”)||
                dnsDomainIs(host, “blogdhost.zhenglei.net”)||
                dnsDomainIs(host, “pydiohost.zhenglei.net”)
               )  
               { return “DIRECT”; }  
             
             if ( url.substring(0, 4)==”ftp:” )
               return “SOCKET 127.0.0.1: 4567”   
     
             if (isPlainHostName(host) ||
                shExpMatch(host, “*.local”)||
                dnsDomainIs(host, “.cn”)||
                dnsDomainIs(host, “www.taobao.com”)||
                dnsDomainIs(host, “www.jd.com”)||
                dnsDomainIs(host, “www.51buy.com”)||
                dnsDomainIs(host, “www.yixun.com”)||
                dnsDomainIs(host, “www.tmall.com”)||
                dnsDomainIs(host, “.gtime.com”)
               )
            return “PROXY 172.24.61.252: 8080”;
     
            return “SOCKET 127.0.0.1: 4567; PROXY 172.24.61.252: 8080”
    }

     

     cat  url.list

    http://clouddevice.zhenglei.net
    http://blogdevice.zhenglei.net
    http://pydiodevice.zhenglei.net
    http://cloudhost.zhenglei.net
    http://bloghost.zhenglei.net
    http://pydiohost.zhenglei.net
    http://blog.zhenglei.net
    http://www.sina.com.cn
    http://static.gtimg.com
    http://www.51buy.com
    http://www.jd.com
    http://www.taobao.com
    http://www.tmall.com