mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-19 05:30:06 +08:00
fix
This commit is contained in:
parent
87c4c68bc2
commit
ea18b99c9d
@ -103,101 +103,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="security_box">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>TLS Security Settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="insecure">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>When enabled, V2Ray will not check the validity of the TLS certificate provided by the remote host (the security is equivalent to plaintext)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Allow insecure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Certificate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<widget class="MyLineEdit" name="sni"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="toolTip">
|
||||
<string>Server name indication, clear text.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">SNI</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="toolTip">
|
||||
<string>Application layer protocol negotiation, clear text. Please separate them with commas.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">ALPN</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="MyLineEdit" name="alpn"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="bean">
|
||||
<property name="sizePolicy">
|
||||
@ -435,11 +340,6 @@
|
||||
<string notr="true">tls</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">reality</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
@ -636,6 +536,101 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="security_box">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>TLS Security Settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="insecure">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>When enabled, V2Ray will not check the validity of the TLS certificate provided by the remote host (the security is equivalent to plaintext)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Allow insecure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Certificate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<widget class="MyLineEdit" name="sni"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="toolTip">
|
||||
<string>Server name indication, clear text.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">SNI</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="toolTip">
|
||||
<string>Application layer protocol negotiation, clear text. Please separate them with commas.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">ALPN</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="MyLineEdit" name="alpn"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="tls_camouflage_box">
|
||||
<property name="sizePolicy">
|
||||
@ -776,6 +771,9 @@
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="reality_sid_l">
|
||||
<property name="toolTip">
|
||||
<string>Reality short id. Accept only one value.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reality SID</string>
|
||||
</property>
|
||||
@ -822,6 +820,9 @@
|
||||
<tabstop>certificate_edit</tabstop>
|
||||
<tabstop>sni</tabstop>
|
||||
<tabstop>alpn</tabstop>
|
||||
<tabstop>utlsFingerprint</tabstop>
|
||||
<tabstop>reality_pbk</tabstop>
|
||||
<tabstop>reality_sid</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
||||
@ -73,36 +73,15 @@ namespace Configs {
|
||||
if (!alpn.trimmed().isEmpty()) {
|
||||
tls["alpn"] = QListStr2QJsonArray(alpn.split(","));
|
||||
}
|
||||
if (QString fp = utlsFingerprint; !fp.isEmpty()) {
|
||||
tls["utls"] = QJsonObject{
|
||||
{"enabled", true},
|
||||
{"fingerprint", fp},
|
||||
};
|
||||
}
|
||||
if (enable_tls_fragment)
|
||||
{
|
||||
tls["fragment"] = enable_tls_fragment;
|
||||
if (!tls_fragment_fallback_delay.isEmpty()) tls["fragment_fallback_delay"] = tls_fragment_fallback_delay;
|
||||
}
|
||||
if (enable_tls_record_fragment) tls["record_fragment"] = enable_tls_record_fragment;
|
||||
outbound->insert("tls", tls);
|
||||
} else if (security == "reality") {
|
||||
QJsonObject tls{{"enabled", true}};
|
||||
if (allow_insecure || Configs::dataStore->skip_cert) tls["insecure"] = true;
|
||||
if (!sni.trimmed().isEmpty()) tls["server_name"] = sni;
|
||||
if (!certificate.trimmed().isEmpty()) {
|
||||
tls["certificate"] = certificate.trimmed();
|
||||
}
|
||||
if (!alpn.trimmed().isEmpty()) {
|
||||
tls["alpn"] = QListStr2QJsonArray(alpn.split(","));
|
||||
}
|
||||
tls["reality"] = QJsonObject{
|
||||
{"enabled", true},
|
||||
{"public_key", reality_pbk},
|
||||
{"short_id", reality_sid.split(",")[0]},
|
||||
};
|
||||
QString fp = utlsFingerprint;
|
||||
if (fp.isEmpty()) fp = "random";
|
||||
if (!reality_pbk.trimmed().isEmpty()) {
|
||||
tls["reality"] = QJsonObject{
|
||||
{"enabled", true},
|
||||
{"public_key", reality_pbk},
|
||||
{"short_id", reality_sid.split(",")[0]},
|
||||
};
|
||||
if (fp.isEmpty()) fp = "random";
|
||||
}
|
||||
if (!fp.isEmpty()) {
|
||||
tls["utls"] = QJsonObject{
|
||||
{"enabled", true},
|
||||
|
||||
@ -33,7 +33,9 @@ namespace Configs {
|
||||
if (!name.isEmpty()) url.setFragment(name);
|
||||
|
||||
// security
|
||||
query.addQueryItem("security", stream->security == "" ? "none" : stream->security);
|
||||
auto security = stream->security;
|
||||
if (security == "tls" && !stream->reality_pbk.trimmed().isEmpty()) security = "reality";
|
||||
query.addQueryItem("security", security == "" ? "none" : security);
|
||||
|
||||
if (!stream->sni.isEmpty()) query.addQueryItem("sni", stream->sni);
|
||||
if (!stream->alpn.isEmpty()) query.addQueryItem("alpn", stream->alpn);
|
||||
@ -43,7 +45,7 @@ namespace Configs {
|
||||
if (!stream->tls_fragment_fallback_delay.isEmpty()) query.addQueryItem("fragment_fallback_delay", stream->tls_fragment_fallback_delay);
|
||||
if (stream->enable_tls_record_fragment) query.addQueryItem("record_fragment", "1");
|
||||
|
||||
if (stream->security == "reality") {
|
||||
if (security == "reality") {
|
||||
query.addQueryItem("pbk", stream->reality_pbk);
|
||||
if (!stream->reality_sid.isEmpty()) query.addQueryItem("sid", stream->reality_sid);
|
||||
}
|
||||
@ -62,7 +64,9 @@ namespace Configs {
|
||||
if (!name.isEmpty()) url.setFragment(name);
|
||||
|
||||
// security
|
||||
query.addQueryItem("security", stream->security == "" ? "none" : stream->security);
|
||||
auto security = stream->security;
|
||||
if (security == "tls" && !stream->reality_pbk.trimmed().isEmpty()) security = "reality";
|
||||
query.addQueryItem("security", security == "" ? "none" : security);
|
||||
|
||||
if (!stream->sni.isEmpty()) query.addQueryItem("sni", stream->sni);
|
||||
if (!stream->alpn.isEmpty()) query.addQueryItem("alpn", stream->alpn);
|
||||
@ -72,7 +76,7 @@ namespace Configs {
|
||||
if (!stream->tls_fragment_fallback_delay.isEmpty()) query.addQueryItem("fragment_fallback_delay", stream->tls_fragment_fallback_delay);
|
||||
if (stream->enable_tls_record_fragment) query.addQueryItem("record_fragment", "1");
|
||||
|
||||
if (stream->security == "reality") {
|
||||
if (security == "reality") {
|
||||
query.addQueryItem("pbk", stream->reality_pbk);
|
||||
if (!stream->reality_sid.isEmpty()) query.addQueryItem("sid", stream->reality_sid);
|
||||
}
|
||||
@ -168,7 +172,9 @@ namespace Configs {
|
||||
query.addQueryItem("encryption", security);
|
||||
|
||||
// security
|
||||
query.addQueryItem("security", stream->security == "" ? "none" : stream->security);
|
||||
auto security = stream->security;
|
||||
if (security == "tls" && !stream->reality_pbk.trimmed().isEmpty()) security = "reality";
|
||||
query.addQueryItem("security", security == "" ? "none" : security);
|
||||
|
||||
if (!stream->sni.isEmpty()) query.addQueryItem("sni", stream->sni);
|
||||
if (stream->allow_insecure) query.addQueryItem("allowInsecure", "1");
|
||||
@ -181,7 +187,7 @@ namespace Configs {
|
||||
if (!stream->tls_fragment_fallback_delay.isEmpty()) query.addQueryItem("fragment_fallback_delay", stream->tls_fragment_fallback_delay);
|
||||
if (stream->enable_tls_record_fragment) query.addQueryItem("record_fragment", "1");
|
||||
|
||||
if (stream->security == "reality") {
|
||||
if (security == "reality") {
|
||||
query.addQueryItem("pbk", stream->reality_pbk);
|
||||
if (!stream->reality_sid.isEmpty()) query.addQueryItem("sid", stream->reality_sid);
|
||||
}
|
||||
|
||||
@ -135,10 +135,6 @@ namespace Configs
|
||||
stream->packet_encoding = obj["packet_encoding"].toString();
|
||||
mux_state = obj["multiplex"].isObject() ? (obj["multiplex"].toObject()["enabled"].toBool() ? 1 : 2) : 0;
|
||||
stream->security = obj["tls"].isObject() ? "tls" : "";
|
||||
if (obj["tls"].toObject()["reality"].toObject()["enabled"].toBool())
|
||||
{
|
||||
stream->security = "reality";
|
||||
}
|
||||
stream->reality_pbk = obj["tls"].toObject()["reality"].toObject()["public_key"].toString();
|
||||
stream->reality_sid = obj["tls"].toObject()["reality"].toObject()["short_id"].toString();
|
||||
stream->utlsFingerprint = obj["tls"].toObject()["utls"].toObject()["fingerprint"].toString();
|
||||
@ -180,10 +176,6 @@ namespace Configs
|
||||
stream->packet_encoding = obj["packet_encoding"].toString();
|
||||
mux_state = obj["multiplex"].isObject() ? (obj["multiplex"].toObject()["enabled"].toBool() ? 1 : 2) : 0;
|
||||
stream->security = obj["tls"].isObject() ? "tls" : "";
|
||||
if (obj["tls"].toObject()["reality"].toObject()["enabled"].toBool())
|
||||
{
|
||||
stream->security = "reality";
|
||||
}
|
||||
stream->reality_pbk = obj["tls"].toObject()["reality"].toObject()["public_key"].toString();
|
||||
stream->reality_sid = obj["tls"].toObject()["reality"].toObject()["short_id"].toString();
|
||||
stream->utlsFingerprint = obj["tls"].toObject()["utls"].toObject()["fingerprint"].toString();
|
||||
@ -224,10 +216,6 @@ namespace Configs
|
||||
idle_session_timeout = obj["idle_session_timeout"].toInt();
|
||||
min_idle_session = obj["min_idle_session"].toInt();
|
||||
stream->security = obj["tls"].isObject() ? "tls" : "";
|
||||
if (obj["tls"].toObject()["reality"].toObject()["enabled"].toBool())
|
||||
{
|
||||
stream->security = "reality";
|
||||
}
|
||||
stream->reality_pbk = obj["tls"].toObject()["reality"].toObject()["public_key"].toString();
|
||||
stream->reality_sid = obj["tls"].toObject()["reality"].toObject()["short_id"].toString();
|
||||
stream->utlsFingerprint = obj["tls"].toObject()["utls"].toObject()["fingerprint"].toString();
|
||||
|
||||
@ -55,7 +55,7 @@ namespace Configs {
|
||||
|
||||
// security
|
||||
|
||||
stream->security = GetQueryValue(query, "security", "").replace("none", "");
|
||||
stream->security = "tls";
|
||||
auto sni1 = GetQueryValue(query, "sni");
|
||||
auto sni2 = GetQueryValue(query, "peer");
|
||||
if (!sni1.isEmpty()) stream->sni = sni1;
|
||||
@ -71,10 +71,6 @@ namespace Configs {
|
||||
if (stream->utlsFingerprint.isEmpty()) {
|
||||
stream->utlsFingerprint = dataStore->utlsFingerprint;
|
||||
}
|
||||
if (stream->security.isEmpty()) {
|
||||
if (!sni1.isEmpty() || !sni2.isEmpty()) stream->security = "tls";
|
||||
if (!stream->reality_pbk.isEmpty()) stream->security = "reality";
|
||||
}
|
||||
|
||||
return !(password.isEmpty() || serverAddress.isEmpty());
|
||||
}
|
||||
@ -98,7 +94,11 @@ namespace Configs {
|
||||
}
|
||||
stream->network = type;
|
||||
|
||||
stream->security = GetQueryValue(query, "security", "").replace("none", "");
|
||||
if (proxy_type == proxy_Trojan) {
|
||||
stream->security = GetQueryValue(query, "security", "tls").replace("reality", "tls").replace("none", "");
|
||||
} else {
|
||||
stream->security = GetQueryValue(query, "security", "").replace("reality", "tls").replace("none", "");
|
||||
}
|
||||
auto sni1 = GetQueryValue(query, "sni");
|
||||
auto sni2 = GetQueryValue(query, "peer");
|
||||
if (!sni1.isEmpty()) stream->sni = sni1;
|
||||
@ -116,7 +116,6 @@ namespace Configs {
|
||||
}
|
||||
if (stream->security.isEmpty()) {
|
||||
if (!sni1.isEmpty() || !sni2.isEmpty()) stream->security = "tls";
|
||||
if (!stream->reality_pbk.isEmpty()) stream->security = "reality";
|
||||
}
|
||||
|
||||
// type
|
||||
|
||||
@ -116,17 +116,6 @@ DialogEditProfile::DialogEditProfile(const QString &_type, int profileOrGroupId,
|
||||
if (txt == "tls") {
|
||||
ui->security_box->setVisible(true);
|
||||
ui->tls_camouflage_box->setVisible(true);
|
||||
ui->reality_pbk->setVisible(false);
|
||||
ui->reality_pbk_l->setVisible(false);
|
||||
ui->reality_sid->setVisible(false);
|
||||
ui->reality_sid_l->setVisible(false);
|
||||
} else if (txt == "reality") {
|
||||
ui->security_box->setVisible(true);
|
||||
ui->tls_camouflage_box->setVisible(true);
|
||||
ui->reality_pbk->setVisible(true);
|
||||
ui->reality_pbk_l->setVisible(true);
|
||||
ui->reality_sid->setVisible(true);
|
||||
ui->reality_sid_l->setVisible(true);
|
||||
} else {
|
||||
ui->security_box->setVisible(false);
|
||||
ui->tls_camouflage_box->setVisible(false);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user