final outbound rule GUI

This commit is contained in:
arm64v8a
2023-01-29 11:32:46 +09:00
parent e9e105e050
commit c58f231b2c
9 changed files with 458 additions and 354 deletions

View File

@@ -290,7 +290,7 @@ namespace NekoRay {
routing["domainMatcher"] = dataStore->domain_matcher == DomainMatcher::MPH ? "mph" : "linear"; routing["domainMatcher"] = dataStore->domain_matcher == DomainMatcher::MPH ? "mph" : "linear";
if (status->forTest) routing["domainStrategy"] = "AsIs"; if (status->forTest) routing["domainStrategy"] = "AsIs";
// final add block route // final add user rule (block)
QJsonObject routingRule_tmp; QJsonObject routingRule_tmp;
routingRule_tmp["type"] = "field"; routingRule_tmp["type"] = "field";
routingRule_tmp["outboundTag"] = "block"; routingRule_tmp["outboundTag"] = "block";
@@ -305,7 +305,7 @@ namespace NekoRay {
status->routingRules += tmp; status->routingRules += tmp;
} }
// final add proxy route // final add user rule (proxy)
routingRule_tmp["outboundTag"] = "proxy"; routingRule_tmp["outboundTag"] = "proxy";
if (!status->ipListRemote.isEmpty()) { if (!status->ipListRemote.isEmpty()) {
auto tmp = routingRule_tmp; auto tmp = routingRule_tmp;
@@ -318,7 +318,7 @@ namespace NekoRay {
status->routingRules += tmp; status->routingRules += tmp;
} }
// final add bypass route // final add user rule (bypass)
routingRule_tmp["outboundTag"] = "bypass"; routingRule_tmp["outboundTag"] = "bypass";
if (!status->ipListDirect.isEmpty()) { if (!status->ipListDirect.isEmpty()) {
auto tmp = routingRule_tmp; auto tmp = routingRule_tmp;
@@ -331,8 +331,14 @@ namespace NekoRay {
status->routingRules += tmp; status->routingRules += tmp;
} }
// def_outbound
status->routingRules += QJsonObject{
{"type", "field"},
{"port", "0-65535"},
{"outboundTag", dataStore->routing->def_outbound},
};
// final add routing rule // final add routing rule
// custom routing rule
auto routingRules = QString2QJsonObject(dataStore->routing->custom)["rules"].toArray(); auto routingRules = QString2QJsonObject(dataStore->routing->custom)["rules"].toArray();
if (status->forTest) routingRules = {}; if (status->forTest) routingRules = {};
if (!status->forTest) QJSONARRAY_ADD(routingRules, QString2QJsonObject(dataStore->custom_route_global)["rules"].toArray()) if (!status->forTest) QJSONARRAY_ADD(routingRules, QString2QJsonObject(dataStore->custom_route_global)["rules"].toArray())
@@ -604,11 +610,7 @@ namespace NekoRay {
// Bypass Lookup for the first profile // Bypass Lookup for the first profile
if (isFirstProfile && !IsIpAddress(ent->bean->serverAddress)) { if (isFirstProfile && !IsIpAddress(ent->bean->serverAddress)) {
if (dataStore->enhance_resolve_server_domain && !IS_NEKO_BOX) { status->domainListDNSDirect += "full:" + ent->bean->serverAddress;
status->result->tryDomains += ent->bean->serverAddress;
} else {
status->domainListDNSDirect += "full:" + ent->bean->serverAddress;
}
} }
status->outbounds += outbound; status->outbounds += outbound;
@@ -791,22 +793,18 @@ namespace NekoRay {
// Routing // Routing
// custom routing rule (top)
auto routingRules = QString2QJsonObject(dataStore->routing->custom)["rules"].toArray();
if (status->forTest) routingRules = {};
// dns hijack // dns hijack
if (!status->forTest) routingRules += QJsonObject{{"protocol", "dns"}, {"outbound", "dns-out"}}; if (!status->forTest) status->routingRules += QJsonObject{{"protocol", "dns"}, {"outbound", "dns-out"}};
// sing-box routing rule object // sing-box routing rule object
auto add_rule_route = [&](const QStringList &list, bool isIP, const QString &out) { auto add_rule_route = [&](const QStringList &list, bool isIP, const QString &out) {
auto rule = make_rule(list, isIP); auto rule = make_rule(list, isIP);
if (rule.isEmpty()) return; if (rule.isEmpty()) return;
rule["outbound"] = out; rule["outbound"] = out;
routingRules += rule; status->routingRules += rule;
}; };
// final add routing rule // final add user rule
add_rule_route(status->ipListBlock, true, "block"); add_rule_route(status->ipListBlock, true, "block");
add_rule_route(status->ipListRemote, true, tagProxy); add_rule_route(status->ipListRemote, true, tagProxy);
add_rule_route(status->ipListDirect, true, "bypass"); add_rule_route(status->ipListDirect, true, "bypass");
@@ -814,6 +812,12 @@ namespace NekoRay {
add_rule_route(status->domainListRemote, false, tagProxy); add_rule_route(status->domainListRemote, false, tagProxy);
add_rule_route(status->domainListDirect, false, "bypass"); add_rule_route(status->domainListDirect, false, "bypass");
// def_outbound
status->routingRules += QJsonObject{
{"port_range", ":"},
{"outbound", dataStore->routing->def_outbound},
};
// geopath // geopath
auto geoip = FindCoreAsset("geoip.db"); auto geoip = FindCoreAsset("geoip.db");
auto geosite = FindCoreAsset("geosite.db"); auto geosite = FindCoreAsset("geosite.db");
@@ -821,6 +825,8 @@ namespace NekoRay {
if (geosite.isEmpty()) status->result->error = +"geosite.db not found"; if (geosite.isEmpty()) status->result->error = +"geosite.db not found";
// final add routing rule // final add routing rule
auto routingRules = QString2QJsonObject(dataStore->routing->custom)["rules"].toArray();
if (status->forTest) routingRules = {};
if (!status->forTest) QJSONARRAY_ADD(routingRules, QString2QJsonObject(dataStore->custom_route_global)["rules"].toArray()) if (!status->forTest) QJSONARRAY_ADD(routingRules, QString2QJsonObject(dataStore->custom_route_global)["rules"].toArray())
QJSONARRAY_ADD(routingRules, status->routingRules) QJSONARRAY_ADD(routingRules, status->routingRules)
auto routeObj = QJsonObject{ auto routeObj = QJsonObject{

View File

@@ -8,7 +8,6 @@ namespace NekoRay {
public: public:
QString error; QString error;
QJsonObject coreConfig; QJsonObject coreConfig;
QStringList tryDomains;
QList<QSharedPointer<traffic::TrafficData>> outboundStats; // all, but not including "bypass" "block" QList<QSharedPointer<traffic::TrafficData>> outboundStats; // all, but not including "bypass" "block"
QSharedPointer<traffic::TrafficData> outboundStat; // main QSharedPointer<traffic::TrafficData> outboundStat; // main

View File

@@ -41,7 +41,6 @@ namespace NekoRay {
_add(new configItem("custom_route", &custom_route_global, itemType::string)); _add(new configItem("custom_route", &custom_route_global, itemType::string));
_add(new configItem("v2ray_asset_dir", &v2ray_asset_dir, itemType::string)); _add(new configItem("v2ray_asset_dir", &v2ray_asset_dir, itemType::string));
_add(new configItem("sub_use_proxy", &sub_use_proxy, itemType::boolean)); _add(new configItem("sub_use_proxy", &sub_use_proxy, itemType::boolean));
_add(new configItem("enhance_domain", &enhance_resolve_server_domain, itemType::boolean));
_add(new configItem("remember_id", &remember_id, itemType::integer)); _add(new configItem("remember_id", &remember_id, itemType::integer));
_add(new configItem("remember_enable", &remember_enable, itemType::boolean)); _add(new configItem("remember_enable", &remember_enable, itemType::boolean));
_add(new configItem("language", &language, itemType::integer)); _add(new configItem("language", &language, itemType::integer));
@@ -108,6 +107,7 @@ namespace NekoRay {
_add(new configItem("proxy_domain", &this->proxy_domain, itemType::string)); _add(new configItem("proxy_domain", &this->proxy_domain, itemType::string));
_add(new configItem("block_ip", &this->block_ip, itemType::string)); _add(new configItem("block_ip", &this->block_ip, itemType::string));
_add(new configItem("block_domain", &this->block_domain, itemType::string)); _add(new configItem("block_domain", &this->block_domain, itemType::string));
_add(new configItem("def_outbound", &this->def_outbound, itemType::string));
_add(new configItem("custom", &this->custom, itemType::string)); _add(new configItem("custom", &this->custom, itemType::string));
} }

View File

@@ -10,6 +10,7 @@ namespace NekoRay {
QString proxy_domain; QString proxy_domain;
QString block_ip; QString block_ip;
QString block_domain; QString block_domain;
QString def_outbound = "proxy";
QString custom = "{\"rules\": []}"; QString custom = "{\"rules\": []}";
explicit Routing(int preset = 0); explicit Routing(int preset = 0);
@@ -116,7 +117,6 @@ namespace NekoRay {
QString remote_dns = "https://8.8.8.8/dns-query"; QString remote_dns = "https://8.8.8.8/dns-query";
QString direct_dns = "localhost"; QString direct_dns = "localhost";
bool dns_routing = true; bool dns_routing = true;
bool enhance_resolve_server_domain = false;
// Routing // Routing
bool fake_dns = false; bool fake_dns = false;

View File

@@ -468,14 +468,6 @@
<source>Direct DNS</source> <source>Direct DNS</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Using multiple overseas DNS to query the server address can alleviate the DNS pollution of the server domain name to a certain extent, which may have side effects.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enhanced domain name resolution</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Enable DNS Routing</source> <source>Enable DNS Routing</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@@ -560,6 +552,10 @@
<source>Remove routing: %1</source> <source>Remove routing: %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Default Outbound</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>DialogVPNSettings</name> <name>DialogVPNSettings</name>

View File

@@ -468,11 +468,11 @@
</message> </message>
<message> <message>
<source>Enhanced domain name resolution</source> <source>Enhanced domain name resolution</source>
<translation></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<source>Using multiple overseas DNS to query the server address can alleviate the DNS pollution of the server domain name to a certain extent, which may have side effects.</source> <source>Using multiple overseas DNS to query the server address can alleviate the DNS pollution of the server domain name to a certain extent, which may have side effects.</source>
<translation>使 DNS DNS </translation> <translation type="vanished">使 DNS DNS </translation>
</message> </message>
<message> <message>
<source>Enable DNS Routing</source> <source>Enable DNS Routing</source>
@@ -558,6 +558,10 @@
<source>Custom (global)</source> <source>Custom (global)</source>
<translation> ()</translation> <translation> ()</translation>
</message> </message>
<message>
<source>Default Outbound</source>
<translation></translation>
</message>
</context> </context>
<context> <context>
<name>DialogVPNSettings</name> <name>DialogVPNSettings</name>

View File

@@ -9,11 +9,11 @@
#include <QMessageBox> #include <QMessageBox>
#include <QListWidget> #include <QListWidget>
#define REFRESH_ACTIVE_ROUTING(a, r) \ #define REFRESH_ACTIVE_ROUTING(name, obj) \
active_routing = a; \ this->active_routing = name; \
ui->active_routing->setText("[" + active_routing + "]"); \ ui->active_routing->setText(name); \
setWindowTitle(title_base + " [" + a + "]"); \ setWindowTitle(title_base + " [" + name + "]"); \
SetRouteConfig(*r); SetRouteConfig(*obj);
#define SAVE_TO_ROUTING(r) \ #define SAVE_TO_ROUTING(r) \
r->direct_ip = directIPTxt->toPlainText(); \ r->direct_ip = directIPTxt->toPlainText(); \
@@ -22,6 +22,7 @@
r->proxy_domain = proxyDomainTxt->toPlainText(); \ r->proxy_domain = proxyDomainTxt->toPlainText(); \
r->block_ip = blockIPTxt->toPlainText(); \ r->block_ip = blockIPTxt->toPlainText(); \
r->block_domain = blockDomainTxt->toPlainText(); \ r->block_domain = blockDomainTxt->toPlainText(); \
r->def_outbound = ui->def_outbound->currentText(); \
r->custom = CACHE.custom_route; r->custom = CACHE.custom_route;
DialogManageRoutes::DialogManageRoutes(QWidget *parent) : QDialog(parent), ui(new Ui::DialogManageRoutes) { DialogManageRoutes::DialogManageRoutes(QWidget *parent) : QDialog(parent), ui(new Ui::DialogManageRoutes) {
@@ -29,10 +30,8 @@ DialogManageRoutes::DialogManageRoutes(QWidget *parent) : QDialog(parent), ui(ne
title_base = windowTitle(); title_base = windowTitle();
if (IS_NEKO_BOX) { if (IS_NEKO_BOX) {
ui->enhance_resolve_server_domain->setVisible(false);
ui->domain_v2ray->setVisible(false); ui->domain_v2ray->setVisible(false);
} else { } else {
ui->enhance_resolve_server_domain->setVisible(true);
ui->domain_v2ray->setVisible(true); ui->domain_v2ray->setVisible(true);
} }
// //
@@ -43,7 +42,6 @@ DialogManageRoutes::DialogManageRoutes(QWidget *parent) : QDialog(parent), ui(ne
ui->dns_routing->setChecked(NekoRay::dataStore->dns_routing); ui->dns_routing->setChecked(NekoRay::dataStore->dns_routing);
ui->dns_remote->setText(NekoRay::dataStore->remote_dns); ui->dns_remote->setText(NekoRay::dataStore->remote_dns);
ui->dns_direct->setText(NekoRay::dataStore->direct_dns); ui->dns_direct->setText(NekoRay::dataStore->direct_dns);
ui->enhance_resolve_server_domain->setChecked(NekoRay::dataStore->enhance_resolve_server_domain);
D_C_LOAD_STRING(custom_route_global) D_C_LOAD_STRING(custom_route_global)
// //
connect(ui->custom_route_edit, &QPushButton::clicked, this, [=] { connect(ui->custom_route_edit, &QPushButton::clicked, this, [=] {
@@ -93,7 +91,6 @@ void DialogManageRoutes::accept() {
NekoRay::dataStore->dns_routing = ui->dns_routing->isChecked(); NekoRay::dataStore->dns_routing = ui->dns_routing->isChecked();
NekoRay::dataStore->remote_dns = ui->dns_remote->text(); NekoRay::dataStore->remote_dns = ui->dns_remote->text();
NekoRay::dataStore->direct_dns = ui->dns_direct->text(); NekoRay::dataStore->direct_dns = ui->dns_direct->text();
NekoRay::dataStore->enhance_resolve_server_domain = ui->enhance_resolve_server_domain->isChecked();
D_C_SAVE_STRING(custom_route_global) D_C_SAVE_STRING(custom_route_global)
bool routeChanged = false; bool routeChanged = false;
if (NekoRay::dataStore->active_routing != active_routing) routeChanged = true; if (NekoRay::dataStore->active_routing != active_routing) routeChanged = true;
@@ -135,6 +132,7 @@ void DialogManageRoutes::SetRouteConfig(const NekoRay::Routing &conf) {
proxyIPTxt->setPlainText(conf.proxy_ip); proxyIPTxt->setPlainText(conf.proxy_ip);
// //
CACHE.custom_route = conf.custom; CACHE.custom_route = conf.custom;
ui->def_outbound->setCurrentText(conf.def_outbound);
} }
void DialogManageRoutes::on_load_save_clicked() { void DialogManageRoutes::on_load_save_clicked() {

View File

@@ -13,67 +13,171 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Routes</string> <string>Routes</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item row="0" column="0"> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <widget class="QGroupBox" name="gb1">
<item> <layout class="QVBoxLayout" name="verticalLayout_3">
<layout class="QVBoxLayout" name="verticalLayout_3"> <item>
<item> <layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QHBoxLayout" name="horizontalLayout_3"> <item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Sniffing Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="sniffing_mode">
<item>
<property name="text">
<string>Disable</string>
</property>
</item>
<item>
<property name="text">
<string>The sniffing result is used for routing</string>
</property>
</item>
<item>
<property name="text">
<string>The sniffing result is used for destination</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Outbound Domain Strategy</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="outbound_domain_strategy">
<property name="editable">
<bool>false</bool>
</property>
<item>
<property name="text">
<string notr="true">AsIs</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">UseIP</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">UseIPv4</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">UseIPv6</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">PreferIPv4</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">PreferIPv6</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>Remote DNS</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="dns_remote"/>
</item>
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>Direct DNS</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="dns_direct"/>
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="domain_v2ray" native="true">
<layout class="QHBoxLayout" name="_2" stretch="0,0,0,1,0,1">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<widget class="QLabel" name="label"> <widget class="QCheckBox" name="dns_routing">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Sniffing Mode</string> <string>Enable DNS Routing</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="sniffing_mode"> <widget class="Line" name="line">
<item>
<property name="text">
<string>Disable</string>
</property>
</item>
<item>
<property name="text">
<string>The sniffing result is used for routing</string>
</property>
</item>
<item>
<property name="text">
<string>The sniffing result is used for destination</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="Line" name="line_4">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>Outbound Domain Strategy</string> <string>Domain Strategy</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="outbound_domain_strategy"> <widget class="QComboBox" name="domainStrategyCombo">
<property name="editable"> <property name="editable">
<bool>false</bool> <bool>false</bool>
</property> </property>
@@ -84,284 +188,282 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string notr="true">UseIP</string> <string notr="true">IPIfNonMatch</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string notr="true">UseIPv4</string> <string notr="true">IPOnDemand</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Matcher</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="domainMatcherCombo">
<item>
<property name="text">
<string notr="true">Original</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string notr="true">UseIPv6</string> <string notr="true">Minimal Perfect Hash Matcher</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">PreferIPv4</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">PreferIPv6</string>
</property> </property>
</item> </item>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </widget>
<item> </item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> </layout>
<item> </widget>
<widget class="QLabel" name="label_9"> </item>
<property name="text"> <item>
<string>Remote DNS</string> <widget class="QGroupBox" name="gb2">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout_3" rowstretch="0,1,1" columnstretch="0,1,1,1">
<item row="0" column="3">
<widget class="QLabel" name="label_82">
<property name="text">
<string>Block</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="3">
<layout class="QGridLayout" name="blockTxtLayout"/>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_80">
<property name="text">
<string>Direct</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Domain</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QGridLayout" name="directTxtLayout"/>
</item>
<item row="1" column="2">
<layout class="QGridLayout" name="proxyIPLayout"/>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_81">
<property name="text">
<string>Proxy</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="2">
<layout class="QGridLayout" name="proxyTxtLayout"/>
</item>
<item row="1" column="3">
<layout class="QGridLayout" name="blockIPLayout"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>IP</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QGridLayout" name="directIPLayout"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="active_routing">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QWidget" name="horizontalWidget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="leftMargin">
<number>0</number>
</property> </property>
</widget> <property name="topMargin">
</item> <number>0</number>
<item>
<widget class="QLineEdit" name="dns_remote"/>
</item>
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>Direct DNS</string>
</property> </property>
</widget> <property name="rightMargin">
</item> <number>0</number>
<item>
<widget class="QLineEdit" name="dns_direct"/>
</item>
<item>
<widget class="QCheckBox" name="enhance_resolve_server_domain">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="toolTip"> <property name="bottomMargin">
<string>Using multiple overseas DNS to query the server address can alleviate the DNS pollution of the server domain name to a certain extent, which may have side effects.</string> <number>0</number>
</property> </property>
<property name="text"> <item>
<string>Enhanced domain name resolution</string> <widget class="QToolButton" name="preset">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Preset</string>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="custom_route_edit">
<property name="text">
<string>Custom</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QWidget" name="horizontalWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property> </property>
</widget> <property name="topMargin">
</item> <number>0</number>
</layout> </property>
</item> <property name="rightMargin">
</layout> <number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Default Outbound</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="def_outbound">
<item>
<property name="text">
<string notr="true">proxy</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">bypass</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">block</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QWidget" name="horizontalWidget_3" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="load_save">
<property name="text">
<string>Mange route set</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="custom_route_global_edit">
<property name="text">
<string>Custom (global)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <widget class="QDialogButtonBox" name="buttonBox">
<item> <property name="sizePolicy">
<widget class="QWidget" name="domain_v2ray" native="true"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<layout class="QHBoxLayout" name="_2" stretch="0,0,0,1,0,0"> <horstretch>0</horstretch>
<item> <verstretch>0</verstretch>
<widget class="QCheckBox" name="dns_routing"> </sizepolicy>
<property name="sizePolicy"> </property>
<sizepolicy hsizetype="Maximum" vsizetype="Fixed"> <property name="standardButtons">
<horstretch>0</horstretch> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<verstretch>0</verstretch> </property>
</sizepolicy> </widget>
</property>
<property name="text">
<string>Enable DNS Routing</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Domain Strategy</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="domainStrategyCombo">
<property name="editable">
<bool>false</bool>
</property>
<item>
<property name="text">
<string notr="true">AsIs</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">IPIfNonMatch</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">IPOnDemand</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Matcher</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="domainMatcherCombo">
<item>
<property name="text">
<string notr="true">Original</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">Minimal Perfect Hash Matcher</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_3" rowstretch="0,1,1" columnstretch="0,1,1,1">
<item row="0" column="3">
<widget class="QLabel" name="label_82">
<property name="text">
<string>Block</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="3">
<layout class="QGridLayout" name="blockTxtLayout"/>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_80">
<property name="text">
<string>Direct</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Domain</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QGridLayout" name="directTxtLayout"/>
</item>
<item row="1" column="2">
<layout class="QGridLayout" name="proxyIPLayout"/>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_81">
<property name="text">
<string>Proxy</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="2">
<layout class="QGridLayout" name="proxyTxtLayout"/>
</item>
<item row="1" column="3">
<layout class="QGridLayout" name="blockIPLayout"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>IP</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QGridLayout" name="directIPLayout"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="active_routing">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QToolButton" name="preset">
<property name="text">
<string>Preset</string>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="custom_route_edit">
<property name="text">
<string>Custom</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="custom_route_global_edit">
<property name="text">
<string>Custom (global)</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="load_save">
<property name="text">
<string>Mange route set</string>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</item> </item>
@@ -372,33 +474,17 @@
<tabstop>outbound_domain_strategy</tabstop> <tabstop>outbound_domain_strategy</tabstop>
<tabstop>dns_remote</tabstop> <tabstop>dns_remote</tabstop>
<tabstop>dns_direct</tabstop> <tabstop>dns_direct</tabstop>
<tabstop>enhance_resolve_server_domain</tabstop>
<tabstop>dns_routing</tabstop> <tabstop>dns_routing</tabstop>
<tabstop>domainStrategyCombo</tabstop> <tabstop>domainStrategyCombo</tabstop>
<tabstop>domainMatcherCombo</tabstop> <tabstop>domainMatcherCombo</tabstop>
<tabstop>preset</tabstop> <tabstop>preset</tabstop>
<tabstop>custom_route_edit</tabstop> <tabstop>custom_route_edit</tabstop>
<tabstop>custom_route_global_edit</tabstop> <tabstop>def_outbound</tabstop>
<tabstop>load_save</tabstop> <tabstop>load_save</tabstop>
<tabstop>custom_route_global_edit</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections> <connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogManageRoutes</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>399</x>
<y>574</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>299</y>
</hint>
</hints>
</connection>
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>rejected()</signal> <signal>rejected()</signal>
@@ -415,5 +501,21 @@
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogManageRoutes</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>399</x>
<y>574</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>299</y>
</hint>
</hints>
</connection>
</connections> </connections>
</ui> </ui>

View File

@@ -220,7 +220,6 @@ void MainWindow::neko_start(int _id) {
#ifndef NKR_NO_GRPC #ifndef NKR_NO_GRPC
libcore::LoadConfigReq req; libcore::LoadConfigReq req;
req.set_coreconfig(QJsonObject2QString(result->coreConfig, true).toStdString()); req.set_coreconfig(QJsonObject2QString(result->coreConfig, true).toStdString());
req.set_trydomains(result->tryDomains.join(",").toStdString());
// //
bool rpcOK; bool rpcOK;
QString error = defaultClient->Start(&rpcOK, req); QString error = defaultClient->Start(&rpcOK, req);