Skip to content

Commit

Permalink
feat: 支持解析 QX VLESS 输入; VLESS 无 network 时, 默认为 tcp
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Jan 17, 2024
1 parent 7fd585b commit 63887e3
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Core functionalities:
- [x] SSD URI
- [x] V2RayN URI
- [x] Hysteria2 URI
- [x] QX (SS, SSR, VMess, Trojan, HTTP, SOCKS5)
- [x] QX (SS, SSR, VMess, Trojan, HTTP, SOCKS5, VLESS)
- [x] Loon (SS, SSR, VMess, Trojan, HTTP, SOCKS5, WireGuard, VLESS, Hysteria2)
- [x] Surge (SS, VMess, Trojan, HTTP, SOCKS5, TUIC, Snell, Hysteria2, SSR(external, only for macOS), WireGuard(Surge to Surge))
- [x] Surfboard (SS, VMess, Trojan, HTTP, SOCKS5, WireGuard(Surfboard to Surfboard))
Expand Down
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.14.172",
"version": "2.14.173",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js",
"scripts": {
Expand Down
5 changes: 5 additions & 0 deletions backend/src/core/proxy-utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ function lastParse(proxy) {
delete proxy.network;
}
}
if (['vless'].includes(proxy.type)) {
if (!proxy.network) {
proxy.network = 'tcp';
}
}
if (['trojan', 'tuic', 'hysteria', 'hysteria2'].includes(proxy.type)) {
proxy.tls = true;
}
Expand Down
10 changes: 10 additions & 0 deletions backend/src/core/proxy-utils/parsers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,15 @@ function QX_VMess() {
return { name, test, parse };
}

function QX_VLESS() {
const name = 'QX VLESS Parser';
const test = (line) => {
return /^vless\s*=/.test(line.split(',')[0].trim());
};
const parse = (line) => getQXParser().parse(line);
return { name, test, parse };
}

function QX_Trojan() {
const name = 'QX Trojan Parser';
const test = (line) => {
Expand Down Expand Up @@ -1017,6 +1026,7 @@ export default [
QX_SS(),
QX_SSR(),
QX_VMess(),
QX_VLESS(),
QX_Trojan(),
QX_Http(),
QX_Socks5(),
Expand Down
9 changes: 8 additions & 1 deletion backend/src/core/proxy-utils/parsers/peggy/qx.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const grammars = String.raw`
}
}
start = (trojan/shadowsocks/vmess/http/socks5) {
start = (trojan/shadowsocks/vmess/vless/http/socks5) {
return proxy
}
Expand Down Expand Up @@ -91,6 +91,13 @@ vmess = "vmess" equals address
handleObfs();
}
vless = "vless" equals address
(uuid/method/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/obfs/obfs_host/obfs_uri/udp_relay/udp_over_tcp/fast_open/aead/server_check_url/others)* {
proxy.type = "vless";
proxy.cipher = proxy.cipher || "none";
handleObfs();
}
http = "http" equals address
(username/password/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/fast_open/udp_relay/udp_over_tcp/server_check_url/others)*{
proxy.type = "http";
Expand Down
9 changes: 8 additions & 1 deletion backend/src/core/proxy-utils/parsers/peggy/qx.peg
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
}
}

start = (trojan/shadowsocks/vmess/http/socks5) {
start = (trojan/shadowsocks/vmess/vless/http/socks5) {
return proxy
}

Expand Down Expand Up @@ -89,6 +89,13 @@ vmess = "vmess" equals address
handleObfs();
}

vless = "vless" equals address
(uuid/method/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/obfs/obfs_host/obfs_uri/udp_relay/udp_over_tcp/fast_open/aead/server_check_url/others)* {
proxy.type = "vless";
proxy.cipher = proxy.cipher || "none";
handleObfs();
}

http = "http" equals address
(username/password/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/fast_open/udp_relay/udp_over_tcp/server_check_url/others)*{
proxy.type = "http";
Expand Down

0 comments on commit 63887e3

Please sign in to comment.