feat: Added support for parsing Loon vless, Surge socks5 and snell proxies

This commit is contained in:
Peng-YM 2022-06-20 22:10:29 +08:00
parent d602dbeb7c
commit 409c4cbdd9
7 changed files with 39 additions and 10 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "sub-store", "name": "sub-store",
"version": "2.0.10", "version": "2.0.11",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js", "main": "src/main.js",
"scripts": { "scripts": {

View File

@ -49,6 +49,7 @@ function parse(raw) {
proxies.push(proxy); proxies.push(proxy);
lastParser = parser; lastParser = parser;
success = true; success = true;
$.info(`${parser.name} is activated`);
} }
} }
} }

View File

@ -385,6 +385,15 @@ function Loon_VMess() {
return { name, test, parse }; return { name, test, parse };
} }
function Loon_Vless() {
const name = 'Loon Vless Parser';
const test = (line) => {
return /^.*=\s*vless/i.test(line.split(',')[0]);
};
const parse = (line) => getLoonParser().parse(line);
return { name, test, parse };
}
function Loon_Trojan() { function Loon_Trojan() {
const name = 'Loon Trojan Parser'; const name = 'Loon Trojan Parser';
const test = (line) => { const test = (line) => {
@ -444,6 +453,24 @@ function Surge_Http() {
return { name, test, parse }; return { name, test, parse };
} }
function Surge_Socks5() {
const name = 'Surge Socks5 Parser';
const test = (line) => {
return /^.*=\s*socks5(-tls)?/.test(line.split(',')[0]);
};
const parse = (line) => getSurgeParser().parse(line);
return { name, test, parse };
}
function Surge_Snell() {
const name = 'Surge Snell Parser';
const test = (line) => {
return /^.*=\s*snell?/.test(line.split(',')[0]);
};
const parse = (line) => getSurgeParser().parse(line);
return { name, test, parse };
}
export default [ export default [
URI_SS(), URI_SS(),
URI_SSR(), URI_SSR(),
@ -454,9 +481,12 @@ export default [
Surge_VMess(), Surge_VMess(),
Surge_Trojan(), Surge_Trojan(),
Surge_Http(), Surge_Http(),
Surge_Snell(),
Surge_Socks5(),
Loon_SS(), Loon_SS(),
Loon_SSR(), Loon_SSR(),
Loon_VMess(), Loon_VMess(),
Loon_Vless(),
Loon_Trojan(), Loon_Trojan(),
Loon_Http(), Loon_Http(),
QX_SS(), QX_SS(),

View File

@ -181,7 +181,7 @@ function http(proxy) {
function socks5(proxy) { function socks5(proxy) {
const result = new Result(proxy); const result = new Result(proxy);
const type = proxy.tls ? 'socks5' : 'socks5-tls'; const type = proxy.tls ? 'socks5-tls' : 'socks5';
result.append(`${proxy.name}=${type},${proxy.server},${proxy.port}`); result.append(`${proxy.name}=${type},${proxy.server},${proxy.port}`);
result.appendIfPresent(`,${proxy.username}`, 'username'); result.appendIfPresent(`,${proxy.username}`, 'username');
result.appendIfPresent(`,${proxy.password}`, 'password'); result.appendIfPresent(`,${proxy.password}`, 'password');

View File

@ -77,8 +77,6 @@ export default function URI_Producer() {
proxy.port proxy.port
}#${encodeURIComponent(proxy.name)}`; }#${encodeURIComponent(proxy.name)}`;
break; break;
default:
throw new Error(`Cannot handle proxy type: ${proxy.type}`);
} }
return result; return result;
}; };

File diff suppressed because one or more lines are too long