mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-18 13:04:37 +03:00
gui: reality settings
This commit is contained in:
@@ -41,6 +41,13 @@ namespace NekoRay::fmt {
|
|||||||
{"fingerprint", fp},
|
{"fingerprint", fp},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if (!reality_pbk.trimmed().isEmpty()) {
|
||||||
|
tls["reality"] = QJsonObject{
|
||||||
|
{"enabled", true},
|
||||||
|
{"public_key", reality_pbk},
|
||||||
|
{"short_id", reality_sid},
|
||||||
|
};
|
||||||
|
}
|
||||||
outbound->insert("tls", tls);
|
outbound->insert("tls", tls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,9 +31,21 @@ namespace NekoRay::fmt {
|
|||||||
url.setHost(serverAddress);
|
url.setHost(serverAddress);
|
||||||
url.setPort(serverPort);
|
url.setPort(serverPort);
|
||||||
if (!name.isEmpty()) url.setFragment(name);
|
if (!name.isEmpty()) url.setFragment(name);
|
||||||
|
|
||||||
|
// security
|
||||||
|
auto security = stream->security;
|
||||||
|
if (security == "tls" && !stream->reality_pbk.trimmed().isEmpty()) security = "reality";
|
||||||
|
query.addQueryItem("security", security);
|
||||||
|
|
||||||
if (!stream->sni.isEmpty()) query.addQueryItem("sni", stream->sni);
|
if (!stream->sni.isEmpty()) query.addQueryItem("sni", stream->sni);
|
||||||
if (stream->allow_insecure) query.addQueryItem("allowInsecure", "1");
|
if (stream->allow_insecure) query.addQueryItem("allowInsecure", "1");
|
||||||
query.addQueryItem("security", stream->security);
|
|
||||||
|
if (security == "reality") {
|
||||||
|
query.addQueryItem("pbk", stream->reality_pbk);
|
||||||
|
query.addQueryItem("sid", stream->reality_sid);
|
||||||
|
}
|
||||||
|
|
||||||
|
// type
|
||||||
query.addQueryItem("type", stream->network);
|
query.addQueryItem("type", stream->network);
|
||||||
|
|
||||||
if (stream->network == "ws" || stream->network == "http") {
|
if (stream->network == "ws" || stream->network == "http") {
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ namespace NekoRay::fmt {
|
|||||||
|
|
||||||
stream->security = GetQueryValue(query, "security", "");
|
stream->security = GetQueryValue(query, "security", "");
|
||||||
stream->sni = GetQueryValue(query, "sni");
|
stream->sni = GetQueryValue(query, "sni");
|
||||||
|
|
||||||
|
if (link.startsWith("https")) stream->security = "tls";
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -54,14 +56,15 @@ namespace NekoRay::fmt {
|
|||||||
if (serverPort == -1) serverPort = 443;
|
if (serverPort == -1) serverPort = 443;
|
||||||
|
|
||||||
stream->network = GetQueryValue(query, "type", "tcp");
|
stream->network = GetQueryValue(query, "type", "tcp");
|
||||||
stream->security = GetQueryValue(query, "security", "tls");
|
stream->security = GetQueryValue(query, "security", "tls").replace("reality", "tls");
|
||||||
auto sni1 = GetQueryValue(query, "sni");
|
auto sni1 = GetQueryValue(query, "sni");
|
||||||
auto sni2 = GetQueryValue(query, "peer");
|
auto sni2 = GetQueryValue(query, "peer");
|
||||||
if (!sni1.isEmpty()) stream->sni = sni1;
|
if (!sni1.isEmpty()) stream->sni = sni1;
|
||||||
if (!sni2.isEmpty()) stream->sni = sni2;
|
if (!sni2.isEmpty()) stream->sni = sni2;
|
||||||
if (!query.queryItemValue("allowInsecure").isEmpty()) stream->allow_insecure = true;
|
if (!query.queryItemValue("allowInsecure").isEmpty()) stream->allow_insecure = true;
|
||||||
|
stream->reality_pbk = GetQueryValue(query, "pbk", "");
|
||||||
|
stream->reality_sid = GetQueryValue(query, "sid", "");
|
||||||
|
|
||||||
// TODO header kcp quic
|
|
||||||
if (stream->network == "ws") {
|
if (stream->network == "ws") {
|
||||||
stream->path = GetQueryValue(query, "path", "");
|
stream->path = GetQueryValue(query, "path", "");
|
||||||
stream->host = GetQueryValue(query, "host", "");
|
stream->host = GetQueryValue(query, "host", "");
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ namespace NekoRay::fmt {
|
|||||||
// ws early data
|
// ws early data
|
||||||
QString ws_early_data_name = "";
|
QString ws_early_data_name = "";
|
||||||
int ws_early_data_length = 0;
|
int ws_early_data_length = 0;
|
||||||
|
// reality
|
||||||
|
QString reality_pbk = "";
|
||||||
|
QString reality_sid = "";
|
||||||
|
|
||||||
V2rayStreamSettings() : JsonStore() {
|
V2rayStreamSettings() : JsonStore() {
|
||||||
_add(new configItem("net", &network, itemType::string));
|
_add(new configItem("net", &network, itemType::string));
|
||||||
@@ -37,6 +40,8 @@ namespace NekoRay::fmt {
|
|||||||
_add(new configItem("ed_name", &ws_early_data_name, itemType::string));
|
_add(new configItem("ed_name", &ws_early_data_name, itemType::string));
|
||||||
_add(new configItem("ed_len", &ws_early_data_length, itemType::integer));
|
_add(new configItem("ed_len", &ws_early_data_length, itemType::integer));
|
||||||
_add(new configItem("utls", &utlsFingerprint, itemType::string));
|
_add(new configItem("utls", &utlsFingerprint, itemType::string));
|
||||||
|
_add(new configItem("pbk", &reality_pbk, itemType::string));
|
||||||
|
_add(new configItem("sid", &reality_sid, itemType::string));
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject BuildStreamSettingsV2Ray();
|
QJsonObject BuildStreamSettingsV2Ray();
|
||||||
|
|||||||
@@ -353,7 +353,7 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Security Settings</source>
|
<source>Security Settings</source>
|
||||||
<translation>تنظیمات امنیت</translation>
|
<translation type="vanished">تنظیمات امنیت</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>When enabled, V2Ray will not check the validity of the TLS certificate provided by the remote host (the security is equivalent to plaintext)</source>
|
<source>When enabled, V2Ray will not check the validity of the TLS certificate provided by the remote host (the security is equivalent to plaintext)</source>
|
||||||
@@ -391,6 +391,18 @@
|
|||||||
<source>Already set</source>
|
<source>Already set</source>
|
||||||
<translation>تنظیم شده</translation>
|
<translation>تنظیم شده</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>TLS Security Settings</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>TLS Camouflage Settings</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Reality public key. If not empty, turn TLS into REALITY.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>DialogHotkey</name>
|
<name>DialogHotkey</name>
|
||||||
|
|||||||
@@ -345,13 +345,9 @@
|
|||||||
<source>Application layer protocol negotiation, clear text. Please separate them with commas.</source>
|
<source>Application layer protocol negotiation, clear text. Please separate them with commas.</source>
|
||||||
<translation>应用层协议协商,明文。多个请以英文逗号分隔。</translation>
|
<translation>应用层协议协商,明文。多个请以英文逗号分隔。</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Security Settings</source>
|
|
||||||
<translation>安全设置</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Allow insecure</source>
|
<source>Allow insecure</source>
|
||||||
<translation>不检查服务器证书(不安全)</translation>
|
<translation>不检查服务器证书</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Certificate</source>
|
<source>Certificate</source>
|
||||||
@@ -385,6 +381,18 @@
|
|||||||
<source>Custom (%1)</source>
|
<source>Custom (%1)</source>
|
||||||
<translation>自定义 (%1)</translation>
|
<translation>自定义 (%1)</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>TLS Security Settings</source>
|
||||||
|
<translation>TLS 安全设置</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>TLS Camouflage Settings</source>
|
||||||
|
<translation>TLS 伪装设置</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Reality public key. If not empty, turn TLS into REALITY.</source>
|
||||||
|
<translation>Reality public key. 如果不为空,则将 TLS 变为 REALITY。</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>DialogHotkey</name>
|
<name>DialogHotkey</name>
|
||||||
|
|||||||
@@ -664,7 +664,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="horizontalGroupBox">
|
<widget class="QGroupBox" name="horizontalGroupBox3">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
|||||||
@@ -94,8 +94,16 @@ DialogEditProfile::DialogEditProfile(const QString &_type, int profileOrGroupId,
|
|||||||
connect(ui->security, &QComboBox::currentTextChanged, this, [=](const QString &txt) {
|
connect(ui->security, &QComboBox::currentTextChanged, this, [=](const QString &txt) {
|
||||||
if (txt == "tls") {
|
if (txt == "tls") {
|
||||||
ui->security_box->setVisible(true);
|
ui->security_box->setVisible(true);
|
||||||
|
ui->reality_box->setVisible(true);
|
||||||
|
if (!IS_NEKO_BOX) {
|
||||||
|
ui->reality_pbk->hide();
|
||||||
|
ui->reality_sid->hide();
|
||||||
|
ui->reality_pbk_l->hide();
|
||||||
|
ui->reality_sid_l->hide();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ui->security_box->setVisible(false);
|
ui->security_box->setVisible(false);
|
||||||
|
ui->reality_box->setVisible(false);
|
||||||
}
|
}
|
||||||
ADJUST_SIZE
|
ADJUST_SIZE
|
||||||
});
|
});
|
||||||
@@ -196,7 +204,7 @@ void DialogEditProfile::typeSelected(const QString &newType) {
|
|||||||
ui->port->setVisible(showAddressPort);
|
ui->port->setVisible(showAddressPort);
|
||||||
ui->port_l->setVisible(showAddressPort);
|
ui->port_l->setVisible(showAddressPort);
|
||||||
|
|
||||||
// 右边 Outbound: settings
|
// 右边 stream
|
||||||
auto stream = GetStreamSettings(ent->bean.data());
|
auto stream = GetStreamSettings(ent->bean.data());
|
||||||
if (stream != nullptr) {
|
if (stream != nullptr) {
|
||||||
ui->right_all_w->setVisible(true);
|
ui->right_all_w->setVisible(true);
|
||||||
@@ -212,6 +220,8 @@ void DialogEditProfile::typeSelected(const QString &newType) {
|
|||||||
ui->header_type->setCurrentText(stream->header_type);
|
ui->header_type->setCurrentText(stream->header_type);
|
||||||
ui->ws_early_data_name->setText(stream->ws_early_data_name);
|
ui->ws_early_data_name->setText(stream->ws_early_data_name);
|
||||||
ui->ws_early_data_length->setText(Int2String(stream->ws_early_data_length));
|
ui->ws_early_data_length->setText(Int2String(stream->ws_early_data_length));
|
||||||
|
ui->reality_pbk->setText(stream->reality_pbk);
|
||||||
|
ui->reality_sid->setText(stream->reality_sid);
|
||||||
CACHE.certificate = stream->certificate;
|
CACHE.certificate = stream->certificate;
|
||||||
} else {
|
} else {
|
||||||
ui->right_all_w->setVisible(false);
|
ui->right_all_w->setVisible(false);
|
||||||
@@ -310,7 +320,7 @@ void DialogEditProfile::accept() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 右边
|
// 右边 stream
|
||||||
auto stream = GetStreamSettings(ent->bean.data());
|
auto stream = GetStreamSettings(ent->bean.data());
|
||||||
if (stream != nullptr) {
|
if (stream != nullptr) {
|
||||||
stream->network = ui->network->currentText();
|
stream->network = ui->network->currentText();
|
||||||
@@ -326,7 +336,11 @@ void DialogEditProfile::accept() {
|
|||||||
stream->ws_early_data_name = ui->ws_early_data_name->text();
|
stream->ws_early_data_name = ui->ws_early_data_name->text();
|
||||||
stream->ws_early_data_length = ui->ws_early_data_length->text().toInt();
|
stream->ws_early_data_length = ui->ws_early_data_length->text().toInt();
|
||||||
stream->certificate = CACHE.certificate;
|
stream->certificate = CACHE.certificate;
|
||||||
|
stream->reality_pbk = ui->reality_pbk->text();
|
||||||
|
stream->reality_sid = ui->reality_sid->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cached custom
|
||||||
auto custom_item = ent->bean->_get("custom");
|
auto custom_item = ent->bean->_get("custom");
|
||||||
if (custom_item != nullptr) {
|
if (custom_item != nullptr) {
|
||||||
*((QString *) custom_item->ptr) = CACHE.custom;
|
*((QString *) custom_item->ptr) = CACHE.custom;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1000</width>
|
<width>1000</width>
|
||||||
<height>678</height>
|
<height>800</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="custom_edit">
|
<widget class="QPushButton" name="custom_edit">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Edit</string>
|
<string notr="true">Edit</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -411,7 +411,7 @@ security (QUIC)</string>
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Security Settings</string>
|
<string>TLS Security Settings</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
@@ -440,38 +440,13 @@ security (QUIC)</string>
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
|
||||||
<string notr="true">uTLS</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="utlsFingerprint">
|
|
||||||
<property name="editable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QGridLayout" name="_3">
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QPushButton" name="certificate_edit">
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">PushButton</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
@@ -480,6 +455,17 @@ security (QUIC)</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="certificate_edit">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Edit</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="_3">
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="MyLineEdit" name="sni"/>
|
<widget class="MyLineEdit" name="sni"/>
|
||||||
</item>
|
</item>
|
||||||
@@ -511,6 +497,58 @@ security (QUIC)</string>
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="reality_box">
|
||||||
|
<property name="title">
|
||||||
|
<string>TLS Camouflage Settings</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="reality_pbk_l">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Reality public key. If not empty, turn TLS into REALITY.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Realty Pbk</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="reality_sid_l">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Reality Sid</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="MyLineEdit" name="reality_sid"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="MyLineEdit" name="reality_pbk"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">uTLS</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="utlsFingerprint">
|
||||||
|
<property name="editable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -538,10 +576,12 @@ security (QUIC)</string>
|
|||||||
<tabstop>ws_early_data_length</tabstop>
|
<tabstop>ws_early_data_length</tabstop>
|
||||||
<tabstop>ws_early_data_name</tabstop>
|
<tabstop>ws_early_data_name</tabstop>
|
||||||
<tabstop>insecure</tabstop>
|
<tabstop>insecure</tabstop>
|
||||||
<tabstop>utlsFingerprint</tabstop>
|
<tabstop>certificate_edit</tabstop>
|
||||||
<tabstop>sni</tabstop>
|
<tabstop>sni</tabstop>
|
||||||
<tabstop>alpn</tabstop>
|
<tabstop>alpn</tabstop>
|
||||||
<tabstop>certificate_edit</tabstop>
|
<tabstop>utlsFingerprint</tabstop>
|
||||||
|
<tabstop>reality_pbk</tabstop>
|
||||||
|
<tabstop>reality_sid</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
|
|||||||
Reference in New Issue
Block a user