-
-
Save chenshaoju/52c7555acc65ec98423f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isMatchProxy(url, pattern) { | |
try { | |
return new RegExp(pattern.replace('.', '\\.')).test(url); | |
} catch (e) { | |
return false; | |
} | |
} | |
function FindProxyForURL(url, host) { | |
var Proxy = 'PROXY 127.0.0.1:10800'; | |
var list = [ | |
'google.com', | |
'googledrive.com', | |
'google-analytics.com', | |
'ytimg.com', | |
'googleapis.com', | |
'googleusercontent.com', | |
'gstatic.com', | |
'virustotal.com', | |
'maniaplanet.com', | |
'whatsmyuseragent.com' | |
]; | |
for(var i=0, l=list.length; i<l; i++) { | |
if (isMatchProxy(url, list[i])) { | |
return Proxy; | |
} | |
} | |
return 'DIRECT'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment