mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 20:44:38 +03:00
refactor route settings
This commit is contained in:
@@ -131,11 +131,11 @@ namespace NekoRay {
|
|||||||
|
|
||||||
#define DOMAIN_USER_RULE \
|
#define DOMAIN_USER_RULE \
|
||||||
for (const auto &line: SplitLinesSkipSharp(dataStore->routing->proxy_domain)) { \
|
for (const auto &line: SplitLinesSkipSharp(dataStore->routing->proxy_domain)) { \
|
||||||
if (dataStore->dns_routing) status->domainListDNSRemote += line; \
|
if (dataStore->routing->dns_routing) status->domainListDNSRemote += line; \
|
||||||
status->domainListRemote += line; \
|
status->domainListRemote += line; \
|
||||||
} \
|
} \
|
||||||
for (const auto &line: SplitLinesSkipSharp(dataStore->routing->direct_domain)) { \
|
for (const auto &line: SplitLinesSkipSharp(dataStore->routing->direct_domain)) { \
|
||||||
if (dataStore->dns_routing) status->domainListDNSDirect += line; \
|
if (dataStore->routing->dns_routing) status->domainListDNSDirect += line; \
|
||||||
status->domainListDirect += line; \
|
status->domainListDirect += line; \
|
||||||
} \
|
} \
|
||||||
for (const auto &line: SplitLinesSkipSharp(dataStore->routing->block_domain)) { \
|
for (const auto &line: SplitLinesSkipSharp(dataStore->routing->block_domain)) { \
|
||||||
@@ -166,7 +166,7 @@ namespace NekoRay {
|
|||||||
: QJsonArray{"http", "tls", "quic"}},
|
: QJsonArray{"http", "tls", "quic"}},
|
||||||
{"enabled", true},
|
{"enabled", true},
|
||||||
{"metadataOnly", false},
|
{"metadataOnly", false},
|
||||||
{"routeOnly", dataStore->sniffing_mode == SniffingMode::FOR_ROUTING},
|
{"routeOnly", dataStore->routing->sniffing_mode == SniffingMode::FOR_ROUTING},
|
||||||
};
|
};
|
||||||
|
|
||||||
// socks-in
|
// socks-in
|
||||||
@@ -177,7 +177,7 @@ namespace NekoRay {
|
|||||||
inboundObj["listen"] = dataStore->inbound_address;
|
inboundObj["listen"] = dataStore->inbound_address;
|
||||||
inboundObj["port"] = dataStore->inbound_socks_port;
|
inboundObj["port"] = dataStore->inbound_socks_port;
|
||||||
QJsonObject socksSettings = {{"udp", true}};
|
QJsonObject socksSettings = {{"udp", true}};
|
||||||
if (dataStore->fake_dns || dataStore->sniffing_mode != SniffingMode::DISABLE) {
|
if (dataStore->fake_dns || dataStore->routing->sniffing_mode != SniffingMode::DISABLE) {
|
||||||
inboundObj["sniffing"] = sniffing;
|
inboundObj["sniffing"] = sniffing;
|
||||||
}
|
}
|
||||||
if (dataStore->inbound_auth->NeedAuth()) {
|
if (dataStore->inbound_auth->NeedAuth()) {
|
||||||
@@ -199,7 +199,7 @@ namespace NekoRay {
|
|||||||
inboundObj["protocol"] = "http";
|
inboundObj["protocol"] = "http";
|
||||||
inboundObj["listen"] = dataStore->inbound_address;
|
inboundObj["listen"] = dataStore->inbound_address;
|
||||||
inboundObj["port"] = dataStore->inbound_http_port;
|
inboundObj["port"] = dataStore->inbound_http_port;
|
||||||
if (dataStore->sniffing_mode != SniffingMode::DISABLE) {
|
if (dataStore->routing->sniffing_mode != SniffingMode::DISABLE) {
|
||||||
inboundObj["sniffing"] = sniffing;
|
inboundObj["sniffing"] = sniffing;
|
||||||
}
|
}
|
||||||
if (dataStore->inbound_auth->NeedAuth()) {
|
if (dataStore->inbound_auth->NeedAuth()) {
|
||||||
@@ -274,13 +274,13 @@ namespace NekoRay {
|
|||||||
|
|
||||||
// Remote or FakeDNS
|
// Remote or FakeDNS
|
||||||
QJsonObject dnsServerRemote;
|
QJsonObject dnsServerRemote;
|
||||||
dnsServerRemote["address"] = dataStore->fake_dns ? "fakedns" : dataStore->remote_dns;
|
dnsServerRemote["address"] = dataStore->fake_dns ? "fakedns" : dataStore->routing->remote_dns;
|
||||||
dnsServerRemote["domains"] = QList2QJsonArray<QString>(status->domainListDNSRemote);
|
dnsServerRemote["domains"] = QList2QJsonArray<QString>(status->domainListDNSRemote);
|
||||||
dnsServerRemote["queryStrategy"] = dataStore->remote_dns_strategy;
|
dnsServerRemote["queryStrategy"] = dataStore->routing->remote_dns_strategy;
|
||||||
if (!status->forTest) dnsServers += dnsServerRemote;
|
if (!status->forTest) dnsServers += dnsServerRemote;
|
||||||
|
|
||||||
// Direct
|
// Direct
|
||||||
auto directDnsAddress = dataStore->direct_dns;
|
auto directDnsAddress = dataStore->routing->direct_dns;
|
||||||
if (directDnsAddress.contains("://")) {
|
if (directDnsAddress.contains("://")) {
|
||||||
auto directDnsIp = SubStrBefore(SubStrAfter(directDnsAddress, "://"), "/");
|
auto directDnsIp = SubStrBefore(SubStrAfter(directDnsAddress, "://"), "/");
|
||||||
if (IsIpAddress(directDnsIp)) {
|
if (IsIpAddress(directDnsIp)) {
|
||||||
@@ -306,18 +306,22 @@ namespace NekoRay {
|
|||||||
dnsServers += QJsonObject{
|
dnsServers += QJsonObject{
|
||||||
{"address", directDnsAddress.replace("https://", "https+local://")},
|
{"address", directDnsAddress.replace("https://", "https+local://")},
|
||||||
{"fallbackStrategy", "disabled"},
|
{"fallbackStrategy", "disabled"},
|
||||||
{"queryStrategy", dataStore->direct_dns_strategy},
|
{"queryStrategy", dataStore->routing->direct_dns_strategy},
|
||||||
{"domains", QList2QJsonArray<QString>(status->domainListDNSDirect)},
|
{"domains", QList2QJsonArray<QString>(status->domainListDNSDirect)},
|
||||||
};
|
};
|
||||||
|
|
||||||
dns["fallbackStrategy"] = "disabled_if_any_match";
|
dns["fallbackStrategy"] = "disabled_if_any_match";
|
||||||
dns["servers"] = dnsServers;
|
dns["servers"] = dnsServers;
|
||||||
dns["tag"] = "dns";
|
dns["tag"] = "dns";
|
||||||
|
|
||||||
|
if (dataStore->routing->use_dns_object) {
|
||||||
|
dns = QString2QJsonObject(dataStore->routing->dns_object);
|
||||||
|
}
|
||||||
status->result->coreConfig.insert("dns", dns);
|
status->result->coreConfig.insert("dns", dns);
|
||||||
|
|
||||||
// Routing
|
// Routing
|
||||||
QJsonObject routing;
|
QJsonObject routing;
|
||||||
routing["domainStrategy"] = dataStore->domain_strategy;
|
routing["domainStrategy"] = dataStore->routing->domain_strategy;
|
||||||
routing["domainMatcher"] = "mph";
|
routing["domainMatcher"] = "mph";
|
||||||
if (status->forTest) routing["domainStrategy"] = "AsIs";
|
if (status->forTest) routing["domainStrategy"] = "AsIs";
|
||||||
|
|
||||||
@@ -627,7 +631,7 @@ namespace NekoRay {
|
|||||||
// common
|
// common
|
||||||
if (IS_NEKO_BOX) {
|
if (IS_NEKO_BOX) {
|
||||||
// apply domain_strategy
|
// apply domain_strategy
|
||||||
outbound["domain_strategy"] = dataStore->outbound_domain_strategy;
|
outbound["domain_strategy"] = dataStore->routing->outbound_domain_strategy;
|
||||||
// apply mux
|
// apply mux
|
||||||
if (!muxApplied && needMux) {
|
if (!muxApplied && needMux) {
|
||||||
auto muxObj = QJsonObject{
|
auto muxObj = QJsonObject{
|
||||||
@@ -640,7 +644,7 @@ namespace NekoRay {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// apply domain_strategy
|
// apply domain_strategy
|
||||||
if (!status->forTest) outbound["domainStrategy"] = dataStore->outbound_domain_strategy;
|
if (!status->forTest) outbound["domainStrategy"] = dataStore->routing->outbound_domain_strategy;
|
||||||
// apply mux
|
// apply mux
|
||||||
if (!muxApplied && needMux) {
|
if (!muxApplied && needMux) {
|
||||||
auto muxObj = QJsonObject{
|
auto muxObj = QJsonObject{
|
||||||
@@ -695,9 +699,9 @@ namespace NekoRay {
|
|||||||
inboundObj["type"] = "mixed";
|
inboundObj["type"] = "mixed";
|
||||||
inboundObj["listen"] = dataStore->inbound_address;
|
inboundObj["listen"] = dataStore->inbound_address;
|
||||||
inboundObj["listen_port"] = dataStore->inbound_socks_port;
|
inboundObj["listen_port"] = dataStore->inbound_socks_port;
|
||||||
if (dataStore->sniffing_mode != SniffingMode::DISABLE) {
|
if (dataStore->routing->sniffing_mode != SniffingMode::DISABLE) {
|
||||||
inboundObj["sniff"] = true;
|
inboundObj["sniff"] = true;
|
||||||
inboundObj["sniff_override_destination"] = dataStore->sniffing_mode == SniffingMode::FOR_DESTINATION;
|
inboundObj["sniff_override_destination"] = dataStore->routing->sniffing_mode == SniffingMode::FOR_DESTINATION;
|
||||||
}
|
}
|
||||||
if (dataStore->inbound_auth->NeedAuth()) {
|
if (dataStore->inbound_auth->NeedAuth()) {
|
||||||
inboundObj["users"] = QJsonArray{
|
inboundObj["users"] = QJsonArray{
|
||||||
@@ -707,7 +711,7 @@ namespace NekoRay {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
inboundObj["domain_strategy"] = dataStore->domain_strategy;
|
inboundObj["domain_strategy"] = dataStore->routing->domain_strategy;
|
||||||
status->inbounds += inboundObj;
|
status->inbounds += inboundObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -724,11 +728,11 @@ namespace NekoRay {
|
|||||||
inboundObj["strict_route"] = dataStore->vpn_strict_route;
|
inboundObj["strict_route"] = dataStore->vpn_strict_route;
|
||||||
inboundObj["inet4_address"] = "172.19.0.1/28";
|
inboundObj["inet4_address"] = "172.19.0.1/28";
|
||||||
if (dataStore->vpn_ipv6) inboundObj["inet4_address"] = "fdfe:dcba:9876::1/126";
|
if (dataStore->vpn_ipv6) inboundObj["inet4_address"] = "fdfe:dcba:9876::1/126";
|
||||||
if (dataStore->sniffing_mode != SniffingMode::DISABLE) {
|
if (dataStore->routing->sniffing_mode != SniffingMode::DISABLE) {
|
||||||
inboundObj["sniff"] = true;
|
inboundObj["sniff"] = true;
|
||||||
inboundObj["sniff_override_destination"] = dataStore->sniffing_mode == SniffingMode::FOR_DESTINATION;
|
inboundObj["sniff_override_destination"] = dataStore->routing->sniffing_mode == SniffingMode::FOR_DESTINATION;
|
||||||
}
|
}
|
||||||
inboundObj["domain_strategy"] = dataStore->domain_strategy;
|
inboundObj["domain_strategy"] = dataStore->routing->domain_strategy;
|
||||||
status->inbounds += inboundObj;
|
status->inbounds += inboundObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -831,19 +835,19 @@ namespace NekoRay {
|
|||||||
dnsServers += QJsonObject{
|
dnsServers += QJsonObject{
|
||||||
{"tag", "dns-remote"},
|
{"tag", "dns-remote"},
|
||||||
{"address_resolver", "dns-local"},
|
{"address_resolver", "dns-local"},
|
||||||
{"strategy", dataStore->remote_dns_strategy},
|
{"strategy", dataStore->routing->remote_dns_strategy},
|
||||||
{"address", dataStore->remote_dns},
|
{"address", dataStore->routing->remote_dns},
|
||||||
{"detour", tagProxy},
|
{"detour", tagProxy},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Direct
|
// Direct
|
||||||
auto directDNSAddress = dataStore->direct_dns;
|
auto directDNSAddress = dataStore->routing->direct_dns;
|
||||||
if (directDNSAddress == "localhost") directDNSAddress = BOX_UNDERLYING_DNS_EXPORT;
|
if (directDNSAddress == "localhost") directDNSAddress = BOX_UNDERLYING_DNS_EXPORT;
|
||||||
if (!status->forTest)
|
if (!status->forTest)
|
||||||
dnsServers += QJsonObject{
|
dnsServers += QJsonObject{
|
||||||
{"tag", "dns-direct"},
|
{"tag", "dns-direct"},
|
||||||
{"address_resolver", "dns-local"},
|
{"address_resolver", "dns-local"},
|
||||||
{"strategy", dataStore->direct_dns_strategy},
|
{"strategy", dataStore->routing->direct_dns_strategy},
|
||||||
{"address", directDNSAddress.replace("+local://", "://")},
|
{"address", directDNSAddress.replace("+local://", "://")},
|
||||||
{"detour", "direct"},
|
{"detour", "direct"},
|
||||||
};
|
};
|
||||||
@@ -868,6 +872,10 @@ namespace NekoRay {
|
|||||||
|
|
||||||
dns["servers"] = dnsServers;
|
dns["servers"] = dnsServers;
|
||||||
dns["rules"] = dnsRules;
|
dns["rules"] = dnsRules;
|
||||||
|
|
||||||
|
if (dataStore->routing->use_dns_object) {
|
||||||
|
dns = QString2QJsonObject(dataStore->routing->dns_object);
|
||||||
|
}
|
||||||
status->result->coreConfig.insert("dns", dns);
|
status->result->coreConfig.insert("dns", dns);
|
||||||
|
|
||||||
// Routing
|
// Routing
|
||||||
|
|||||||
@@ -32,17 +32,9 @@ namespace NekoRay {
|
|||||||
_add(new configItem("inbound_socks_port", &inbound_socks_port, itemType::integer));
|
_add(new configItem("inbound_socks_port", &inbound_socks_port, itemType::integer));
|
||||||
_add(new configItem("inbound_http_port", &inbound_http_port, itemType::integer));
|
_add(new configItem("inbound_http_port", &inbound_http_port, itemType::integer));
|
||||||
_add(new configItem("log_level", &log_level, itemType::string));
|
_add(new configItem("log_level", &log_level, itemType::string));
|
||||||
_add(new configItem("remote_dns", &remote_dns, itemType::string));
|
|
||||||
_add(new configItem("remote_dns_strategy", &remote_dns_strategy, itemType::string));
|
|
||||||
_add(new configItem("direct_dns", &direct_dns, itemType::string));
|
|
||||||
_add(new configItem("direct_dns_strategy", &direct_dns_strategy, itemType::string));
|
|
||||||
_add(new configItem("domain_strategy", &domain_strategy, itemType::string));
|
|
||||||
_add(new configItem("outbound_domain_strategy", &outbound_domain_strategy, itemType::string));
|
|
||||||
_add(new configItem("sniffing_mode", &sniffing_mode, itemType::integer));
|
|
||||||
_add(new configItem("mux_protocol", &mux_protocol, itemType::string));
|
_add(new configItem("mux_protocol", &mux_protocol, itemType::string));
|
||||||
_add(new configItem("mux_concurrency", &mux_concurrency, itemType::integer));
|
_add(new configItem("mux_concurrency", &mux_concurrency, itemType::integer));
|
||||||
_add(new configItem("traffic_loop_interval", &traffic_loop_interval, itemType::integer));
|
_add(new configItem("traffic_loop_interval", &traffic_loop_interval, itemType::integer));
|
||||||
_add(new configItem("dns_routing", &dns_routing, itemType::boolean));
|
|
||||||
_add(new configItem("test_concurrent", &test_concurrent, itemType::integer));
|
_add(new configItem("test_concurrent", &test_concurrent, itemType::integer));
|
||||||
_add(new configItem("theme", &theme, itemType::string));
|
_add(new configItem("theme", &theme, itemType::string));
|
||||||
_add(new configItem("custom_inbound", &custom_inbound, itemType::string));
|
_add(new configItem("custom_inbound", &custom_inbound, itemType::string));
|
||||||
@@ -127,16 +119,29 @@ namespace NekoRay {
|
|||||||
_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("def_outbound", &this->def_outbound, itemType::string));
|
||||||
_add(new configItem("custom", &this->custom, itemType::string));
|
_add(new configItem("custom", &this->custom, itemType::string));
|
||||||
|
//
|
||||||
|
_add(new configItem("remote_dns", &this->remote_dns, itemType::string));
|
||||||
|
_add(new configItem("remote_dns_strategy", &this->remote_dns_strategy, itemType::string));
|
||||||
|
_add(new configItem("direct_dns", &this->direct_dns, itemType::string));
|
||||||
|
_add(new configItem("direct_dns_strategy", &this->direct_dns_strategy, itemType::string));
|
||||||
|
_add(new configItem("domain_strategy", &this->domain_strategy, itemType::string));
|
||||||
|
_add(new configItem("outbound_domain_strategy", &this->outbound_domain_strategy, itemType::string));
|
||||||
|
_add(new configItem("dns_routing", &this->dns_routing, itemType::boolean));
|
||||||
|
_add(new configItem("sniffing_mode", &this->sniffing_mode, itemType::integer));
|
||||||
|
_add(new configItem("use_dns_object", &this->use_dns_object, itemType::boolean));
|
||||||
|
_add(new configItem("dns_object", &this->dns_object, itemType::string));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Routing::DisplayRouting() const {
|
QString Routing::DisplayRouting() const {
|
||||||
return QString("[Proxy] %1\n[Proxy] %2\n[Direct] %3\n[Direct] %4\n[Block] %5\n[Block] %6")
|
return QString("[Proxy] %1\n[Proxy] %2\n[Direct] %3\n[Direct] %4\n[Block] %5\n[Block] %6\n[Default Outbound] %7\n[DNS] %8")
|
||||||
.arg(SplitLinesSkipSharp(proxy_domain).join(","))
|
.arg(SplitLinesSkipSharp(proxy_domain).join(","))
|
||||||
.arg(SplitLinesSkipSharp(proxy_ip).join(","))
|
.arg(SplitLinesSkipSharp(proxy_ip).join(","))
|
||||||
.arg(SplitLinesSkipSharp(direct_domain).join(","))
|
.arg(SplitLinesSkipSharp(direct_domain).join(","))
|
||||||
.arg(SplitLinesSkipSharp(direct_ip).join(","))
|
.arg(SplitLinesSkipSharp(direct_ip).join(","))
|
||||||
.arg(SplitLinesSkipSharp(block_domain).join(","))
|
.arg(SplitLinesSkipSharp(block_domain).join(","))
|
||||||
.arg(SplitLinesSkipSharp(block_ip).join(","));
|
.arg(SplitLinesSkipSharp(block_ip).join(","))
|
||||||
|
.arg(def_outbound)
|
||||||
|
.arg(use_dns_object ? "DNS Object" : "Simple DNS");
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Routing::List() {
|
QStringList Routing::List() {
|
||||||
|
|||||||
@@ -13,6 +13,20 @@ namespace NekoRay {
|
|||||||
QString def_outbound = "proxy";
|
QString def_outbound = "proxy";
|
||||||
QString custom = "{\"rules\": []}";
|
QString custom = "{\"rules\": []}";
|
||||||
|
|
||||||
|
// DNS
|
||||||
|
QString remote_dns = "https://8.8.8.8/dns-query";
|
||||||
|
QString remote_dns_strategy = "";
|
||||||
|
QString direct_dns = "localhost";
|
||||||
|
QString direct_dns_strategy = "";
|
||||||
|
bool dns_routing = true;
|
||||||
|
bool use_dns_object = false;
|
||||||
|
QString dns_object = "";
|
||||||
|
|
||||||
|
// Misc
|
||||||
|
QString domain_strategy = "AsIs";
|
||||||
|
QString outbound_domain_strategy = "AsIs";
|
||||||
|
int sniffing_mode = SniffingMode::FOR_ROUTING;
|
||||||
|
|
||||||
explicit Routing(int preset = 0);
|
explicit Routing(int preset = 0);
|
||||||
|
|
||||||
[[nodiscard]] QString DisplayRouting() const;
|
[[nodiscard]] QString DisplayRouting() const;
|
||||||
@@ -118,22 +132,12 @@ namespace NekoRay {
|
|||||||
InboundAuthorization *inbound_auth = new InboundAuthorization;
|
InboundAuthorization *inbound_auth = new InboundAuthorization;
|
||||||
QString custom_inbound = "{\"inbounds\": []}";
|
QString custom_inbound = "{\"inbounds\": []}";
|
||||||
|
|
||||||
// DNS
|
|
||||||
QString remote_dns = "https://8.8.8.8/dns-query";
|
|
||||||
QString remote_dns_strategy = "";
|
|
||||||
QString direct_dns = "localhost";
|
|
||||||
QString direct_dns_strategy = "";
|
|
||||||
bool dns_routing = true;
|
|
||||||
|
|
||||||
// Routing
|
// Routing
|
||||||
bool fake_dns = false;
|
|
||||||
QString domain_strategy = "AsIs";
|
|
||||||
QString outbound_domain_strategy = "AsIs";
|
|
||||||
int sniffing_mode = SniffingMode::FOR_ROUTING;
|
|
||||||
QString custom_route_global = "{\"rules\": []}";
|
QString custom_route_global = "{\"rules\": []}";
|
||||||
QString active_routing = "Default";
|
QString active_routing = "Default";
|
||||||
|
|
||||||
// VPN
|
// VPN
|
||||||
|
bool fake_dns = false;
|
||||||
bool vpn_internal_tun = true;
|
bool vpn_internal_tun = true;
|
||||||
int vpn_implementation = 0;
|
int vpn_implementation = 0;
|
||||||
int vpn_mtu = 9000;
|
int vpn_mtu = 9000;
|
||||||
|
|||||||
@@ -527,14 +527,6 @@ These settings can be changed later.</source>
|
|||||||
<source>Preset</source>
|
<source>Preset</source>
|
||||||
<translation>پیشفرض</translation>
|
<translation>پیشفرض</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Custom</source>
|
|
||||||
<translation>سفارشی</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Custom (global)</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Mange route set</source>
|
<source>Mange route set</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
@@ -579,14 +571,6 @@ These settings can be changed later.</source>
|
|||||||
<source>Default Outbound</source>
|
<source>Default Outbound</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Remote</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>DNS Query Strategy</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Domain Strategy</source>
|
<source>Domain Strategy</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
@@ -603,6 +587,58 @@ These settings can be changed later.</source>
|
|||||||
<source>Sniff result for destination</source>
|
<source>Sniff result for destination</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Common</source>
|
||||||
|
<translation type="unfinished">متداول</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>DNS</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Simple DNS Settings</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Use DNS Object</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>DNS Object Settings</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Simple Route</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Custom Route</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Custom Route (global)</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Note: Other settings are independent for each route set.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Route sets</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Query Strategy</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Document</source>
|
||||||
|
<translation type="unfinished">اسناد</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Format</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>DialogVPNSettings</name>
|
<name>DialogVPNSettings</name>
|
||||||
|
|||||||
@@ -541,10 +541,6 @@ These settings can be changed later.</source>
|
|||||||
<source>IP</source>
|
<source>IP</source>
|
||||||
<translation></translation>
|
<translation></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Custom</source>
|
|
||||||
<translation>自定义</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Save</source>
|
<source>Save</source>
|
||||||
<translation>保存</translation>
|
<translation>保存</translation>
|
||||||
@@ -577,22 +573,10 @@ These settings can be changed later.</source>
|
|||||||
<source>Mange route set</source>
|
<source>Mange route set</source>
|
||||||
<translation>管理路由规则</translation>
|
<translation>管理路由规则</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Custom (global)</source>
|
|
||||||
<translation>自定义 (全局)</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Default Outbound</source>
|
<source>Default Outbound</source>
|
||||||
<translation>默认出站</translation>
|
<translation>默认出站</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Remote</source>
|
|
||||||
<translation>远程</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>DNS Query Strategy</source>
|
|
||||||
<translation>DNS 查询策略</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Domain Strategy</source>
|
<source>Domain Strategy</source>
|
||||||
<translation>域名策略</translation>
|
<translation>域名策略</translation>
|
||||||
@@ -601,6 +585,58 @@ These settings can be changed later.</source>
|
|||||||
<source>Server Address Strategy</source>
|
<source>Server Address Strategy</source>
|
||||||
<translation>服务器地址策略</translation>
|
<translation>服务器地址策略</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Common</source>
|
||||||
|
<translation>通用</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>DNS</source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Simple DNS Settings</source>
|
||||||
|
<translation>简易 DNS 设置</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Use DNS Object</source>
|
||||||
|
<translation>使用 DNS Object</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>DNS Object Settings</source>
|
||||||
|
<translation>DNS Object 设置</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Simple Route</source>
|
||||||
|
<translation>简易路由</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Custom Route</source>
|
||||||
|
<translation>自定义路由</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Custom Route (global)</source>
|
||||||
|
<translation>自定义路由(全局)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Note: Other settings are independent for each route set.</source>
|
||||||
|
<translation>注意:其他设置对于每个路由集都是独立的。</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Route sets</source>
|
||||||
|
<translation>路由集</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Query Strategy</source>
|
||||||
|
<translation>查询策略</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Document</source>
|
||||||
|
<translation>文档</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Format</source>
|
||||||
|
<translation>格式化</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>DialogVPNSettings</name>
|
<name>DialogVPNSettings</name>
|
||||||
|
|||||||
@@ -12,40 +12,51 @@
|
|||||||
|
|
||||||
#define REFRESH_ACTIVE_ROUTING(name, obj) \
|
#define REFRESH_ACTIVE_ROUTING(name, obj) \
|
||||||
this->active_routing = name; \
|
this->active_routing = name; \
|
||||||
ui->active_routing->setText(name); \
|
|
||||||
setWindowTitle(title_base + " [" + name + "]"); \
|
setWindowTitle(title_base + " [" + name + "]"); \
|
||||||
SetRouteConfig(*obj);
|
UpdateDisplayRouting(obj, false);
|
||||||
|
|
||||||
#define SAVE_TO_ROUTING(r) \
|
|
||||||
r->direct_ip = directIPTxt->toPlainText(); \
|
|
||||||
r->direct_domain = directDomainTxt->toPlainText(); \
|
|
||||||
r->proxy_ip = proxyIPTxt->toPlainText(); \
|
|
||||||
r->proxy_domain = proxyDomainTxt->toPlainText(); \
|
|
||||||
r->block_ip = blockIPTxt->toPlainText(); \
|
|
||||||
r->block_domain = blockDomainTxt->toPlainText(); \
|
|
||||||
r->def_outbound = ui->def_outbound->currentText(); \
|
|
||||||
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) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
title_base = windowTitle();
|
title_base = windowTitle();
|
||||||
|
|
||||||
|
QStringList qsValue = {""};
|
||||||
|
QString dnsHelpDocumentUrl;
|
||||||
if (IS_NEKO_BOX) {
|
if (IS_NEKO_BOX) {
|
||||||
ui->outbound_domain_strategy->addItems(Preset::SingBox::DomainStrategy);
|
ui->outbound_domain_strategy->addItems(Preset::SingBox::DomainStrategy);
|
||||||
ui->domainStrategyCombo->addItems(Preset::SingBox::DomainStrategy);
|
ui->domainStrategyCombo->addItems(Preset::SingBox::DomainStrategy);
|
||||||
|
qsValue += QString("prefer_ipv4 prefer_ipv6 ipv4_only ipv6_only").split(" ");
|
||||||
|
ui->dns_object->setPlaceholderText(DecodeB64IfValid("ewogICJzZXJ2ZXJzIjogW10sCiAgInJ1bGVzIjogW10sCiAgImZpbmFsIjogIiIsCiAgInN0cmF0ZWd5IjogIiIsCiAgImRpc2FibGVfY2FjaGUiOiBmYWxzZSwKICAiZGlzYWJsZV9leHBpcmUiOiBmYWxzZSwKICAiaW5kZXBlbmRlbnRfY2FjaGUiOiBmYWxzZSwKICAicmV2ZXJzZV9tYXBwaW5nIjogZmFsc2UsCiAgImZha2VpcCI6IHt9Cn0="));
|
||||||
|
dnsHelpDocumentUrl = "https://sing-box.sagernet.org/configuration/dns/";
|
||||||
} else {
|
} else {
|
||||||
ui->outbound_domain_strategy->addItems({"AsIs", "UseIPv4", "UseIPv6", "PreferIPv4", "PreferIPv6"});
|
ui->outbound_domain_strategy->addItems({"AsIs", "UseIPv4", "UseIPv6", "PreferIPv4", "PreferIPv6"});
|
||||||
ui->domainStrategyCombo->addItems({"AsIs", "IPIfNonMatch", "IPOnDemand"});
|
ui->domainStrategyCombo->addItems({"AsIs", "IPIfNonMatch", "IPOnDemand"});
|
||||||
|
qsValue += QString("use_ip use_ip4 use_ip6").split(" ");
|
||||||
|
ui->dns_object->setPlaceholderText(DecodeB64IfValid("ewogICJzZXJ2ZXJzIjogW10sCiAgInJ1bGVzIjogW10sCiAgImZpbmFsIjogIiIsCiAgInN0cmF0ZWd5IjogIiIsCiAgImRpc2FibGVfY2FjaGUiOiBmYWxzZSwKICAiZGlzYWJsZV9leHBpcmUiOiBmYWxzZSwKICAiaW5kZXBlbmRlbnRfY2FjaGUiOiBmYWxzZSwKICAicmV2ZXJzZV9tYXBwaW5nIjogZmFsc2UsCiAgImZha2VpcCI6IHt9Cn0="));
|
||||||
|
dnsHelpDocumentUrl = "https://www.v2fly.org/config/dns.html";
|
||||||
}
|
}
|
||||||
|
ui->direct_dns_strategy->addItems(qsValue);
|
||||||
|
ui->remote_dns_strategy->addItems(qsValue);
|
||||||
//
|
//
|
||||||
ui->sniffing_mode->setCurrentIndex(NekoRay::dataStore->sniffing_mode);
|
|
||||||
ui->outbound_domain_strategy->setCurrentText(NekoRay::dataStore->outbound_domain_strategy);
|
|
||||||
ui->domainStrategyCombo->setCurrentText(NekoRay::dataStore->domain_strategy);
|
|
||||||
ui->dns_routing->setChecked(NekoRay::dataStore->dns_routing);
|
|
||||||
ui->dns_remote->setText(NekoRay::dataStore->remote_dns);
|
|
||||||
ui->dns_direct->setText(NekoRay::dataStore->direct_dns);
|
|
||||||
D_C_LOAD_STRING(custom_route_global)
|
D_C_LOAD_STRING(custom_route_global)
|
||||||
//
|
//
|
||||||
|
connect(ui->use_dns_object, &QCheckBox::stateChanged, this, [=](int state) {
|
||||||
|
auto useDNSObject = state == Qt::Checked;
|
||||||
|
ui->simple_dns_box->setDisabled(useDNSObject);
|
||||||
|
ui->dns_object->setDisabled(!useDNSObject);
|
||||||
|
});
|
||||||
|
ui->use_dns_object->stateChanged(Qt::Unchecked); // uncheck to uncheck
|
||||||
|
connect(ui->dns_document, &QPushButton::clicked, this, [=] {
|
||||||
|
MessageBoxInfo("DNS", dnsHelpDocumentUrl);
|
||||||
|
});
|
||||||
|
connect(ui->format_dns_object, &QPushButton::clicked, this, [=] {
|
||||||
|
auto obj = QString2QJsonObject(ui->dns_object->toPlainText());
|
||||||
|
if (obj.isEmpty()) {
|
||||||
|
MessageBoxInfo("DNS", "invaild json");
|
||||||
|
} else {
|
||||||
|
ui->dns_object->setPlainText(QJsonObject2QString(obj, false));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//
|
||||||
connect(ui->custom_route_edit, &QPushButton::clicked, this, [=] {
|
connect(ui->custom_route_edit, &QPushButton::clicked, this, [=] {
|
||||||
C_EDIT_JSON_ALLOW_EMPTY(custom_route)
|
C_EDIT_JSON_ALLOW_EMPTY(custom_route)
|
||||||
});
|
});
|
||||||
@@ -88,16 +99,10 @@ DialogManageRoutes::~DialogManageRoutes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DialogManageRoutes::accept() {
|
void DialogManageRoutes::accept() {
|
||||||
NekoRay::dataStore->sniffing_mode = ui->sniffing_mode->currentIndex();
|
|
||||||
NekoRay::dataStore->domain_strategy = ui->domainStrategyCombo->currentText();
|
|
||||||
NekoRay::dataStore->outbound_domain_strategy = ui->outbound_domain_strategy->currentText();
|
|
||||||
NekoRay::dataStore->dns_routing = ui->dns_routing->isChecked();
|
|
||||||
NekoRay::dataStore->remote_dns = ui->dns_remote->text();
|
|
||||||
NekoRay::dataStore->direct_dns = ui->dns_direct->text();
|
|
||||||
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;
|
||||||
SAVE_TO_ROUTING(NekoRay::dataStore->routing)
|
SaveDisplayRouting(NekoRay::dataStore->routing);
|
||||||
NekoRay::dataStore->active_routing = active_routing;
|
NekoRay::dataStore->active_routing = active_routing;
|
||||||
NekoRay::dataStore->routing->fn = ROUTES_PREFIX + NekoRay::dataStore->active_routing;
|
NekoRay::dataStore->routing->fn = ROUTES_PREFIX + NekoRay::dataStore->active_routing;
|
||||||
if (NekoRay::dataStore->routing->Save()) routeChanged = true;
|
if (NekoRay::dataStore->routing->Save()) routeChanged = true;
|
||||||
@@ -120,22 +125,57 @@ QList<QAction *> DialogManageRoutes::getBuiltInSchemes() {
|
|||||||
QAction *DialogManageRoutes::schemeToAction(const QString &name, const NekoRay::Routing &scheme) {
|
QAction *DialogManageRoutes::schemeToAction(const QString &name, const NekoRay::Routing &scheme) {
|
||||||
auto *action = new QAction(this);
|
auto *action = new QAction(this);
|
||||||
action->setText(name);
|
action->setText(name);
|
||||||
connect(action, &QAction::triggered, [this, &scheme] { this->SetRouteConfig(scheme); });
|
connect(action, &QAction::triggered, [this, &scheme] { this->UpdateDisplayRouting((NekoRay::Routing *) &scheme, true); });
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogManageRoutes::SetRouteConfig(const NekoRay::Routing &conf) {
|
void DialogManageRoutes::UpdateDisplayRouting(NekoRay::Routing *conf, bool qv) {
|
||||||
//
|
//
|
||||||
directDomainTxt->setPlainText(conf.direct_domain);
|
directDomainTxt->setPlainText(conf->direct_domain);
|
||||||
proxyDomainTxt->setPlainText(conf.proxy_domain);
|
proxyDomainTxt->setPlainText(conf->proxy_domain);
|
||||||
blockDomainTxt->setPlainText(conf.block_domain);
|
blockDomainTxt->setPlainText(conf->block_domain);
|
||||||
//
|
//
|
||||||
blockIPTxt->setPlainText(conf.block_ip);
|
blockIPTxt->setPlainText(conf->block_ip);
|
||||||
directIPTxt->setPlainText(conf.direct_ip);
|
directIPTxt->setPlainText(conf->direct_ip);
|
||||||
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);
|
ui->def_outbound->setCurrentText(conf->def_outbound);
|
||||||
|
//
|
||||||
|
if (qv) return;
|
||||||
|
//
|
||||||
|
ui->sniffing_mode->setCurrentIndex(conf->sniffing_mode);
|
||||||
|
ui->outbound_domain_strategy->setCurrentText(conf->outbound_domain_strategy);
|
||||||
|
ui->domainStrategyCombo->setCurrentText(conf->outbound_domain_strategy);
|
||||||
|
ui->use_dns_object->setChecked(conf->use_dns_object);
|
||||||
|
ui->dns_object->setPlainText(conf->dns_object);
|
||||||
|
ui->dns_routing->setChecked(conf->dns_routing);
|
||||||
|
ui->remote_dns->setText(conf->remote_dns);
|
||||||
|
ui->remote_dns_strategy->setCurrentText(conf->remote_dns_strategy);
|
||||||
|
ui->direct_dns->setText(conf->direct_dns);
|
||||||
|
ui->direct_dns_strategy->setCurrentText(conf->direct_dns_strategy);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogManageRoutes::SaveDisplayRouting(NekoRay::Routing *conf) {
|
||||||
|
conf->direct_ip = directIPTxt->toPlainText();
|
||||||
|
conf->direct_domain = directDomainTxt->toPlainText();
|
||||||
|
conf->proxy_ip = proxyIPTxt->toPlainText();
|
||||||
|
conf->proxy_domain = proxyDomainTxt->toPlainText();
|
||||||
|
conf->block_ip = blockIPTxt->toPlainText();
|
||||||
|
conf->block_domain = blockDomainTxt->toPlainText();
|
||||||
|
conf->def_outbound = ui->def_outbound->currentText();
|
||||||
|
conf->custom = CACHE.custom_route;
|
||||||
|
//
|
||||||
|
conf->sniffing_mode = ui->sniffing_mode->currentIndex();
|
||||||
|
conf->domain_strategy = ui->domainStrategyCombo->currentText();
|
||||||
|
conf->outbound_domain_strategy = ui->outbound_domain_strategy->currentText();
|
||||||
|
conf->use_dns_object = ui->use_dns_object->isChecked();
|
||||||
|
conf->dns_object = ui->dns_object->toPlainText();
|
||||||
|
conf->dns_routing = ui->dns_routing->isChecked();
|
||||||
|
conf->remote_dns = ui->remote_dns->text();
|
||||||
|
conf->remote_dns_strategy = ui->remote_dns_strategy->currentText();
|
||||||
|
conf->direct_dns = ui->direct_dns->text();
|
||||||
|
conf->direct_dns_strategy = ui->direct_dns_strategy->currentText();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogManageRoutes::on_load_save_clicked() {
|
void DialogManageRoutes::on_load_save_clicked() {
|
||||||
@@ -172,7 +212,7 @@ void DialogManageRoutes::on_load_save_clicked() {
|
|||||||
r->fn = ROUTES_PREFIX + fn;
|
r->fn = ROUTES_PREFIX + fn;
|
||||||
if (r->Load()) {
|
if (r->Load()) {
|
||||||
if (QMessageBox::question(nullptr, software_name, tr("Load routing: %1").arg(fn) + "\n" + r->DisplayRouting()) == QMessageBox::Yes) {
|
if (QMessageBox::question(nullptr, software_name, tr("Load routing: %1").arg(fn) + "\n" + r->DisplayRouting()) == QMessageBox::Yes) {
|
||||||
REFRESH_ACTIVE_ROUTING(fn, r)
|
REFRESH_ACTIVE_ROUTING(fn, r.get())
|
||||||
w->accept();
|
w->accept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -182,11 +222,11 @@ void DialogManageRoutes::on_load_save_clicked() {
|
|||||||
auto fn = lineEdit->text();
|
auto fn = lineEdit->text();
|
||||||
if (!fn.isEmpty()) {
|
if (!fn.isEmpty()) {
|
||||||
auto r = std::make_unique<NekoRay::Routing>();
|
auto r = std::make_unique<NekoRay::Routing>();
|
||||||
SAVE_TO_ROUTING(r)
|
SaveDisplayRouting(r.get());
|
||||||
r->fn = ROUTES_PREFIX + fn;
|
r->fn = ROUTES_PREFIX + fn;
|
||||||
if (QMessageBox::question(nullptr, software_name, tr("Save routing: %1").arg(fn) + "\n" + r->DisplayRouting()) == QMessageBox::Yes) {
|
if (QMessageBox::question(nullptr, software_name, tr("Save routing: %1").arg(fn) + "\n" + r->DisplayRouting()) == QMessageBox::Yes) {
|
||||||
r->Save();
|
r->Save();
|
||||||
REFRESH_ACTIVE_ROUTING(fn, r)
|
REFRESH_ACTIVE_ROUTING(fn, r.get())
|
||||||
w->accept();
|
w->accept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -213,46 +253,3 @@ void DialogManageRoutes::on_load_save_clicked() {
|
|||||||
w->exec();
|
w->exec();
|
||||||
w->deleteLater();
|
w->deleteLater();
|
||||||
}
|
}
|
||||||
void DialogManageRoutes::on_queryStrategy_clicked() {
|
|
||||||
auto w = new QDialog(this);
|
|
||||||
w->setWindowTitle("DNS Query Strategy");
|
|
||||||
auto layout = new QGridLayout;
|
|
||||||
w->setLayout(layout);
|
|
||||||
//
|
|
||||||
QStringList qsValue{""};
|
|
||||||
if (IS_NEKO_BOX) {
|
|
||||||
qsValue += QString("prefer_ipv4 prefer_ipv6 ipv4_only ipv6_only").split(" ");
|
|
||||||
} else {
|
|
||||||
qsValue += QString("use_ip use_ip4 use_ip6").split(" ");
|
|
||||||
}
|
|
||||||
//
|
|
||||||
auto remote_l = new QLabel(tr("Remote"));
|
|
||||||
auto direct_l = new QLabel(tr("Direct"));
|
|
||||||
auto remote = new QComboBox;
|
|
||||||
auto direct = new QComboBox;
|
|
||||||
remote->setEditable(true);
|
|
||||||
remote->addItems(qsValue);
|
|
||||||
remote->setCurrentText(NekoRay::dataStore->remote_dns_strategy);
|
|
||||||
direct->setEditable(true);
|
|
||||||
direct->addItems(qsValue);
|
|
||||||
direct->setCurrentText(NekoRay::dataStore->direct_dns_strategy);
|
|
||||||
//
|
|
||||||
layout->addWidget(remote_l, 0, 0);
|
|
||||||
layout->addWidget(remote, 0, 1);
|
|
||||||
layout->addWidget(direct_l, 1, 0);
|
|
||||||
layout->addWidget(direct, 1, 1);
|
|
||||||
auto box = new QDialogButtonBox;
|
|
||||||
box->setOrientation(Qt::Horizontal);
|
|
||||||
box->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
|
|
||||||
connect(box, &QDialogButtonBox::accepted, w, [=] {
|
|
||||||
NekoRay::dataStore->remote_dns_strategy = remote->currentText();
|
|
||||||
NekoRay::dataStore->direct_dns_strategy = direct->currentText();
|
|
||||||
NekoRay::dataStore->Save();
|
|
||||||
w->accept();
|
|
||||||
});
|
|
||||||
connect(box, &QDialogButtonBox::rejected, w, &QDialog::reject);
|
|
||||||
layout->addWidget(box, 2, 1);
|
|
||||||
//
|
|
||||||
w->exec();
|
|
||||||
w->deleteLater();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -51,9 +51,9 @@ public slots:
|
|||||||
|
|
||||||
QAction *schemeToAction(const QString &name, const NekoRay::Routing &scheme);
|
QAction *schemeToAction(const QString &name, const NekoRay::Routing &scheme);
|
||||||
|
|
||||||
void SetRouteConfig(const NekoRay::Routing &conf);
|
void UpdateDisplayRouting(NekoRay::Routing *conf, bool qv);
|
||||||
|
|
||||||
|
void SaveDisplayRouting(NekoRay::Routing *conf);
|
||||||
|
|
||||||
void on_load_save_clicked();
|
void on_load_save_clicked();
|
||||||
|
|
||||||
void on_queryStrategy_clicked();
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,364 +15,458 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gb1">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<property name="currentIndex">
|
||||||
<item>
|
<number>0</number>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
</property>
|
||||||
<item>
|
<widget class="QWidget" name="tab">
|
||||||
<widget class="QLabel" name="label">
|
<attribute name="title">
|
||||||
<property name="text">
|
<string>Common</string>
|
||||||
<string>Sniffing Mode</string>
|
</attribute>
|
||||||
</property>
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
</widget>
|
<item>
|
||||||
</item>
|
<widget class="QWidget" name="widget" native="true">
|
||||||
<item>
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<widget class="QComboBox" name="sniffing_mode">
|
<item row="4" column="1">
|
||||||
<item>
|
<spacer name="verticalSpacer">
|
||||||
<property name="text">
|
<property name="orientation">
|
||||||
<string>Disable</string>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="5" column="1">
|
||||||
<property name="text">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<string>Sniff result for routing</string>
|
<property name="title">
|
||||||
</property>
|
<string>Route sets</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
|
<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 Route (global)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Note: Other settings are independent for each route set.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="2" column="0">
|
||||||
<property name="text">
|
<widget class="QLabel" name="label_6">
|
||||||
<string>Sniff result for destination</string>
|
<property name="toolTip">
|
||||||
</property>
|
<string notr="true">For V2Ray, it sets routing.domainStrategy
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string notr="true">For V2Ray, it sets routing.domainStrategy
|
|
||||||
For sing-box, it sets inbound.domain_strategy</string>
|
For sing-box, it sets inbound.domain_strategy</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Domain Strategy</string>
|
<string>Domain Strategy</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="3" column="1">
|
||||||
<widget class="QComboBox" name="domainStrategyCombo">
|
<widget class="QComboBox" name="outbound_domain_strategy">
|
||||||
<property name="editable">
|
<property name="editable">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="1">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QComboBox" name="sniffing_mode">
|
||||||
<property name="text">
|
<item>
|
||||||
<string>Server Address Strategy</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="outbound_domain_strategy">
|
|
||||||
<property name="editable">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</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>
|
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="dns_routing">
|
|
||||||
<property name="text">
|
|
||||||
<string>Enable DNS Routing</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="queryStrategy">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>DNS Query Strategy</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<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>
|
|
||||||
</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 name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="preset">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Preset</string>
|
<string>Disable</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="popupMode">
|
</item>
|
||||||
<enum>QToolButton::InstantPopup</enum>
|
<item>
|
||||||
</property>
|
|
||||||
<property name="toolButtonStyle">
|
|
||||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="custom_route_edit">
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Custom</string>
|
<string>Sniff result for routing</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</item>
|
||||||
</item>
|
<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="QLabel" name="active_routing">
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::Box</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<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 name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Default Outbound</string>
|
<string>Sniff result for destination</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</item>
|
||||||
</item>
|
</widget>
|
||||||
<item>
|
</item>
|
||||||
<widget class="QComboBox" name="def_outbound">
|
<item row="1" column="0">
|
||||||
<item>
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Sniffing Mode</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Server Address Strategy</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QComboBox" name="domainStrategyCombo">
|
||||||
|
<property name="editable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_3">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>DNS</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="simple_dns_box">
|
||||||
|
<property name="title">
|
||||||
|
<string>Simple DNS Settings</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="text">
|
||||||
|
<string>Direct DNS</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="remote_dns"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_10">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string notr="true">proxy</string>
|
<string>Query Strategy</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="remote_dns_strategy"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_9">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remote DNS</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>widget</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="dns_routing">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string notr="true">bypass</string>
|
<string>Enable DNS Routing</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="direct_dns"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_11">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string notr="true">block</string>
|
<string>Query Strategy</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
</widget>
|
</item>
|
||||||
</item>
|
<item>
|
||||||
</layout>
|
<widget class="QComboBox" name="direct_dns_strategy"/>
|
||||||
</widget>
|
</item>
|
||||||
</item>
|
</layout>
|
||||||
</layout>
|
</item>
|
||||||
</item>
|
</layout>
|
||||||
</layout>
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>DNS Object Settings</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="use_dns_object">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use DNS Object</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="format_dns_object">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Format</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="dns_document">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Document</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPlainTextEdit" name="dns_object"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_2">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Simple Route</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
|
<item>
|
||||||
|
<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>
|
||||||
|
</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 name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<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 Route</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 name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<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>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<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>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -391,14 +485,24 @@ For sing-box, it sets inbound.domain_strategy</string>
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
|
<tabstop>tabWidget</tabstop>
|
||||||
<tabstop>sniffing_mode</tabstop>
|
<tabstop>sniffing_mode</tabstop>
|
||||||
<tabstop>dns_remote</tabstop>
|
<tabstop>domainStrategyCombo</tabstop>
|
||||||
<tabstop>dns_direct</tabstop>
|
<tabstop>outbound_domain_strategy</tabstop>
|
||||||
|
<tabstop>load_save</tabstop>
|
||||||
|
<tabstop>custom_route_global_edit</tabstop>
|
||||||
|
<tabstop>remote_dns</tabstop>
|
||||||
|
<tabstop>remote_dns_strategy</tabstop>
|
||||||
|
<tabstop>direct_dns</tabstop>
|
||||||
|
<tabstop>direct_dns_strategy</tabstop>
|
||||||
|
<tabstop>dns_routing</tabstop>
|
||||||
|
<tabstop>use_dns_object</tabstop>
|
||||||
|
<tabstop>format_dns_object</tabstop>
|
||||||
|
<tabstop>dns_document</tabstop>
|
||||||
|
<tabstop>dns_object</tabstop>
|
||||||
<tabstop>preset</tabstop>
|
<tabstop>preset</tabstop>
|
||||||
<tabstop>custom_route_edit</tabstop>
|
<tabstop>custom_route_edit</tabstop>
|
||||||
<tabstop>def_outbound</tabstop>
|
<tabstop>def_outbound</tabstop>
|
||||||
<tabstop>load_save</tabstop>
|
|
||||||
<tabstop>custom_route_global_edit</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
|
|||||||
@@ -95,8 +95,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||||||
software_core_name = "sing-box";
|
software_core_name = "sing-box";
|
||||||
// replace default values
|
// replace default values
|
||||||
if (NekoRay::dataStore->log_level == "warning") NekoRay::dataStore->log_level = "info";
|
if (NekoRay::dataStore->log_level == "warning") NekoRay::dataStore->log_level = "info";
|
||||||
if (!Preset::SingBox::DomainStrategy.contains(NekoRay::dataStore->domain_strategy)) NekoRay::dataStore->domain_strategy = "";
|
if (!Preset::SingBox::DomainStrategy.contains(NekoRay::dataStore->routing->domain_strategy)) NekoRay::dataStore->routing->domain_strategy = "";
|
||||||
if (!Preset::SingBox::DomainStrategy.contains(NekoRay::dataStore->outbound_domain_strategy)) NekoRay::dataStore->outbound_domain_strategy = "";
|
if (!Preset::SingBox::DomainStrategy.contains(NekoRay::dataStore->routing->outbound_domain_strategy)) NekoRay::dataStore->routing->outbound_domain_strategy = "";
|
||||||
//
|
//
|
||||||
if (QDir("dashboard").isEmpty()) {
|
if (QDir("dashboard").isEmpty()) {
|
||||||
QDir().mkdir("dashboard");
|
QDir().mkdir("dashboard");
|
||||||
|
|||||||
Reference in New Issue
Block a user