mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 20:44:38 +03:00
feat: global utls fingerprint
This commit is contained in:
@@ -34,10 +34,11 @@ namespace NekoRay::fmt {
|
||||
if (!alpn.trimmed().isEmpty()) {
|
||||
tls["alpn"] = QList2QJsonArray(alpn.split(","));
|
||||
}
|
||||
if (!utlsFingerprint.isEmpty()) {
|
||||
auto fp = utlsFingerprint.isEmpty() ? NekoRay::dataStore->utlsFingerprint : utlsFingerprint;
|
||||
if (!fp.isEmpty()) {
|
||||
tls["utls"] = QJsonObject{
|
||||
{"enabled", true},
|
||||
{"fingerprint", utlsFingerprint},
|
||||
{"fingerprint", fp},
|
||||
};
|
||||
}
|
||||
outbound->insert("tls", tls);
|
||||
|
||||
@@ -47,7 +47,8 @@ namespace NekoRay::fmt {
|
||||
}
|
||||
|
||||
if (security == "tls") {
|
||||
bool v5_utls = !utlsFingerprint.isEmpty();
|
||||
auto fp = utlsFingerprint.isEmpty() ? NekoRay::dataStore->utlsFingerprint : utlsFingerprint;
|
||||
bool v5_utls = !fp.isEmpty();
|
||||
QJsonObject tls;
|
||||
if (allow_insecure || dataStore->skip_cert) tls["allowInsecure"] = true;
|
||||
if (!sni.trimmed().isEmpty()) tls["serverName"] = sni;
|
||||
@@ -65,7 +66,7 @@ namespace NekoRay::fmt {
|
||||
}
|
||||
if (v5_utls) {
|
||||
streamSettings["utlsSettings"] = QJsonObject{
|
||||
{"imitate", utlsFingerprint},
|
||||
{"imitate", fp},
|
||||
{"tlsConfig", tls},
|
||||
};
|
||||
streamSettings["security"] = "utls";
|
||||
|
||||
@@ -16,9 +16,14 @@ namespace Preset {
|
||||
"}";
|
||||
} // namespace Hysteria
|
||||
|
||||
namespace V2Ray {
|
||||
inline QStringList UtlsFingerPrint = {"", "randomized", "randomizedalpn", "randomizednoalpn", "firefox_auto", "firefox_55", "firefox_56", "firefox_63", "firefox_65", "firefox_99", "firefox_102", "firefox_105", "chrome_auto", "chrome_58", "chrome_62", "chrome_70", "chrome_72", "chrome_83", "chrome_87", "chrome_96", "chrome_100", "chrome_102", "ios_auto", "ios_11_1", "ios_12_1", "ios_13", "ios_14", "android_11_okhttp", "edge_auto", "edge_85", "edge_106", "safari_auto", "safari_16_0", "360_auto", "360_7_5", "360_11_0", "qq_auto", "qq_11_1"};
|
||||
} // namespace V2Ray
|
||||
|
||||
namespace SingBox {
|
||||
inline QStringList VpnImplementation = {"gvisor", "system"};
|
||||
inline QStringList DomainStrategy = {"", "ipv4_only", "ipv6_only", "prefer_ipv4", "prefer_ipv6"};
|
||||
inline QStringList UtlsFingerPrint = {"", "chrome", "firefox", "edge", "safari", "360", "qq", "ios", "android", "random", "randomized"};
|
||||
} // namespace SingBox
|
||||
|
||||
namespace Windows {
|
||||
|
||||
@@ -102,6 +102,7 @@ namespace NekoRay {
|
||||
bool insecure_hint = true;
|
||||
bool skip_cert = false;
|
||||
int enable_js_hook = 0;
|
||||
QString utlsFingerprint = "";
|
||||
|
||||
// Remember
|
||||
int remember_spmode = NekoRay::SystemProxyMode::DISABLE;
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
<translation>اشاره ناامن</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Traffic statistics refresh rate</source>
|
||||
<source>Statistics refresh rate</source>
|
||||
<translation>نرخ تازه سازی آمار ترافیک</translation>
|
||||
</message>
|
||||
<message>
|
||||
@@ -225,10 +225,6 @@
|
||||
<source>Password</source>
|
||||
<translation>رمز عبور</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Maybe useful for HiDPI screens.</source>
|
||||
<translation>شاید برای صفحه نمایش های HiDPI مفید باشد.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Skip TLS certificate authentication by default (allowInsecure)</source>
|
||||
<translation>رد شدن از احراز هویت گواهی TLS به طور پیش فرض (allowInsecure)</translation>
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
<translation>提示不安全的配置</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Traffic statistics refresh rate</source>
|
||||
<source>Statistics refresh rate</source>
|
||||
<translation>流量统计刷新率</translation>
|
||||
</message>
|
||||
<message>
|
||||
@@ -219,14 +219,14 @@
|
||||
<source>Password</source>
|
||||
<translation>密码</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Maybe useful for HiDPI screens.</source>
|
||||
<translation>可能对 HiDPI 屏幕有用。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Skip TLS certificate authentication by default (allowInsecure)</source>
|
||||
<translation>默认跳过 TLS 证书验证 (allowInsecure)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Default uTLS Fingerprint</source>
|
||||
<translation>默认 uTLS 指纹</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DialogEditGroup</name>
|
||||
|
||||
@@ -246,9 +246,12 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent)
|
||||
|
||||
// Security
|
||||
|
||||
ui->utlsFingerprint->addItems(IS_NEKO_BOX ? Preset::SingBox::UtlsFingerPrint : Preset::V2Ray::UtlsFingerPrint);
|
||||
|
||||
D_LOAD_BOOL(insecure_hint)
|
||||
D_LOAD_BOOL(skip_cert)
|
||||
ui->enable_js_hook->setCurrentIndex(NekoRay::dataStore->enable_js_hook);
|
||||
ui->utlsFingerprint->setCurrentText(NekoRay::dataStore->utlsFingerprint);
|
||||
}
|
||||
|
||||
DialogBasicSettings::~DialogBasicSettings() {
|
||||
@@ -306,6 +309,7 @@ void DialogBasicSettings::accept() {
|
||||
D_SAVE_BOOL(insecure_hint)
|
||||
D_SAVE_BOOL(skip_cert)
|
||||
NekoRay::dataStore->enable_js_hook = ui->enable_js_hook->currentIndex();
|
||||
NekoRay::dataStore->utlsFingerprint = ui->utlsFingerprint->currentText();
|
||||
|
||||
// 关闭连接统计,停止刷新前清空记录。
|
||||
if (NekoRay::dataStore->traffic_loop_interval == 0 || NekoRay::dataStore->connection_statistics == false) {
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="inbound_auth">
|
||||
<property name="text">
|
||||
<string notr="true">Auth</string>
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -276,19 +276,23 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="horizontalGroupBox_5">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_23">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="start_minimal">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Max log lines</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="max_log_line">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hide dashboard at startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -394,7 +398,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Traffic statistics refresh rate</string>
|
||||
<string>Statistics refresh rate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -445,23 +449,19 @@
|
||||
<item row="5" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_24">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_23">
|
||||
<widget class="QGroupBox" name="horizontalGroupBox_5">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>Max log lines</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="max_log_line">
|
||||
<widget class="QCheckBox" name="start_minimal">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hide dashboard at startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -473,10 +473,10 @@
|
||||
<item>
|
||||
<widget class="QCheckBox" name="AA_EnableHighDpiScaling">
|
||||
<property name="toolTip">
|
||||
<string>Maybe useful for HiDPI screens.</string>
|
||||
<string notr="true">Enable Qt::AA_EnableHighDpiScaling, maybe useful for HiDPI screens.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Qt::AA_EnableHighDpiScaling</string>
|
||||
<string notr="true">HiDPI Screen wrokaround</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -701,6 +701,32 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="horizontalGroupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_26">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>Default uTLS Fingerprint</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="utlsFingerprint">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "ui/edit/edit_custom.h"
|
||||
|
||||
#include "fmt/includes.h"
|
||||
#include "fmt/Preset.hpp"
|
||||
|
||||
#include "qv2ray/v2/ui/widgets/editors/w_JsonEditor.hpp"
|
||||
#include "main/GuiUtils.hpp"
|
||||
@@ -75,9 +76,9 @@ DialogEditProfile::DialogEditProfile(const QString &_type, int profileOrGroupId,
|
||||
if (IS_NEKO_BOX) {
|
||||
ui->header_type->setVisible(false);
|
||||
ui->header_type_l->setVisible(false);
|
||||
if (!ui->utlsFingerprint->count()) ui->utlsFingerprint->addItems({"", "chrome", "firefox", "edge", "safari", "360", "qq", "ios", "android", "random"});
|
||||
if (!ui->utlsFingerprint->count()) ui->utlsFingerprint->addItems(Preset::SingBox::UtlsFingerPrint);
|
||||
} else {
|
||||
if (!ui->utlsFingerprint->count()) ui->utlsFingerprint->addItems({"", "randomized", "randomizedalpn", "randomizednoalpn", "firefox_auto", "firefox_55", "firefox_56", "firefox_63", "firefox_65", "firefox_99", "firefox_102", "firefox_105", "chrome_auto", "chrome_58", "chrome_62", "chrome_70", "chrome_72", "chrome_83", "chrome_87", "chrome_96", "chrome_100", "chrome_102", "ios_auto", "ios_11_1", "ios_12_1", "ios_13", "ios_14", "android_11_okhttp", "edge_auto", "edge_85", "edge_106", "safari_auto", "safari_16_0", "360_auto", "360_7_5", "360_11_0", "qq_auto", "qq_11_1"});
|
||||
if (!ui->utlsFingerprint->count()) ui->utlsFingerprint->addItems(Preset::V2Ray::UtlsFingerPrint);
|
||||
}
|
||||
// 传输设置 是否可见
|
||||
int networkBoxVisible = 0;
|
||||
|
||||
Reference in New Issue
Block a user