mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-19 05:30:06 +08:00
add persistent_keepalive_interval to wireguard
This commit is contained in:
parent
bed488a068
commit
437f583e05
@ -9,6 +9,7 @@ namespace NekoGui_fmt {
|
||||
QString publicKey;
|
||||
QString preSharedKey;
|
||||
QList<int> reserved;
|
||||
int persistentKeepalive = 0;
|
||||
QStringList localAddress;
|
||||
int MTU = 1420;
|
||||
bool useSystemInterface = false;
|
||||
@ -20,6 +21,7 @@ namespace NekoGui_fmt {
|
||||
_add(new configItem("public_key", &publicKey, itemType::string));
|
||||
_add(new configItem("pre_shared_key", &preSharedKey, itemType::string));
|
||||
_add(new configItem("reserved", &reserved, itemType::integerList));
|
||||
_add(new configItem("persistent_keepalive", &persistentKeepalive, itemType::integer));
|
||||
_add(new configItem("local_address", &localAddress, itemType::stringList));
|
||||
_add(new configItem("mtu", &MTU, itemType::integer));
|
||||
_add(new configItem("use_system_proxy", &useSystemInterface, itemType::boolean));
|
||||
|
||||
@ -7,27 +7,33 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<height>326</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>EditWireguard</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="reserved_l">
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="public_key"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="public_key_l">
|
||||
<property name="text">
|
||||
<string>Reserved</string>
|
||||
<string>Public Key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="local_addr_l">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>comma seperated list of subnets</p></body></html></string>
|
||||
</property>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="reserved"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="preshared_key"/>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QCheckBox" name="enable_gso">
|
||||
<property name="text">
|
||||
<string>Local Address</string>
|
||||
<string>Enable GSO</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -38,35 +44,35 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="QLineEdit" name="local_addr"/>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="reserved"/>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="local_addr_l">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>comma seperated list of subnets</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Local Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="mtu_l">
|
||||
<property name="text">
|
||||
<string>MTU</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QCheckBox" name="sys_ifc">
|
||||
<property name="text">
|
||||
<string>Use System Interface</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QCheckBox" name="enable_gso">
|
||||
<property name="text">
|
||||
<string>Enable GSO</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="public_key_l">
|
||||
<property name="text">
|
||||
<string>Public Key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="preshared_key"/>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="private_key"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="private_key_l">
|
||||
@ -75,27 +81,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="public_key"/>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLineEdit" name="workers"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="private_key"/>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLineEdit" name="mtu">
|
||||
<property name="text">
|
||||
<string>1420</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="mtu_l">
|
||||
<property name="text">
|
||||
<string>MTU</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="workers_l">
|
||||
<property name="text">
|
||||
<string>Workers</string>
|
||||
@ -103,7 +92,34 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLineEdit" name="workers"/>
|
||||
<widget class="QLineEdit" name="mtu">
|
||||
<property name="text">
|
||||
<string>1420</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="reserved_l">
|
||||
<property name="text">
|
||||
<string>Reserved</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="persistent_keepalive"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>persistent_keepalive_interval in seconds</p></body></html></string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><html><head/><body><p><br/></p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Persistent Keepalive</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
@ -287,6 +287,7 @@ namespace NekoGui_fmt {
|
||||
{"pre_shared_key", preSharedKey},
|
||||
{"reserved", QListInt2QJsonArray(reserved)},
|
||||
{"allowed_ips", QListStr2QJsonArray({"0.0.0.0/0", "::/0"})},
|
||||
{"persistent_keepalive_interval", persistentKeepalive},
|
||||
};
|
||||
QJsonObject outbound{
|
||||
{"type", "wireguard"},
|
||||
|
||||
@ -260,6 +260,7 @@ namespace NekoGui_fmt {
|
||||
q.addQueryItem("peer_public_key", publicKey);
|
||||
q.addQueryItem("pre_shared_key", preSharedKey);
|
||||
q.addQueryItem("reserved", FormatReserved());
|
||||
q.addQueryItem("persistent_keepalive", Int2String(persistentKeepalive));
|
||||
q.addQueryItem("mtu", Int2String(MTU));
|
||||
q.addQueryItem("use_system_interface", useSystemInterface ? "true":"false");
|
||||
q.addQueryItem("local_address", localAddress.join("-"));
|
||||
|
||||
@ -215,6 +215,7 @@ namespace NekoGui_fmt
|
||||
serverPort = peers[0].toObject()["port"].toInt();
|
||||
publicKey = peers[0].toObject()["public_key"].toString();
|
||||
reserved = QJsonArray2QListInt(peers[0].toObject()["reserved"].toArray());
|
||||
persistentKeepalive = peers[0].toObject()["persistent_keepalive_interval"].toInt();
|
||||
workerCount = obj["workers"].toInt();
|
||||
privateKey = obj["private_key"].toString();
|
||||
localAddress = QJsonArray2QListString(obj["address"].toArray());
|
||||
|
||||
@ -358,6 +358,7 @@ namespace NekoGui_fmt {
|
||||
if (!rawLocalAddr.isEmpty()) {
|
||||
for (const auto &item: rawLocalAddr.split("-")) localAddress += item;
|
||||
}
|
||||
persistentKeepalive = query.queryItemValue("persistent_keepalive").toInt();
|
||||
MTU = query.queryItemValue("mtu").toInt();
|
||||
useSystemInterface = query.queryItemValue("use_system_interface") == "true";
|
||||
workerCount = query.queryItemValue("workers").toInt();
|
||||
|
||||
@ -24,6 +24,7 @@ void EditWireguard::onStart(std::shared_ptr<NekoGui::ProxyEntity> _ent) {
|
||||
ui->preshared_key->setText(bean->preSharedKey);
|
||||
auto reservedStr = bean->FormatReserved().replace("-", ",");
|
||||
ui->reserved->setText(reservedStr);
|
||||
ui->persistent_keepalive->setText(Int2String(bean->persistentKeepalive));
|
||||
ui->mtu->setText(Int2String(bean->MTU));
|
||||
ui->sys_ifc->setChecked(bean->useSystemInterface);
|
||||
ui->enable_gso->setChecked(bean->enableGSO);
|
||||
@ -43,6 +44,7 @@ bool EditWireguard::onEnd() {
|
||||
if (item.trimmed().isEmpty()) continue;
|
||||
bean->reserved += item.trimmed().toInt();
|
||||
}
|
||||
bean->persistentKeepalive = ui->persistent_keepalive->text().toInt();
|
||||
bean->MTU = ui->mtu->text().toInt();
|
||||
bean->useSystemInterface = ui->sys_ifc->isChecked();
|
||||
bean->enableGSO = ui->enable_gso->isChecked();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user