2012年12月28日星期五

hola windows客户端的PAC文件

var hosts = {};
    hosts['pactest.client.hola.org'] = pactest_cb;
    function pactest_cb(url, host)
    {
        if (url.match(/.*\/client_cgi\/\?localpac=1(&stamp=873398280)?$/))
        return 'PROXY client.hola.org';
        return 'DIRECT';
    }
    hosts['bbc.co.uk'] = bbc_cb;
hosts['bbcfmhds.vo.llnwd.net'] = bbc_cb;
function bbc_cb(url, host)
{
var index = url.indexOf('?');
        if (index==-1)
            index = url.length;
        var ext = url.substr(index-5, 5),
            ext_index = ext.lastIndexOf('.');
        if (ext_index>=0)
        ext = ext.substr(ext_index+1);
        else
        ext = '';
        if (ext!='' && ext.match(/^(gif|png|jpg|mp3|js|css|mp4|flv|svf|json)$/))
        return DIRECT;
        var direct = [/^sa.bbc.co.uk$/];
        for (var i=0; i<direct.length; i++)
        {
        if (host.match(direct[i]))
            return 'DIRECT';
        }
return 'PROXY 127.0.0.1:6857; DIRECT';
}

hosts['facebook.com'] = facebook_cb;
hosts['facebook.net'] = facebook_cb;
hosts['fbcdn.com'] = facebook_cb;
hosts['fbcdn.net'] = facebook_cb;
hosts['fbstatic-a.akamaihd.net'] = facebook_cb;
hosts['fbcdn-dragon-a.akamaihd.net'] = facebook_cb;
function facebook_cb(url, host)
{
return 'PROXY 127.0.0.1:6857; DIRECT';
}

hosts['google.com'] = gmail_cb;
hosts['gstatic.com'] = gmail_cb;
hosts['googleusercontent.com'] = gmail_cb;
function gmail_cb(url, host)
{
return 'PROXY 127.0.0.1:6857; DIRECT';
}

hosts['google.com'] = google_cb;
hosts['gstatic.com'] = google_cb;
hosts['googleusercontent.com'] = google_cb;
function google_cb(url, host)
{
return 'PROXY 127.0.0.1:6857; DIRECT';
}

hosts['hulu.com'] = hulu_cb;
function hulu_cb(url, host)
{
var index = url.indexOf('?');
        if (index==-1)
            index = url.length;
        var ext = url.substr(index-5, 5),
            ext_index = ext.lastIndexOf('.');
        if (ext_index>=0)
        ext = ext.substr(ext_index+1);
        else
        ext = '';
        if (ext!='' && ext.match(/^(gif|png|jpg|mp3|js|css|mp4|flv|svf|json)$/))
        return DIRECT;
        var direct = [/^.*urlcheck.hulu.com$/, /^.*r.hulu.com$/, /^.*p.hulu.com$/, /^.*assets.hulu.com$/, /^.*ll.a.hulu.com$/, /^.*ads.hulu.com$/];
        for (var i=0; i<direct.length; i++)
        {
        if (host.match(direct[i]))
            return 'DIRECT';
        }
return 'PROXY 127.0.0.1:6857; DIRECT';
}

hosts['itv.com'] = itv_cb;
function itv_cb(url, host)
{
var index = url.indexOf('?');
        if (index==-1)
            index = url.length;
        var ext = url.substr(index-5, 5),
            ext_index = ext.lastIndexOf('.');
        if (ext_index>=0)
        ext = ext.substr(ext_index+1);
        else
        ext = '';
        if (ext!='' && ext.match(/^(gif|png|jpg|mp3|js|css|mp4|flv|svf|json)$/))
        return DIRECT;
        return 'PROXY 127.0.0.1:6857; DIRECT';
}

hosts['netflix.com'] = netflix_cb;
function netflix_cb(url, host)
{
var index = url.indexOf('?');
        if (index==-1)
            index = url.length;
        var ext = url.substr(index-5, 5),
            ext_index = ext.lastIndexOf('.');
        if (ext_index>=0)
        ext = ext.substr(ext_index+1);
        else
        ext = '';
        if (ext!='' && ext.match(/^(gif|png|jpg|mp3|js|css|mp4|flv|svf|json)$/))
        return DIRECT;
        var direct = [/^.*contactus.netflix.com$/, /^.*blog.netflix.com$/, /^.*nordicsblog.netflix.com$/];
        for (var i=0; i<direct.length; i++)
        {
        if (host.match(direct[i]))
            return 'DIRECT';
        }
return 'PROXY 127.0.0.1:6857; DIRECT';
}

hosts['pandora.com'] = pandora_cb;
function pandora_cb(url, host)
{
var index = url.indexOf('?');
        if (index==-1)
            index = url.length;
        var ext = url.substr(index-5, 5),
            ext_index = ext.lastIndexOf('.');
        if (ext_index>=0)
        ext = ext.substr(ext_index+1);
        else
        ext = '';
        if (ext!='' && ext.match(/^(gif|png|jpg|mp3|js|css|mp4|flv|svf|json)$/))
        return DIRECT;
        var direct = [/^.*stats.pandora.com$/, /^.*blog.pandora.com$/, /^audio.*.pandora.com$/, /^const.*.pandora.com$/];
        for (var i=0; i<direct.length; i++)
        {
        if (host.match(direct[i]))
            return 'DIRECT';
        }
return 'PROXY 127.0.0.1:6857; DIRECT';
}

hosts['twitter.com'] = twitter_cb;
hosts['twimg.com'] = twitter_cb;
hosts['twimg0-a.akamaihd.net'] = twitter_cb;
function twitter_cb(url, host)
{
return 'PROXY 127.0.0.1:6857; DIRECT';
}


    function FindProxyForURL(url, host)
    {
        var index = -1;
        while (true)
        {
        var func = hosts[host.substr(index+1)];
        if (func)
            return func(url, host);
        if ((index = host.indexOf('.', index+1))==-1)
            break;
        }
        return 'DIRECT';
    }
   

没有评论:

发表评论

WorldTimeServer Clock

New York

搜索此博客