|
@@ -2323,7 +2323,7 @@ Inbound.WireguardSettings = class extends XrayCommonClass {
|
|
};
|
|
};
|
|
|
|
|
|
Inbound.WireguardSettings.Peer = 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();
|
|
super();
|
|
this.privateKey = privateKey
|
|
this.privateKey = privateKey
|
|
this.publicKey = publicKey;
|
|
this.publicKey = publicKey;
|
|
@@ -2331,6 +2331,9 @@ Inbound.WireguardSettings.Peer = class extends XrayCommonClass {
|
|
[this.publicKey, this.privateKey] = Object.values(Wireguard.generateKeypair())
|
|
[this.publicKey, this.privateKey] = Object.values(Wireguard.generateKeypair())
|
|
}
|
|
}
|
|
this.psk = psk;
|
|
this.psk = psk;
|
|
|
|
+ allowedIPs.forEach((a,index) => {
|
|
|
|
+ if (a.length>0 && !a.includes('/')) allowedIPs[index] += '/32';
|
|
|
|
+ })
|
|
this.allowedIPs = allowedIPs;
|
|
this.allowedIPs = allowedIPs;
|
|
this.keepAlive = keepAlive;
|
|
this.keepAlive = keepAlive;
|
|
}
|
|
}
|
|
@@ -2346,6 +2349,9 @@ Inbound.WireguardSettings.Peer = class extends XrayCommonClass {
|
|
}
|
|
}
|
|
|
|
|
|
toJson() {
|
|
toJson() {
|
|
|
|
+ this.allowedIPs.forEach((a,index) => {
|
|
|
|
+ if (a.length>0 && !a.includes('/')) this.allowedIPs[index] += '/32';
|
|
|
|
+ });
|
|
return {
|
|
return {
|
|
privateKey: this.privateKey,
|
|
privateKey: this.privateKey,
|
|
publicKey: this.publicKey,
|
|
publicKey: this.publicKey,
|