mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2026-01-02 08:19:02 +08:00
feat: Add rdp sniffer &
Add process_path_regex route option & Optimize some visuals
This commit is contained in:
parent
3975c311ac
commit
eb369fc24f
@ -430,6 +430,7 @@ namespace NekoGui {
|
||||
_add(new configItem("port_range", &port_range, itemType::stringList));
|
||||
_add(new configItem("process_name", &process_name, itemType::stringList));
|
||||
_add(new configItem("process_path", &process_path, itemType::stringList));
|
||||
_add(new configItem("process_path_regex", &process_path, itemType::stringList));
|
||||
_add(new configItem("rule_set", &rule_set, itemType::stringList));
|
||||
_add(new configItem("invert", &invert, itemType::boolean));
|
||||
_add(new configItem("outboundID", &outboundID, itemType::integer));
|
||||
|
||||
@ -42,6 +42,7 @@ namespace NekoGui {
|
||||
port_range << other.port_range;
|
||||
process_name << other.process_name;
|
||||
process_path << other.process_path;
|
||||
process_path_regex << other.process_path_regex;
|
||||
rule_set << other.rule_set;
|
||||
invert = other.invert;
|
||||
outboundID = other.outboundID;
|
||||
@ -65,6 +66,7 @@ namespace NekoGui {
|
||||
_add(new configItem("port_range", &port_range, itemType::stringList));
|
||||
_add(new configItem("process_name", &process_name, itemType::stringList));
|
||||
_add(new configItem("process_path", &process_path, itemType::stringList));
|
||||
_add(new configItem("process_path_regex", &process_path_regex, itemType::stringList));
|
||||
_add(new configItem("rule_set", &rule_set, itemType::stringList));
|
||||
_add(new configItem("invert", &invert, itemType::boolean));
|
||||
_add(new configItem("outboundID", &outboundID, itemType::integer));
|
||||
@ -91,6 +93,7 @@ namespace NekoGui {
|
||||
if (isValidStrArray(port_range)) obj["port_range"] = get_as_array(port_range);
|
||||
if (isValidStrArray(process_name)) obj["process_name"] = get_as_array(process_name);
|
||||
if (isValidStrArray(process_path)) obj["process_path"] = get_as_array(process_path);
|
||||
if (isValidStrArray(process_path_regex)) obj["process_path_regex"] = get_as_array(process_path_regex);
|
||||
if (isValidStrArray(rule_set)) obj["rule_set"] = get_as_array(rule_set);
|
||||
if (invert) obj["invert"] = invert;
|
||||
|
||||
@ -145,6 +148,7 @@ namespace NekoGui {
|
||||
"port_range",
|
||||
"process_name",
|
||||
"process_path",
|
||||
"process_path_regex",
|
||||
"rule_set",
|
||||
"invert",
|
||||
};
|
||||
@ -200,6 +204,7 @@ namespace NekoGui {
|
||||
if (fieldName == "port_range") return port_range;
|
||||
if (fieldName == "process_name") return process_name;
|
||||
if (fieldName == "process_path") return process_path;
|
||||
if (fieldName == "process_path_regex") return process_path_regex;
|
||||
if (fieldName == "rule_set") return rule_set;
|
||||
return {};
|
||||
}
|
||||
@ -281,6 +286,9 @@ namespace NekoGui {
|
||||
if (fieldName == "process_path") {
|
||||
process_path = filterEmpty(value);
|
||||
}
|
||||
if (fieldName == "process_path_regex") {
|
||||
process_path_regex = filterEmpty(value);
|
||||
}
|
||||
if (fieldName == "rule_set") {
|
||||
rule_set = filterEmpty(value);
|
||||
}
|
||||
|
||||
@ -32,6 +32,7 @@ namespace NekoGui {
|
||||
QList<QString> port_range;
|
||||
QList<QString> process_name;
|
||||
QList<QString> process_path;
|
||||
QList<QString> process_path_regex;
|
||||
QList<QString> rule_set;
|
||||
bool invert = false;
|
||||
int outboundID = -2; // -1 is proxy -2 is direct -3 is block -4 is dns_out
|
||||
|
||||
@ -1,14 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
namespace Preset {
|
||||
namespace SingBox {
|
||||
inline QStringList VpnImplementation = {"mixed", "system", "gvisor"};
|
||||
inline QStringList DomainStrategy = {"", "ipv4_only", "ipv6_only", "prefer_ipv4", "prefer_ipv6"};
|
||||
inline QStringList UtlsFingerPrint = {"", "chrome", "firefox", "edge", "safari", "360", "qq", "ios", "android", "random", "randomized", "chrome_psk", "chrome_psk_shuffle", "chrome_padding_psk_shuffle", "chrome_pq", "chrome_pq_psk"};
|
||||
inline QStringList ShadowsocksMethods = {"2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305", "none", "aes-128-gcm", "aes-192-gcm", "aes-256-gcm", "chacha20-ietf-poly1305", "xchacha20-ietf-poly1305", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "rc4-md5", "chacha20-ietf", "xchacha20"};
|
||||
inline QStringList V2RAYTransports = {"http", "grpc", "quic", "httpupgrade", "ws", "tcp"};
|
||||
inline QStringList Flows = {"xtls-rprx-vision"};
|
||||
inline QStringList SniffProtocols = {"http", "tls", "quic", "stun", "dns", "bittorrent", "dtls", "ssh"};
|
||||
} // namespace SingBox
|
||||
|
||||
} // namespace Preset
|
||||
namespace Preset::SingBox {
|
||||
inline QStringList VpnImplementation = {"mixed", "system", "gvisor"};
|
||||
inline QStringList DomainStrategy = {"", "ipv4_only", "ipv6_only", "prefer_ipv4", "prefer_ipv6"};
|
||||
inline QStringList UtlsFingerPrint = {"", "chrome", "firefox", "edge", "safari", "360", "qq", "ios", "android", "random", "randomized"};
|
||||
inline QStringList ShadowsocksMethods = {"2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305", "none", "aes-128-gcm", "aes-192-gcm", "aes-256-gcm", "chacha20-ietf-poly1305", "xchacha20-ietf-poly1305", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "rc4-md5", "chacha20-ietf", "xchacha20"};
|
||||
inline QStringList V2RAYTransports = {"http", "grpc", "quic", "httpupgrade", "ws", "tcp"};
|
||||
inline QStringList Flows = {"xtls-rprx-vision"};
|
||||
inline QStringList SniffProtocols = {"http", "tls", "quic", "stun", "dns", "bittorrent", "dtls", "ssh", "rdp"};
|
||||
} // namespace Preset::SingBox
|
||||
@ -4,6 +4,23 @@
|
||||
#include "db/Database.hpp"
|
||||
#include "rpc/gRPC.h"
|
||||
|
||||
void adjustComboBoxWidth(const QComboBox *comboBox) {
|
||||
int maxWidth = 0;
|
||||
|
||||
// Iterate over all items and calculate the width required
|
||||
for (int i = 0; i < comboBox->count(); ++i) {
|
||||
QFontMetrics fontMetrics(comboBox->font());
|
||||
int itemWidth = fontMetrics.horizontalAdvance(comboBox->itemText(i));
|
||||
maxWidth = qMax(maxWidth, itemWidth);
|
||||
}
|
||||
|
||||
// Add some padding to the width to avoid text being too close to the edge
|
||||
maxWidth += 30;
|
||||
|
||||
// Set the minimum width for the drop-down menu
|
||||
comboBox->view()->setMinimumWidth(maxWidth);
|
||||
}
|
||||
|
||||
int RouteItem::getIndexOf(const QString& name) const {
|
||||
for (int i=0;i<chain->Rules.size();i++) {
|
||||
if (chain->Rules[i]->name == name) return i;
|
||||
@ -102,6 +119,7 @@ RouteItem::RouteItem(QWidget *parent, const std::shared_ptr<NekoGui::RoutingChai
|
||||
|
||||
ui->route_name->setText(chain->name);
|
||||
ui->rule_attr->addItems(NekoGui::RouteRule::get_attributes());
|
||||
adjustComboBoxWidth(ui->rule_attr);
|
||||
ui->rule_out->addItems(outboundOptions);
|
||||
ui->rule_attr_text->hide();
|
||||
ui->rule_attr_data->setTitle("");
|
||||
@ -313,6 +331,7 @@ void RouteItem::showSelectItem(const QStringList& items, const QString& currentI
|
||||
ui->rule_attr_selector->clear();
|
||||
ui->rule_attr_selector->show();
|
||||
ui->rule_attr_selector->addItems(items);
|
||||
adjustComboBoxWidth(ui->rule_attr_selector);
|
||||
ui->rule_attr_selector->setCurrentText(currentItem);
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignmentFlag::AlignHCenter">
|
||||
<item alignment="">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user