From 76302f9d5354bbffa8ed05c563163ebdb2a75164 Mon Sep 17 00:00:00 2001 From: xream Date: Wed, 21 Feb 2024 19:09:23 +0800 Subject: [PATCH] fix: sing-box wireguard reserved --- backend/package.json | 2 +- backend/src/core/proxy-utils/producers/sing-box.js | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/backend/package.json b/backend/package.json index 9e5b36c9d..3514fbfad 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.225", + "version": "2.14.226", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/core/proxy-utils/producers/sing-box.js b/backend/src/core/proxy-utils/producers/sing-box.js index c19fd5e98..367b6e1ce 100644 --- a/backend/src/core/proxy-utils/producers/sing-box.js +++ b/backend/src/core/proxy-utils/producers/sing-box.js @@ -613,8 +613,10 @@ const wireguardParser = (proxy = {}) => { if (proxy['fast-open']) parsedProxy.udp_fragment = true; if (typeof proxy.reserved === 'string') { parsedProxy.reserved.push(proxy.reserved); - } else { + } else if (Array.isArray(proxy.reserved)) { for (const r of proxy.reserved) parsedProxy.reserved.push(r); + } else { + delete parsedProxy.reserved; } if (proxy.peers && proxy.peers.length > 0) { parsedProxy.peers = []; @@ -628,8 +630,10 @@ const wireguardParser = (proxy = {}) => { }; if (typeof p.reserved === 'string') { peer.reserved.push(p.reserved); - } else { + } else if (Array.isArray(p.reserved)) { for (const r of p.reserved) peer.reserved.push(r); + } else { + delete peer.reserved; } if (p['pre-shared-key']) peer.pre_shared_key = p['pre-shared-key']; parsedProxy.peers.push(peer);