diff --git a/backend/package.json b/backend/package.json index 94a212247..7161e6f1e 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.281", + "version": "2.14.282", "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 33e394422..c4b453800 100644 --- a/backend/src/core/proxy-utils/parsers/index.js +++ b/backend/src/core/proxy-utils/parsers/index.js @@ -751,6 +751,9 @@ function Clash_All() { if (proxy.fingerprint) { proxy['tls-fingerprint'] = proxy.fingerprint; } + if (proxy['dialer-proxy']) { + proxy['underlying-proxy'] = proxy['dialer-proxy']; + } if (proxy['benchmark-url']) { proxy['test-url'] = proxy['benchmark-url']; diff --git a/backend/src/core/proxy-utils/producers/clash.js b/backend/src/core/proxy-utils/producers/clash.js index 9ae53c62d..800532c70 100644 --- a/backend/src/core/proxy-utils/producers/clash.js +++ b/backend/src/core/proxy-utils/producers/clash.js @@ -144,6 +144,12 @@ export default function Clash_Producer() { proxy.fingerprint = proxy['tls-fingerprint']; } delete proxy['tls-fingerprint']; + + if (proxy['underlying-proxy']) { + proxy['dialer-proxy'] = proxy['underlying-proxy']; + } + delete proxy['underlying-proxy']; + if (isPresent(proxy, 'tls') && typeof proxy.tls !== 'boolean') { delete proxy.tls; } diff --git a/backend/src/core/proxy-utils/producers/clashmeta.js b/backend/src/core/proxy-utils/producers/clashmeta.js index 37a279dc2..54680cb6d 100644 --- a/backend/src/core/proxy-utils/producers/clashmeta.js +++ b/backend/src/core/proxy-utils/producers/clashmeta.js @@ -160,6 +160,12 @@ export default function ClashMeta_Producer() { proxy.fingerprint = proxy['tls-fingerprint']; } delete proxy['tls-fingerprint']; + + if (proxy['underlying-proxy']) { + proxy['dialer-proxy'] = proxy['underlying-proxy']; + } + delete proxy['underlying-proxy']; + if (isPresent(proxy, 'tls') && typeof proxy.tls !== 'boolean') { delete proxy.tls; } diff --git a/backend/src/core/proxy-utils/producers/shadowrocket.js b/backend/src/core/proxy-utils/producers/shadowrocket.js index 5663585b4..6f4709398 100644 --- a/backend/src/core/proxy-utils/producers/shadowrocket.js +++ b/backend/src/core/proxy-utils/producers/shadowrocket.js @@ -163,6 +163,12 @@ export default function ShadowRocket_Producer() { proxy.fingerprint = proxy['tls-fingerprint']; } delete proxy['tls-fingerprint']; + + if (proxy['underlying-proxy']) { + proxy['dialer-proxy'] = proxy['underlying-proxy']; + } + delete proxy['underlying-proxy']; + if (isPresent(proxy, 'tls') && typeof proxy.tls !== 'boolean') { delete proxy.tls; } diff --git a/backend/src/core/proxy-utils/producers/sing-box.js b/backend/src/core/proxy-utils/producers/sing-box.js index 34997c5de..f1c83d102 100644 --- a/backend/src/core/proxy-utils/producers/sing-box.js +++ b/backend/src/core/proxy-utils/producers/sing-box.js @@ -1,6 +1,9 @@ import ClashMeta_Producer from './clashmeta'; import $ from '@/core/app'; +const detourParser = (proxy, parsedProxy) => { + if (proxy['dialer-proxy']) parsedProxy.detour = proxy['dialer-proxy']; +}; const tfoParser = (proxy, parsedProxy) => { parsedProxy.tcp_fast_open = false; if (proxy.tfo) parsedProxy.tcp_fast_open = true; @@ -249,6 +252,7 @@ const sshParser = (proxy = {}) => { parsedProxy.host_key_algorithms = proxy['host-key-algorithms']; if (proxy['fast-open']) parsedProxy.udp_fragment = true; tfoParser(proxy, parsedProxy); + detourParser(proxy, parsedProxy); return parsedProxy; }; @@ -274,6 +278,7 @@ const httpParser = (proxy = {}) => { } if (proxy['fast-open']) parsedProxy.udp_fragment = true; tfoParser(proxy, parsedProxy); + detourParser(proxy, parsedProxy); tlsParser(proxy, parsedProxy); return parsedProxy; }; @@ -295,6 +300,7 @@ const socks5Parser = (proxy = {}) => { if (proxy['udp-over-tcp']) parsedProxy.udp_over_tcp = true; if (proxy['fast-open']) parsedProxy.udp_fragment = true; tfoParser(proxy, parsedProxy); + detourParser(proxy, parsedProxy); return parsedProxy; }; @@ -326,6 +332,7 @@ const shadowTLSParser = (proxy = {}) => { throw '端口值非法'; if (proxy['fast-open'] === true) stPart.udp_fragment = true; tfoParser(proxy, stPart); + detourParser(proxy, stPart); smuxParser(proxy.smux, ssPart); return { type: 'ss-with-st', ssPart, stPart }; }; @@ -344,6 +351,7 @@ const ssParser = (proxy = {}) => { if (proxy['udp-over-tcp']) parsedProxy.udp_over_tcp = true; if (proxy['fast-open']) parsedProxy.udp_fragment = true; tfoParser(proxy, parsedProxy); + detourParser(proxy, parsedProxy); smuxParser(proxy.smux, parsedProxy); if (proxy.plugin) { const optArr = []; @@ -421,6 +429,7 @@ const ssrParser = (proxy = {}) => { parsedProxy.protocol_param = proxy['protocol-param']; if (proxy['fast-open']) parsedProxy.udp_fragment = true; tfoParser(proxy, parsedProxy); + detourParser(proxy, parsedProxy); smuxParser(proxy.smux, parsedProxy); return parsedProxy; }; @@ -457,6 +466,7 @@ const vmessParser = (proxy = {}) => { if (proxy.network === 'grpc') grpcParser(proxy, parsedProxy); tfoParser(proxy, parsedProxy); + detourParser(proxy, parsedProxy); tlsParser(proxy, parsedProxy); smuxParser(proxy.smux, parsedProxy); return parsedProxy; @@ -479,6 +489,7 @@ const vlessParser = (proxy = {}) => { if (proxy.network === 'grpc') grpcParser(proxy, parsedProxy); tfoParser(proxy, parsedProxy); + detourParser(proxy, parsedProxy); smuxParser(proxy.smux, parsedProxy); tlsParser(proxy, parsedProxy); return parsedProxy; @@ -499,6 +510,7 @@ const trojanParser = (proxy = {}) => { if (proxy.network === 'ws') wsParser(proxy, parsedProxy); tfoParser(proxy, parsedProxy); + detourParser(proxy, parsedProxy); tlsParser(proxy, parsedProxy); smuxParser(proxy.smux, parsedProxy); return parsedProxy; @@ -545,6 +557,7 @@ const hysteriaParser = (proxy = {}) => { } } tlsParser(proxy, parsedProxy); + detourParser(proxy, parsedProxy); tfoParser(proxy, parsedProxy); smuxParser(proxy.smux, parsedProxy); return parsedProxy; @@ -569,6 +582,7 @@ const hysteria2Parser = (proxy = {}) => { if (!parsedProxy.obfs.type) delete parsedProxy.obfs; tlsParser(proxy, parsedProxy); tfoParser(proxy, parsedProxy); + detourParser(proxy, parsedProxy); smuxParser(proxy.smux, parsedProxy); return parsedProxy; }; @@ -597,6 +611,7 @@ const tuic5Parser = (proxy = {}) => { if (proxy['heartbeat-interval']) parsedProxy.heartbeat = `${proxy['heartbeat-interval']}ms`; tfoParser(proxy, parsedProxy); + detourParser(proxy, parsedProxy); tlsParser(proxy, parsedProxy); smuxParser(proxy.smux, parsedProxy); return parsedProxy; @@ -650,6 +665,7 @@ const wireguardParser = (proxy = {}) => { } } tfoParser(proxy, parsedProxy); + detourParser(proxy, parsedProxy); smuxParser(proxy.smux, parsedProxy); return parsedProxy; }; @@ -789,6 +805,7 @@ export default function singbox_Producer() { $.error(e.message ?? e); } }); + return type === 'internal' ? list : JSON.stringify({ outbounds: list }, null, 2); diff --git a/backend/src/core/proxy-utils/producers/stash.js b/backend/src/core/proxy-utils/producers/stash.js index c02093c6c..08d4bff17 100644 --- a/backend/src/core/proxy-utils/producers/stash.js +++ b/backend/src/core/proxy-utils/producers/stash.js @@ -242,6 +242,12 @@ export default function Stash_Producer() { proxy.fingerprint = proxy['tls-fingerprint']; } delete proxy['tls-fingerprint']; + + if (proxy['underlying-proxy']) { + proxy['dialer-proxy'] = proxy['underlying-proxy']; + } + delete proxy['underlying-proxy']; + if (isPresent(proxy, 'tls') && typeof proxy.tls !== 'boolean') { delete proxy.tls; }