Skip to content

Commit

Permalink
fix: 修复 sing-box wireguard 输出
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Jan 15, 2024
1 parent 812f24d commit bdc7ee5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
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.166",
"version": "2.14.167",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js",
"scripts": {
Expand Down
8 changes: 6 additions & 2 deletions backend/src/core/proxy-utils/producers/sing-box.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,12 +537,16 @@ const tuic5Parser = (proxy = {}) => {
};

const wireguardParser = (proxy = {}) => {
const local_address = ['ip', 'ipv6']
.map((i) => proxy[i])
.filter((i) => i)
.map((i) => (/\\/.test(i) ? i : `${i}/32`));
const parsedProxy = {
tag: proxy.name,
type: 'wireguard',
server: proxy.server,
server_port: parseInt(`${proxy.port}`, 10),
local_address: [proxy.ip, proxy.ipv6],
local_address,
private_key: proxy['private-key'],
peer_public_key: proxy['public-key'],
pre_shared_key: proxy['pre-shared-key'],
Expand All @@ -563,7 +567,7 @@ const wireguardParser = (proxy = {}) => {
server: p.server,
server_port: parseInt(`${p.port}`, 10),
public_key: p['public-key'],
allowed_ips: p.allowed_ips,
allowed_ips: p['allowed-ips'] || p.allowed_ips,
reserved: [],
};
if (typeof p.reserved === 'string') {
Expand Down

0 comments on commit bdc7ee5

Please sign in to comment.