首页 > 网络通讯 > PAC文件编辑方法

example,增加一个*google.com

  ".google.com",
  "||google.com",

也可以直接参考别的在线pac进行编写
将pac文件替换为如下代码

var proxy = "PROXY 127.0.0.1:1080;";

var domains = {
  "google.com": 1,
  "ipip.net": 1,
  "namechep.com": 1
};

var direct = 'DIRECT;';

var hasOwnProperty = Object.hasOwnProperty;

function FindProxyForURL(url, host) {
    if (host == "www.so.com") {
        return "PROXY 360.itzmx.com:80";
    }

    var suffix;
    var pos = host.lastIndexOf('.');
    while(1) {
        suffix = host.substring(pos + 1);
        if (suffix == "360.cn")
            if (url.indexOf('http://') == 0)
                return "PROXY 360.itzmx.com:80";
        if (hasOwnProperty.call(domains, suffix)) {
            return proxy;
        }
        if (pos <= 0) {
            break;
        }
        pos = host.lastIndexOf('.', pos - 1);
    }
    return direct;
}

可以看出,我添加了namechep、ipip、google的网址,更新pac后你可以访问ipip.net查看是否生效

标签: pac

添加新评论