Skip to content

Instantly share code, notes, and snippets.

@rsky
Last active November 9, 2020 21:47
Show Gist options
  • Save rsky/c579d6e07da1d25bdc606ca48ba982dd to your computer and use it in GitHub Desktop.
Save rsky/c579d6e07da1d25bdc606ca48ba982dd to your computer and use it in GitHub Desktop.
Tiny Proxy Configurator
{
"name": "Tiny Proxy Configurator",
"version": "1.0",
"description": "A tiny and simple proxy configurator.",
"permissions": [
"proxy"
],
"background": {
"scripts": [
"pac.js"
],
"persistent": false
},
"manifest_version": 2
}
const url = chrome.extension.getURL('proxy.pac')
chrome.proxy.settings.set(
{
value: {
mode: 'pac_script',
pacScript: {
url,
//mandatory: true,
},
},
scope: 'regular',
},
() => {}
)
function FindProxyForURL(url, host) {
if ( isInNet(host, "203.104.209.71","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "203.104.209.87","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "125.6.184.215","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "203.104.209.183","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "203.104.209.150","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "203.104.209.134","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "203.104.209.167","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "203.104.248.135","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "125.6.189.7","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "125.6.189.39","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "125.6.189.71","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "125.6.189.103","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "125.6.189.135","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "125.6.189.167","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "125.6.189.215","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "125.6.189.247","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "203.104.209.23","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "203.104.209.39","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "203.104.209.55","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
if ( isInNet(host, "203.104.209.102","255.255.255.255") ) {
return "PROXY 127.0.0.1:8989";
}
return "DIRECT";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment