mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2026-10-30 01:12:07 +00:00
Add new AmneziaWG parameters (implemented in 3.0/3.1) (#1363)
This commit is contained in:
@@ -37,6 +37,15 @@ class AmneziaConfiguration(WireguardConfiguration):
|
||||
self.I3 = ""
|
||||
self.I4 = ""
|
||||
self.I5 = ""
|
||||
self.HeaderProtectionKey = ""
|
||||
self.ContentPaddingAddition = 0
|
||||
self.RekeyAfterTime = 0
|
||||
self.RekeyTimeout = 0
|
||||
self.RejectAfterTime = 0
|
||||
self.KeepaliveTimeout = 0
|
||||
self.MaxHandshakeAttempts = 0
|
||||
self.RandomTrailers = 0
|
||||
self.DisableCookies = 0
|
||||
self.J1 = ""
|
||||
self.J2 = ""
|
||||
self.J3 = ""
|
||||
@@ -84,6 +93,15 @@ class AmneziaConfiguration(WireguardConfiguration):
|
||||
"I3": self.I3,
|
||||
"I4": self.I4,
|
||||
"I5": self.I5,
|
||||
"HeaderProtectionKey": self.HeaderProtectionKey,
|
||||
"ContentPaddingAddition": self.ContentPaddingAddition,
|
||||
"RekeyAfterTime": self.RekeyAfterTime,
|
||||
"RekeyTimeout": self.RekeyTimeout,
|
||||
"RejectAfterTime": self.RejectAfterTime,
|
||||
"KeepaliveTimeout": self.KeepaliveTimeout,
|
||||
"MaxHandshakeAttempts": self.MaxHandshakeAttempts,
|
||||
"RandomTrailers": self.RandomTrailers,
|
||||
"DisableCookies": self.DisableCookies,
|
||||
"J1": self.J1,
|
||||
"J2": self.J2,
|
||||
"J3": self.J3,
|
||||
|
||||
@@ -207,6 +207,15 @@ class Peer:
|
||||
"I3": self.configuration.I3,
|
||||
"I4": self.configuration.I4,
|
||||
"I5": self.configuration.I5,
|
||||
"HeaderProtectionKey": self.configuration.HeaderProtectionKey,
|
||||
"ContentPaddingAddition": self.configuration.ContentPaddingAddition,
|
||||
"RekeyAfterTime": self.configuration.RekeyAfterTime,
|
||||
"RekeyTimeout": self.configuration.RekeyTimeout,
|
||||
"RejectAfterTime": self.configuration.RejectAfterTime,
|
||||
"KeepaliveTimeout": self.configuration.KeepaliveTimeout,
|
||||
"MaxHandshakeAttempts": self.configuration.MaxHandshakeAttempts,
|
||||
"RandomTrailers": self.configuration.RandomTrailers,
|
||||
"DisableCookies": self.configuration.DisableCookies,
|
||||
"J1": self.configuration.J1,
|
||||
"J2": self.configuration.J2,
|
||||
"J3": self.configuration.J3,
|
||||
|
||||
@@ -126,6 +126,15 @@ class WireguardConfiguration:
|
||||
"I3": self.I3,
|
||||
"I4": self.I4,
|
||||
"I5": self.I5,
|
||||
"HeaderProtectionKey": self.HeaderProtectionKey,
|
||||
"ContentPaddingAddition": self.ContentPaddingAddition,
|
||||
"RekeyAfterTime": self.RekeyAfterTime,
|
||||
"RekeyTimeout": self.RekeyTimeout,
|
||||
"RejectAfterTime": self.RejectAfterTime,
|
||||
"KeepaliveTimeout": self.KeepaliveTimeout,
|
||||
"MaxHandshakeAttempts": self.MaxHandshakeAttempts,
|
||||
"RandomTrailers": self.RandomTrailers,
|
||||
"DisableCookies": self.DisableCookies,
|
||||
"J1": self.J1,
|
||||
"J2": self.J2,
|
||||
"J3": self.J3,
|
||||
@@ -1029,7 +1038,7 @@ class WireguardConfiguration:
|
||||
allowEdit = ["Address", "PreUp", "PostUp", "PreDown", "PostDown", "ListenPort", "Table"]
|
||||
awgKeys = []
|
||||
if self.Protocol == 'awg':
|
||||
awgKeys = ["Jc", "Jmin", "Jmax", "S1", "S2", "S3", "S4", "H1", "H2", "H3", "H4", "I1", "I2", "I3", "I4", "I5", "J1", "J2", "J3", "Itime"]
|
||||
awgKeys = ["Jc", "Jmin", "Jmax", "S1", "S2", "S3", "S4", "H1", "H2", "H3", "H4", "I1", "I2", "I3", "I4", "I5", "HeaderProtectionKey", "ContentPaddingAddition", "RekeyAfterTime", "RekeyTimeout", "RejectAfterTime", "KeepaliveTimeout", "MaxHandshakeAttempts", "RandomTrailers", "DisableCookies", "J1", "J2", "J3", "Itime"]
|
||||
allowEdit += awgKeys
|
||||
start = original.index("[Interface]")
|
||||
try:
|
||||
|
||||
@@ -197,7 +197,7 @@ const deleteConfigurationModal = ref(false)
|
||||
v-model="data[key]"
|
||||
:id="'configuration_' + key">
|
||||
</div>
|
||||
<div v-for="key in ['Jc', 'Jmin', 'Jmax', 'S1', 'S2', 'S3', 'S4', 'H1', 'H2', 'H3', 'H4', 'I1', 'I2', 'I3', 'I4', 'I5']"
|
||||
<div v-for="key in ['Jc', 'Jmin', 'Jmax', 'S1', 'S2', 'S3', 'S4', 'H1', 'H2', 'H3', 'H4', 'I1', 'I2', 'I3', 'I4', 'I5', 'HeaderProtectionKey', 'ContentPaddingAddition', 'RekeyAfterTime', 'RekeyTimeout', 'RejectAfterTime', 'KeepaliveTimeout', 'MaxHandshakeAttempts', 'RandomTrailers', 'DisableCookies']"
|
||||
v-if="configurationInfo.Protocol === 'awg'">
|
||||
<label :for="'configuration_' + key" class="form-label">
|
||||
<small class="text-muted">
|
||||
|
||||
@@ -49,11 +49,20 @@ export default {
|
||||
H2: 0,
|
||||
H3: 0,
|
||||
H4: 0,
|
||||
I1: "0",
|
||||
I2: "0",
|
||||
I3: "0",
|
||||
I4: "0",
|
||||
I5: "0"
|
||||
I1: "",
|
||||
I2: "",
|
||||
I3: "",
|
||||
I4: "",
|
||||
I5: "",
|
||||
HeaderProtectionKey: "",
|
||||
ContentPaddingAddition: "0-64",
|
||||
RekeyAfterTime: "100-140",
|
||||
RekeyTimeout: "4-7",
|
||||
RejectAfterTime: "160-200",
|
||||
KeepaliveTimeout: "8-12",
|
||||
MaxHandshakeAttempts: "14-20",
|
||||
RandomTrailers: "on",
|
||||
DisableCookies: "on"
|
||||
},
|
||||
numberOfAvailableIPs: "0",
|
||||
error: false,
|
||||
@@ -72,9 +81,15 @@ export default {
|
||||
this.newConfiguration[key] = this.rand(1, 2**31);
|
||||
});
|
||||
|
||||
// Initialize I1 to I5 as "0"
|
||||
['I1', 'I2', 'I3', 'I4', 'I5'].forEach(key => {
|
||||
this.newConfiguration[key] = "0";
|
||||
// Initialize HeaderProtectionKey
|
||||
let headerProtectionKey = new Uint8Array(32);
|
||||
window.crypto.getRandomValues(headerProtectionKey);
|
||||
this.newConfiguration.HeaderProtectionKey = btoa(String.fromCharCode(...headerProtectionKey));
|
||||
|
||||
// S1-S4 are recommended be the same to work with RandomTrailers and must 12 or more to work with HeaderProtectionKey
|
||||
let constantS = 12 + this.rand(1, 2**5);
|
||||
['S1', 'S2', 'S3', 'S4'].forEach(key => {
|
||||
this.newConfiguration[key] = constantS;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
@@ -388,7 +403,7 @@ export default {
|
||||
|
||||
<div class="card rounded-3"
|
||||
v-if="this.newConfiguration.Protocol === 'awg'"
|
||||
v-for="key in ['Jc', 'Jmin', 'Jmax', 'S1', 'S2', 'S3', 'S4', 'H1', 'H2', 'H3', 'H4', 'I1', 'I2', 'I3', 'I4', 'I5']">
|
||||
v-for="key in ['Jc', 'Jmin', 'Jmax', 'S1', 'S2', 'S3', 'S4', 'H1', 'H2', 'H3', 'H4', 'I1', 'I2', 'I3', 'I4', 'I5', 'HeaderProtectionKey', 'ContentPaddingAddition', 'RekeyAfterTime', 'RekeyTimeout', 'RejectAfterTime', 'KeepaliveTimeout', 'MaxHandshakeAttempts', 'RandomTrailers', 'DisableCookies']">
|
||||
<div class="card-header">{{ key }}</div>
|
||||
<div class="card-body">
|
||||
<input type="text"
|
||||
|
||||
Reference in New Issue
Block a user