From 382d22e6226592bb6748a6c3e040952c81c48596 Mon Sep 17 00:00:00 2001 From: xream Date: Mon, 16 Dec 2024 21:06:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20`socks5`,=20`socks?= =?UTF-8?q?5+tls`,=20`http`,=20`https`(=E4=BE=BF=E4=BA=8E=E8=BE=93?= =?UTF-8?q?=E5=85=A5)=20=E6=A0=BC=E5=BC=8F=E8=BE=93=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++ backend/package.json | 2 +- backend/src/core/proxy-utils/parsers/index.js | 37 +++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1f1115d..7b043a8 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,10 @@ Core functionalities: > ⚠️ Do not use `Shadowrocket` to export URI and then import it as input. It is not a standard URI. +- [x] Normal Proxy(`socks5`, `socks5+tls`, `http`, `https`(it's ok)) + + example: `socks5+tls://user:pass@ip:port#name` + - [x] URI(SS, SSR, VMess, VLESS, Trojan, Hysteria, Hysteria 2, TUIC v5, WireGuard) - [x] Clash Proxies YAML - [x] Clash Proxy JSON(single line) diff --git a/backend/package.json b/backend/package.json index 16f418a..3163951 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.443", + "version": "2.14.444", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/core/proxy-utils/parsers/index.js b/backend/src/core/proxy-utils/parsers/index.js index b049320..545e89b 100644 --- a/backend/src/core/proxy-utils/parsers/index.js +++ b/backend/src/core/proxy-utils/parsers/index.js @@ -27,6 +27,42 @@ function surge_port_hopping(raw) { }; } +function URI_PROXY() { + // socks5+tls + // socks5 + // http, https(可以这么写) + const name = 'URI PROXY Parser'; + const test = (line) => { + return /^(socks5\+tls|socks5|http|https):\/\//.test(line); + }; + const parse = (line) => { + // parse url + // eslint-disable-next-line no-unused-vars + let [__, type, tls, username, password, server, port, query, name] = + line.match( + /^(socks5|http|http)(\+tls|s)?:\/\/(?:(.*?):(.*?)@)?(.*?):(\d+?)(\?.*?)?(?:#(.*?))?$/, + ); + + const proxy = { + name: + name != null + ? decodeURIComponent(name) + : `${type} ${server}:${port}`, + type, + tls: tls ? true : false, + server, + port, + username: + username != null ? decodeURIComponent(username) : undefined, + password: + password != null ? decodeURIComponent(password) : undefined, + }; + + return proxy; + }; + return { name, test, parse }; +} + // Parse SS URI format (only supports new SIP002, legacy format is depreciated). // reference: https://github.com/shadowsocks/shadowsocks-org/wiki/SIP002-URI-Scheme function URI_SS() { @@ -1392,6 +1428,7 @@ function isIP(ip) { } export default [ + URI_PROXY(), URI_SS(), URI_SSR(), URI_VMess(),