mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 20:44:38 +03:00
fix & improve sing-box final outbound
This commit is contained in:
@@ -812,12 +812,6 @@ namespace NekoRay {
|
||||
add_rule_route(status->domainListRemote, false, tagProxy);
|
||||
add_rule_route(status->domainListDirect, false, "bypass");
|
||||
|
||||
// def_outbound
|
||||
if (!status->forTest) status->routingRules += QJsonObject{
|
||||
{"port_range", ":"},
|
||||
{"outbound", dataStore->routing->def_outbound},
|
||||
};
|
||||
|
||||
// geopath
|
||||
auto geoip = FindCoreAsset("geoip.db");
|
||||
auto geosite = FindCoreAsset("geosite.db");
|
||||
@@ -844,6 +838,7 @@ namespace NekoRay {
|
||||
{"path", geosite},
|
||||
},
|
||||
}};
|
||||
if (!status->forTest) routeObj["final"] = dataStore->routing->def_outbound;
|
||||
if (status->forExport) {
|
||||
routeObj.remove("geoip");
|
||||
routeObj.remove("geosite");
|
||||
@@ -882,11 +877,6 @@ namespace NekoRay {
|
||||
{"ip_cidr", QList2QJsonArray(arr)}};
|
||||
cidr_rule = "," + QJsonObject2QString(rule, false);
|
||||
}
|
||||
// no_match_rule
|
||||
auto no_match_rule = QJsonObject{
|
||||
{"port_range", ":"},
|
||||
{"outbound", no_match_out},
|
||||
};
|
||||
// tun name
|
||||
auto tun_name = "nekoray-tun";
|
||||
#ifdef Q_OS_MACOS
|
||||
@@ -910,7 +900,7 @@ namespace NekoRay {
|
||||
.replace("%TUN_NAME%", tun_name)
|
||||
.replace("%STRICT_ROUTE%", dataStore->vpn_strict_route ? "true" : "false")
|
||||
.replace("%SOCKS_USER_PASS%", socks_user_pass)
|
||||
.replace("%NO_MATCH_RULE%", "," + QJsonObject2QString(no_match_rule, false))
|
||||
.replace("%FINAL_OUT%", no_match_out)
|
||||
.replace("%PORT%", Int2String(dataStore->inbound_socks_port));
|
||||
// hook.js
|
||||
auto source = qjs::ReadHookJS();
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
}
|
||||
],
|
||||
"route": {
|
||||
"final": "%FINAL_OUT%",
|
||||
"auto_detect_interface": true,
|
||||
"rules": [
|
||||
{
|
||||
@@ -95,7 +96,6 @@
|
||||
}
|
||||
%PROCESS_NAME_RULE%
|
||||
%CIDR_RULE%
|
||||
%NO_MATCH_RULE%
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1259,10 +1259,16 @@ void MainWindow::on_menu_remove_unavailable_triggered() {
|
||||
if (profile->latency < 0) out_del += profile;
|
||||
}
|
||||
|
||||
int remove_display_count = 0;
|
||||
QString remove_display;
|
||||
for (const auto &ent: out_del) {
|
||||
remove_display += ent->bean->DisplayTypeAndName() + "\n";
|
||||
if (++remove_display_count == 20) {
|
||||
remove_display += "...";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (out_del.length() > 0 &&
|
||||
QMessageBox::question(this, tr("Confirmation"), tr("Remove %1 item(s) ?").arg(out_del.length()) + "\n" + remove_display) == QMessageBox::StandardButton::Yes) {
|
||||
for (const auto &ent: out_del) {
|
||||
|
||||
Reference in New Issue
Block a user