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
3 changed files with 5 additions and 3 deletions

View File

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

View File

@@ -285,7 +285,8 @@ function wireguard(proxy) {
proxy.ipv6 = proxy.peers[0].ipv6;
proxy['public-key'] = proxy.peers[0]['public-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;
}
const result = new Result(proxy);