gpt4 book ai didi

google-chrome - Chrome 扩展 - 以编程方式绕过代理

转载 作者:行者123 更新时间:2023-12-05 07:45:47 31 4
gpt4 key购买 nike

我正在使用 chrome 扩展代理 api(chrome.proxy.settings) 通过我的扩展设置代理。一切正常,我的代理服务器上的所有流量当然都在 bypass list 中除外。

现在我的问题是:我们如何动态绕过代理集? 我的意思是有没有办法以编程方式绕过某些 URL(不在代理绕过列表中)的代理?我了解包含 url/模式的绕过列表被绕过。但是我需要一些 url 来绕过代理。

有人遇到过类似的需求吗?任何直接动态绕过相同方法或任何变通方法都将不胜感激。

最佳答案

随时随地绕过代理?您可以从您的 Web 服务器中提取任何指定的地址。有什么问题吗?

例如:

chrome.windows.onCreated.addListener(function() {
var config = {
mode: 'fixed_servers',
rules: {
proxyForHttp: {
scheme: 'http',
host: '127.0.0.1',
port: '80'
},
bypassList: []
}
},
proxyByUrl = 'path/to/proxiesByUrl?path=' + window.location.href;

$.get(proxyByUrl, function(data) {
// Set up current proxy, dependent on request URL
config.rules.proxyForHttp.host = data.proxyAddress;
config.rules.proxyForHttp.port = data.proxyport;
// Excluded URL's for this proxy
bypassList.push(data.bypassUrls);
});
});

匹配所有符合模式的主机名。领先的“。”被解释为“*.”。示例:“foobar.com”、“foobar.com”、“.foobar.com”、“foobar.com:99”、“https://x ..y .com:99".

有关 bypassList 的更多详细模式,read the official documentation .

关于google-chrome - Chrome 扩展 - 以编程方式绕过代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41332421/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com