Firefox中使用pac
https://campus.barracuda.com/product/websecurityservice/article/WSS/ConfigProxyWithPACFile/
https://findproxyforurl.com/pac-functions/
可以参考开源项目的pac设置
https://github.com/rptec/squid-PAC
function FindProxyForURL(url, host) { var suffix; var pos = host.lastIndexOf('.'); pos = host.lastIndexOf('.', pos - 1); while(1) { if (pos <= 0) { if (hasOwnProperty.call(domains, host)) { return proxy; } else { return direct; } } suffix = host.substring(pos + 1); if (hasOwnProperty.call(domains, suffix)) { return proxy; } pos = host.lastIndexOf('.', pos - 1); } }
str.lastIndexOf(searchValue[, fromIndex])
The hasOwnProperty()
method returns a boolean indicating whether the object has the specified property as own (not inherited) property.
obj.hasOwnProperty(prop)
关于这个函数的使用,还有一个引申的话题