mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 20:44:38 +03:00
feat: utls
feat: vpn strict_route
This commit is contained in:
@@ -785,6 +785,7 @@ namespace NekoRay {
|
|||||||
.replace("%PROCESS_NAME_RULE%", process_name_rule)
|
.replace("%PROCESS_NAME_RULE%", process_name_rule)
|
||||||
.replace("%CIDR_RULE%", cidr_rule)
|
.replace("%CIDR_RULE%", cidr_rule)
|
||||||
.replace("%TUN_NAME%", tun_name)
|
.replace("%TUN_NAME%", tun_name)
|
||||||
|
.replace("%STRICT_ROUTE%", dataStore->vpn_strict_route ? "true" : "false")
|
||||||
.replace("%PORT%", Int2String(dataStore->inbound_socks_port));
|
.replace("%PORT%", Int2String(dataStore->inbound_socks_port));
|
||||||
// write config
|
// write config
|
||||||
QFile file;
|
QFile file;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
%IPV6_ADDRESS%
|
%IPV6_ADDRESS%
|
||||||
"mtu": %MTU%,
|
"mtu": %MTU%,
|
||||||
"auto_route": true,
|
"auto_route": true,
|
||||||
|
"strict_route": %STRICT_ROUTE%,
|
||||||
"stack": "%STACK%",
|
"stack": "%STACK%",
|
||||||
"endpoint_independent_nat": true,
|
"endpoint_independent_nat": true,
|
||||||
"sniff": false
|
"sniff": false
|
||||||
|
|||||||
@@ -36,6 +36,12 @@ namespace NekoRay::fmt {
|
|||||||
if (!alpn.trimmed().isEmpty()) {
|
if (!alpn.trimmed().isEmpty()) {
|
||||||
tls["alpn"] = QList2QJsonArray(alpn.split(","));
|
tls["alpn"] = QList2QJsonArray(alpn.split(","));
|
||||||
}
|
}
|
||||||
|
if (!utls.isEmpty()) {
|
||||||
|
tls["utls"] = QJsonObject{
|
||||||
|
{"enabled", true},
|
||||||
|
{"fingerprint", utls},
|
||||||
|
};
|
||||||
|
}
|
||||||
outbound->insert("tls", tls);
|
outbound->insert("tls", tls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ namespace NekoRay::fmt {
|
|||||||
QString sni = "";
|
QString sni = "";
|
||||||
QString alpn = "";
|
QString alpn = "";
|
||||||
QString certificate = "";
|
QString certificate = "";
|
||||||
|
QString utls = "";
|
||||||
bool allow_insecure = false;
|
bool allow_insecure = false;
|
||||||
// ws early data
|
// ws early data
|
||||||
QString ws_early_data_name = "";
|
QString ws_early_data_name = "";
|
||||||
@@ -35,6 +36,7 @@ namespace NekoRay::fmt {
|
|||||||
_add(new configItem("h_type", &header_type, itemType::string));
|
_add(new configItem("h_type", &header_type, itemType::string));
|
||||||
_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", &utls, itemType::string));
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject BuildStreamSettingsV2Ray();
|
QJsonObject BuildStreamSettingsV2Ray();
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ namespace NekoRay {
|
|||||||
_add(new configItem("vpn_impl", &vpn_implementation, itemType::integer));
|
_add(new configItem("vpn_impl", &vpn_implementation, itemType::integer));
|
||||||
_add(new configItem("vpn_mtu", &vpn_mtu, itemType::integer));
|
_add(new configItem("vpn_mtu", &vpn_mtu, itemType::integer));
|
||||||
_add(new configItem("vpn_ipv6", &vpn_ipv6, itemType::boolean));
|
_add(new configItem("vpn_ipv6", &vpn_ipv6, itemType::boolean));
|
||||||
_add(new configItem("vpn_hide_console", &vpn_hide_consloe, itemType::boolean));
|
_add(new configItem("vpn_hide_console", &vpn_hide_console, itemType::boolean));
|
||||||
|
_add(new configItem("vpn_strict_route", &vpn_strict_route, itemType::boolean));
|
||||||
_add(new configItem("vpn_bypass_process", &vpn_bypass_process, itemType::string));
|
_add(new configItem("vpn_bypass_process", &vpn_bypass_process, itemType::string));
|
||||||
_add(new configItem("vpn_bypass_cidr", &vpn_bypass_cidr, itemType::string));
|
_add(new configItem("vpn_bypass_cidr", &vpn_bypass_cidr, itemType::string));
|
||||||
_add(new configItem("check_include_pre", &check_include_pre, itemType::boolean));
|
_add(new configItem("check_include_pre", &check_include_pre, itemType::boolean));
|
||||||
|
|||||||
@@ -112,7 +112,8 @@ namespace NekoRay {
|
|||||||
int vpn_implementation = 0;
|
int vpn_implementation = 0;
|
||||||
int vpn_mtu = 9000;
|
int vpn_mtu = 9000;
|
||||||
bool vpn_ipv6 = false;
|
bool vpn_ipv6 = false;
|
||||||
bool vpn_hide_consloe = false;
|
bool vpn_hide_console = false;
|
||||||
|
bool vpn_strict_route = false;
|
||||||
QString vpn_bypass_process = "";
|
QString vpn_bypass_process = "";
|
||||||
QString vpn_bypass_cidr = "";
|
QString vpn_bypass_cidr = "";
|
||||||
|
|
||||||
|
|||||||
@@ -341,14 +341,6 @@
|
|||||||
<source>Already set</source>
|
<source>Already set</source>
|
||||||
<translation>已设置</translation>
|
<translation>已设置</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Path</source>
|
|
||||||
<translation>路径(Path)</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Host</source>
|
|
||||||
<translation>主机(Host)</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Packet Encoding</source>
|
<source>Packet Encoding</source>
|
||||||
<translation>包编码</translation>
|
<translation>包编码</translation>
|
||||||
|
|||||||
@@ -598,33 +598,6 @@
|
|||||||
<header>ui/widget/MyLineEdit.h</header>
|
<header>ui/widget/MyLineEdit.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
|
||||||
<tabstop>tabWidget</tabstop>
|
|
||||||
<tabstop>socks_ip</tabstop>
|
|
||||||
<tabstop>custom_inbound_edit</tabstop>
|
|
||||||
<tabstop>inbound_socks_port</tabstop>
|
|
||||||
<tabstop>inbound_http_port</tabstop>
|
|
||||||
<tabstop>http_enable</tabstop>
|
|
||||||
<tabstop>test_url</tabstop>
|
|
||||||
<tabstop>test_concurrent</tabstop>
|
|
||||||
<tabstop>log_level</tabstop>
|
|
||||||
<tabstop>mux_cool_enable</tabstop>
|
|
||||||
<tabstop>mux_cool</tabstop>
|
|
||||||
<tabstop>check_include_pre</tabstop>
|
|
||||||
<tabstop>theme</tabstop>
|
|
||||||
<tabstop>language</tabstop>
|
|
||||||
<tabstop>rfsh_r</tabstop>
|
|
||||||
<tabstop>connection_statistics</tabstop>
|
|
||||||
<tabstop>start_minimal</tabstop>
|
|
||||||
<tabstop>user_agent</tabstop>
|
|
||||||
<tabstop>sub_use_proxy</tabstop>
|
|
||||||
<tabstop>core_v2ray_asset</tabstop>
|
|
||||||
<tabstop>core_v2ray_asset_pick</tabstop>
|
|
||||||
<tabstop>extra_core_add</tabstop>
|
|
||||||
<tabstop>extra_core_del</tabstop>
|
|
||||||
<tabstop>insecure_hint</tabstop>
|
|
||||||
<tabstop>skip_cert</tabstop>
|
|
||||||
</tabstops>
|
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
|||||||
@@ -14,10 +14,11 @@ DialogVPNSettings::DialogVPNSettings(QWidget *parent) :
|
|||||||
ui->vpn_implementation->setCurrentIndex(NekoRay::dataStore->vpn_implementation);
|
ui->vpn_implementation->setCurrentIndex(NekoRay::dataStore->vpn_implementation);
|
||||||
ui->vpn_mtu->setCurrentText(Int2String(NekoRay::dataStore->vpn_mtu));
|
ui->vpn_mtu->setCurrentText(Int2String(NekoRay::dataStore->vpn_mtu));
|
||||||
ui->vpn_ipv6->setChecked(NekoRay::dataStore->vpn_ipv6);
|
ui->vpn_ipv6->setChecked(NekoRay::dataStore->vpn_ipv6);
|
||||||
ui->hide_console->setChecked(NekoRay::dataStore->vpn_hide_consloe);
|
ui->hide_console->setChecked(NekoRay::dataStore->vpn_hide_console);
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
ui->hide_console->setVisible(false);
|
ui->hide_console->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
|
ui->strict_route->setChecked(NekoRay::dataStore->vpn_strict_route);
|
||||||
//
|
//
|
||||||
D_LOAD_STRING(vpn_bypass_cidr)
|
D_LOAD_STRING(vpn_bypass_cidr)
|
||||||
D_LOAD_STRING(vpn_bypass_process)
|
D_LOAD_STRING(vpn_bypass_process)
|
||||||
@@ -35,7 +36,8 @@ void DialogVPNSettings::accept() {
|
|||||||
NekoRay::dataStore->fake_dns = ui->fake_dns->isChecked();
|
NekoRay::dataStore->fake_dns = ui->fake_dns->isChecked();
|
||||||
NekoRay::dataStore->vpn_mtu = mtu;
|
NekoRay::dataStore->vpn_mtu = mtu;
|
||||||
NekoRay::dataStore->vpn_ipv6 = ui->vpn_ipv6->isChecked();
|
NekoRay::dataStore->vpn_ipv6 = ui->vpn_ipv6->isChecked();
|
||||||
NekoRay::dataStore->vpn_hide_consloe = ui->hide_console->isChecked();
|
NekoRay::dataStore->vpn_hide_console = ui->hide_console->isChecked();
|
||||||
|
NekoRay::dataStore->vpn_strict_route = ui->strict_route->isChecked();
|
||||||
//
|
//
|
||||||
D_SAVE_STRING_QTEXTEDIT(vpn_bypass_cidr)
|
D_SAVE_STRING_QTEXTEDIT(vpn_bypass_cidr)
|
||||||
D_SAVE_STRING_QTEXTEDIT(vpn_bypass_process)
|
D_SAVE_STRING_QTEXTEDIT(vpn_bypass_process)
|
||||||
|
|||||||
@@ -107,6 +107,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="strict_route">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Strict Route</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -147,15 +154,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
|
||||||
<tabstop>vpn_implementation</tabstop>
|
|
||||||
<tabstop>vpn_mtu</tabstop>
|
|
||||||
<tabstop>hide_console</tabstop>
|
|
||||||
<tabstop>vpn_ipv6</tabstop>
|
|
||||||
<tabstop>fake_dns</tabstop>
|
|
||||||
<tabstop>vpn_bypass_cidr</tabstop>
|
|
||||||
<tabstop>vpn_bypass_process</tabstop>
|
|
||||||
</tabstops>
|
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ void DialogEditProfile::typeSelected(const QString &newType) {
|
|||||||
ui->host->setText(stream->host);
|
ui->host->setText(stream->host);
|
||||||
ui->sni->setText(stream->sni);
|
ui->sni->setText(stream->sni);
|
||||||
ui->alpn->setText(stream->alpn);
|
ui->alpn->setText(stream->alpn);
|
||||||
|
ui->utls->setCurrentText(stream->utls);
|
||||||
ui->insecure->setChecked(stream->allow_insecure);
|
ui->insecure->setChecked(stream->allow_insecure);
|
||||||
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);
|
||||||
@@ -309,6 +310,7 @@ void DialogEditProfile::accept() {
|
|||||||
stream->host = ui->host->text();
|
stream->host = ui->host->text();
|
||||||
stream->sni = ui->sni->text();
|
stream->sni = ui->sni->text();
|
||||||
stream->alpn = ui->alpn->text();
|
stream->alpn = ui->alpn->text();
|
||||||
|
stream->utls = ui->utls->currentText();
|
||||||
stream->allow_insecure = ui->insecure->isChecked();
|
stream->allow_insecure = ui->insecure->isChecked();
|
||||||
stream->header_type = ui->header_type->currentText();
|
stream->header_type = ui->header_type->currentText();
|
||||||
stream->ws_early_data_name = ui->ws_early_data_name->text();
|
stream->ws_early_data_name = ui->ws_early_data_name->text();
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ serviceName (gRPC)
|
|||||||
key (QUIC)</string>
|
key (QUIC)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Path</string>
|
<string notr="true">Path</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -333,7 +333,7 @@ key (QUIC)</string>
|
|||||||
security (QUIC)</string>
|
security (QUIC)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Host</string>
|
<string notr="true">Host</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -346,10 +346,10 @@ security (QUIC)</string>
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string notr="true">伪装头部 (tcp/quic)</string>
|
<string notr="true">伪装头部类型 (tcp/quic)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string notr="true">headerType</string>
|
<string notr="true">header</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -415,14 +415,104 @@ security (QUIC)</string>
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="insecure">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="toolTip">
|
<item>
|
||||||
<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>
|
<widget class="QCheckBox" name="insecure">
|
||||||
</property>
|
<property name="sizePolicy">
|
||||||
<property name="text">
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
<string>Allow insecure</string>
|
<horstretch>0</horstretch>
|
||||||
</property>
|
<verstretch>0</verstretch>
|
||||||
</widget>
|
</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::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string notr="true">Currently only supported in sing-box core.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">uTLS</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="utls">
|
||||||
|
<property name="editable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">chrome</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">firefox</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">edge</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">safari</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">360</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">qq</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">ios</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">android</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">random</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="_3">
|
<layout class="QGridLayout" name="_3">
|
||||||
@@ -501,6 +591,7 @@ 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>utls</tabstop>
|
||||||
<tabstop>sni</tabstop>
|
<tabstop>sni</tabstop>
|
||||||
<tabstop>alpn</tabstop>
|
<tabstop>alpn</tabstop>
|
||||||
<tabstop>certificate_edit</tabstop>
|
<tabstop>certificate_edit</tabstop>
|
||||||
|
|||||||
@@ -1469,7 +1469,7 @@ bool MainWindow::StartVPNProcess() {
|
|||||||
WinCommander::runProcessElevated(QApplication::applicationDirPath() + "/nekobox_core.exe",
|
WinCommander::runProcessElevated(QApplication::applicationDirPath() + "/nekobox_core.exe",
|
||||||
{"--disable-color", "run", "-c", configPath},
|
{"--disable-color", "run", "-c", configPath},
|
||||||
"",
|
"",
|
||||||
NekoRay::dataStore->vpn_hide_consloe
|
NekoRay::dataStore->vpn_hide_console
|
||||||
); // blocking
|
); // blocking
|
||||||
vpn_pid = 0;
|
vpn_pid = 0;
|
||||||
runOnUiThread([=] {
|
runOnUiThread([=] {
|
||||||
|
|||||||
Reference in New Issue
Block a user