feat: Loon WireGuard

This commit is contained in:
xream
2023-08-26 03:43:07 +08:00
parent 4973454f58
commit 8c5dca71fb
6 changed files with 121 additions and 4 deletions

View File

@@ -58,6 +58,9 @@ export default function Clash_Producer() {
proxy.keepalive =
proxy.keepalive ?? proxy['persistent-keepalive'];
proxy['persistent-keepalive'] = proxy.keepalive;
proxy['preshared-key'] =
proxy['preshared-key'] ?? proxy['pre-shared-key'];
proxy['pre-shared-key'] = proxy['preshared-key'];
}
if (

View File

@@ -282,7 +282,7 @@ function wireguard(proxy) {
proxy.ip = proxy.peers[0].ip;
proxy.ipv6 = proxy.peers[0].ipv6;
proxy['public-key'] = proxy.peers[0]['public-key'];
proxy['pre-shared-key'] = proxy.peers[0]['pre-shared-key'];
proxy['preshared-key'] = proxy.peers[0]['pre-shared-key'];
proxy['allowed-ips'] = proxy.peers[0]['allowed_ips'];
proxy.reserved = proxy.peers[0].reserved;
}
@@ -320,13 +320,13 @@ function wireguard(proxy) {
if (reserved) {
reserved = `,reserved=[${reserved}]`;
}
let presharedKey = proxy['pre-shared-key'];
let presharedKey = proxy['preshared-key'] ?? proxy['pre-shared-key'];
if (presharedKey) {
presharedKey = `,preshared-key="${presharedKey}"`;
}
result.append(
`,peers=[{public-key="${proxy['public-key']}",allowed-ips="${
allowedIps || '0.0.0.0/0,::/0'
allowedIps ?? '0.0.0.0/0,::/0'
}",endpoint=${proxy.server}:${proxy.port}${reserved ?? ''}${
presharedKey ?? ''
}}]`,

View File

@@ -78,6 +78,9 @@ export default function Stash_Producer() {
proxy.keepalive =
proxy.keepalive ?? proxy['persistent-keepalive'];
proxy['persistent-keepalive'] = proxy.keepalive;
proxy['preshared-key'] =
proxy['preshared-key'] ?? proxy['pre-shared-key'];
proxy['pre-shared-key'] = proxy['preshared-key'];
}
if (

View File

@@ -91,6 +91,9 @@ export default function Stash_Producer() {
proxy.keepalive =
proxy.keepalive ?? proxy['persistent-keepalive'];
proxy['persistent-keepalive'] = proxy.keepalive;
proxy['preshared-key'] =
proxy['preshared-key'] ?? proxy['pre-shared-key'];
proxy['pre-shared-key'] = proxy['preshared-key'];
}
if (