mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-19 13:50:12 +08:00
make Tun routing optional
This commit is contained in:
parent
dea6514caf
commit
52ca4dbfbe
@ -113,6 +113,7 @@ namespace NekoGui {
|
|||||||
|
|
||||||
// VPN
|
// VPN
|
||||||
bool fake_dns = false;
|
bool fake_dns = false;
|
||||||
|
bool enable_tun_routing = false;
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
QString vpn_implementation = "gvisor";
|
QString vpn_implementation = "gvisor";
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -93,6 +93,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="tun_routing">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>When enabled, Direct IP CIDRs and rule sets will also be added to the Tun setting to be excluded at OS routing level. IMPORTANT: Large rule sets have been reported to cause massive CPU usage in windows, please enable this option with caution.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable Tun Routing</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@ -504,7 +504,7 @@ namespace NekoGui {
|
|||||||
if (dataStore->vpn_ipv6) tunAddress += "fdfe:dcba:9876::1/96";
|
if (dataStore->vpn_ipv6) tunAddress += "fdfe:dcba:9876::1/96";
|
||||||
inboundObj["address"] = tunAddress;
|
inboundObj["address"] = tunAddress;
|
||||||
inboundObj["domain_strategy"] = dataStore->routing->domain_strategy;
|
inboundObj["domain_strategy"] = dataStore->routing->domain_strategy;
|
||||||
if (dataStore->routing->def_outbound == "proxy")
|
if (dataStore->enable_tun_routing && dataStore->routing->def_outbound == "proxy")
|
||||||
{
|
{
|
||||||
if (!directIPCIDRs.isEmpty()) inboundObj["route_exclude_address"] = directIPCIDRs;
|
if (!directIPCIDRs.isEmpty()) inboundObj["route_exclude_address"] = directIPCIDRs;
|
||||||
if (!directIPSets.isEmpty()) inboundObj["route_exclude_address_set"] = directIPSets;
|
if (!directIPSets.isEmpty()) inboundObj["route_exclude_address_set"] = directIPSets;
|
||||||
|
|||||||
@ -308,6 +308,7 @@ namespace NekoGui {
|
|||||||
_add(new configItem("stats_tab", &stats_tab, itemType::string));
|
_add(new configItem("stats_tab", &stats_tab, itemType::string));
|
||||||
_add(new configItem("proxy_scheme", &proxy_scheme, itemType::string));
|
_add(new configItem("proxy_scheme", &proxy_scheme, itemType::string));
|
||||||
_add(new configItem("disable_privilege_req", &disable_privilege_req, itemType::boolean));
|
_add(new configItem("disable_privilege_req", &disable_privilege_req, itemType::boolean));
|
||||||
|
_add(new configItem("enable_tun_routing", &enable_tun_routing, itemType::boolean));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataStore::UpdateStartedId(int id) {
|
void DataStore::UpdateStartedId(int id) {
|
||||||
|
|||||||
@ -16,6 +16,7 @@ DialogVPNSettings::DialogVPNSettings(QWidget *parent) : QDialog(parent), ui(new
|
|||||||
ui->vpn_mtu->setCurrentText(Int2String(NekoGui::dataStore->vpn_mtu));
|
ui->vpn_mtu->setCurrentText(Int2String(NekoGui::dataStore->vpn_mtu));
|
||||||
ui->vpn_ipv6->setChecked(NekoGui::dataStore->vpn_ipv6);
|
ui->vpn_ipv6->setChecked(NekoGui::dataStore->vpn_ipv6);
|
||||||
ui->strict_route->setChecked(NekoGui::dataStore->vpn_strict_route);
|
ui->strict_route->setChecked(NekoGui::dataStore->vpn_strict_route);
|
||||||
|
ui->tun_routing->setChecked(NekoGui::dataStore->enable_tun_routing);
|
||||||
ADJUST_SIZE
|
ADJUST_SIZE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,6 +32,7 @@ void DialogVPNSettings::accept() {
|
|||||||
NekoGui::dataStore->vpn_mtu = mtu;
|
NekoGui::dataStore->vpn_mtu = mtu;
|
||||||
NekoGui::dataStore->vpn_ipv6 = ui->vpn_ipv6->isChecked();
|
NekoGui::dataStore->vpn_ipv6 = ui->vpn_ipv6->isChecked();
|
||||||
NekoGui::dataStore->vpn_strict_route = ui->strict_route->isChecked();
|
NekoGui::dataStore->vpn_strict_route = ui->strict_route->isChecked();
|
||||||
|
NekoGui::dataStore->enable_tun_routing = ui->tun_routing->isChecked();
|
||||||
//
|
//
|
||||||
QStringList msg{"UpdateDataStore"};
|
QStringList msg{"UpdateDataStore"};
|
||||||
msg << "VPNChanged";
|
msg << "VPNChanged";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user