New proxy regexp
This commit is contained in:
parent
2f6e49bec0
commit
9cf2d765aa
1 changed files with 4 additions and 4 deletions
|
@ -93,13 +93,13 @@ proxifiedContainers = {
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
//Parses a proxy description string of the format type://host[:port] or type://username:password@host[:port] (port is optional)
|
// Parses a proxy description string of the format type://host[:port] or type://username:password@host[:port] (port is optional)
|
||||||
parseProxy(proxy_str, mozillaVpnData = null) {
|
parseProxy(proxy_str, mozillaVpnData = null) {
|
||||||
const proxyRegexp = /(?<type>(https?)|(socks4?)):\/\/(\b(?<username>\w+):(?<password>\w+)@)?(?<host>((?:\d{1,3}\.){3}\d{1,3}\b)|(\b([\w.-]+)(\.([\w.-]+))+))(:(?<port>\d+))?/;
|
const proxyRegexp = /(?<type>(https?)|(socks4?)):\/\/(\b(?<username>\w+):(?<password>\w+)@)?(?<host>((?:\d{1,3}\.){3}\d{1,3}\b)|(\b([\w.-]+)+))(:(?<port>\d+))?/;
|
||||||
if (proxyRegexp.test(proxy_str) !== true) {
|
const matches = proxyRegexp.exec(proxy_str);
|
||||||
|
if (!matches) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const matches = proxyRegexp.exec(proxy_str);
|
|
||||||
|
|
||||||
if (mozillaVpnData && mozillaVpnData.mozProxyEnabled === undefined) {
|
if (mozillaVpnData && mozillaVpnData.mozProxyEnabled === undefined) {
|
||||||
matches.groups.type = "direct";
|
matches.groups.type = "direct";
|
||||||
|
|
Loading…
Add table
Reference in a new issue