Answer the question
In order to leave comments, you need to log in
How to quickly switch proxy?
Can you tell me a software or extension for chromium-like ones that could easily change the proxy to the next one from the list I uploaded in a couple of clicks?
Everything that I found either with a bunch of prescribing paths to each server, or non-working extensions
Answer the question
In order to leave comments, you need to log in
Create a folder named Proxy , in it create 2 files.
The contents of the manifest.json file should be like this:
{
"name" : "Proxy",
"manifest_version" : 2,
"version" : "1.0",
"description" : "Болванка для создания расширения для смены прокси на лету",
"permissions" : [ "proxy", "webRequest", "webRequestBlocking", "<all_urls>" ],
"background" : { "persistent": true, "scripts": [ "background.js" ] }
}
// Функция для установки произвольного http-прокси:
function setProxy(address, port, login, password) {
if (typeof address == 'undefined' && typeof port == 'undefined') {
chrome.proxy.settings.clear(
{},
function() {
console.log('Настройки прокси успешно удалены');
}
);
}
else {
if (typeof login == 'undefined' && typeof password == 'undefined') {
window.auth = undefined;
}
else {
window.auth = Object.create(null);
window.auth['login'] = login;
window.auth['password'] = password;
}
chrome.proxy.settings.set(
{
value: {
mode: 'pac_script',
pacScript: {
data: 'function FindProxyForURL(url, host) { return "PROXY '+address+':'+port+'"; }'
}
},
scope: 'regular'
},
function() {
console.log('Прокси http://'+address+':'+port+' успешно установлен');
}
);
}
}
// Автоматиечский ввод логина и пароля, если прокси требует авторизации:
chrome.webRequest.onAuthRequired.addListener(
function(info, callback) {
if (info.isProxy && typeof window.auth !== 'undefined') {
callback({
authCredentials: {
username: window.auth['login'],
password: window.auth['password']
}
});
}
else {
callback();
}
},
{ urls: [ '<all_urls>' ] },
[ 'asyncBlocking' ]
);
// Обнуление настроек прокси сразу после установки расширения:
chrome.proxy.settings.clear({}, function() {});
setProxy('185.202.3.118', '65233', 'idle', 'dfgfgfgfdd');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question