diff options
| author | MHSanaei <ho3ein.sanaei@gmail.com> | 2024-02-21 14:37:45 +0300 |
|---|---|---|
| committer | MHSanaei <ho3ein.sanaei@gmail.com> | 2024-02-21 14:37:45 +0300 |
| commit | 865d3e08e77f7380952ffa81e9b5334143687421 (patch) | |
| tree | 2cabf6be7eee8877687c63f00a4d49513289ef39 | |
| parent | 91ee6dc7cb88cead993ab83598a98515d3a3f111 (diff) | |
[wg] fix subnet in peer
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
| -rw-r--r-- | web/assets/js/model/xray.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index 5bee1ac7..791e8533 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -2323,7 +2323,7 @@ Inbound.WireguardSettings = class extends XrayCommonClass { }; Inbound.WireguardSettings.Peer = class extends XrayCommonClass { - constructor(privateKey, publicKey, psk='', allowedIPs=['10.0.0.0/24'], keepAlive=0) { + constructor(privateKey, publicKey, psk='', allowedIPs=['10.0.0.2/32'], keepAlive=0) { super(); this.privateKey = privateKey this.publicKey = publicKey; @@ -2331,6 +2331,9 @@ Inbound.WireguardSettings.Peer = class extends XrayCommonClass { [this.publicKey, this.privateKey] = Object.values(Wireguard.generateKeypair()) } this.psk = psk; + allowedIPs.forEach((a,index) => { + if (a.length>0 && !a.includes('/')) allowedIPs[index] += '/32'; + }) this.allowedIPs = allowedIPs; this.keepAlive = keepAlive; } @@ -2346,6 +2349,9 @@ Inbound.WireguardSettings.Peer = class extends XrayCommonClass { } toJson() { + this.allowedIPs.forEach((a,index) => { + if (a.length>0 && !a.includes('/')) this.allowedIPs[index] += '/32'; + }); return { privateKey: this.privateKey, publicKey: this.publicKey, |
