feat: Wireguard 结构跟进 Clash.Meta, allowed_ips 改为 allowed-ips

This commit is contained in:
xream 2024-01-02 16:38:19 +08:00
parent c0ab301160
commit de1d40f41a
No known key found for this signature in database
GPG Key ID: 1D2C5225471789F9
3 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "sub-store", "name": "sub-store",
"version": "2.14.136", "version": "2.14.137",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js", "main": "src/main.js",
"scripts": { "scripts": {

View File

@ -742,6 +742,7 @@ function Loon_WireGuard() {
let publicKey = peers.match( let publicKey = peers.match(
/(,|^)\s*?public-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i, /(,|^)\s*?public-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i,
)?.[2]; )?.[2];
// https://github.com/MetaCubeX/mihomo/blob/0404e35be8736b695eae018a08debb175c1f96e6/docs/config.yaml#L717
const proxy = { const proxy = {
type: 'wireguard', type: 'wireguard',
name, name,
@ -768,7 +769,7 @@ function Loon_WireGuard() {
ipv6, ipv6,
'public-key': publicKey, 'public-key': publicKey,
'pre-shared-key': preSharedKey, 'pre-shared-key': preSharedKey,
allowed_ips: allowedIps, 'allowed-ips': allowedIps,
reserved, reserved,
}, },
], ],

View File

@ -285,7 +285,8 @@ function wireguard(proxy) {
proxy.ipv6 = proxy.peers[0].ipv6; proxy.ipv6 = proxy.peers[0].ipv6;
proxy['public-key'] = proxy.peers[0]['public-key']; proxy['public-key'] = proxy.peers[0]['public-key'];
proxy['preshared-key'] = proxy.peers[0]['pre-shared-key']; proxy['preshared-key'] = proxy.peers[0]['pre-shared-key'];
proxy['allowed-ips'] = proxy.peers[0]['allowed_ips']; // https://github.com/MetaCubeX/mihomo/blob/0404e35be8736b695eae018a08debb175c1f96e6/docs/config.yaml#L717
proxy['allowed-ips'] = proxy.peers[0]['allowed-ips'];
proxy.reserved = proxy.peers[0].reserved; proxy.reserved = proxy.peers[0].reserved;
} }
const result = new Result(proxy); const result = new Result(proxy);