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("%CIDR_RULE%", cidr_rule)
|
||||
.replace("%TUN_NAME%", tun_name)
|
||||
.replace("%STRICT_ROUTE%", dataStore->vpn_strict_route ? "true" : "false")
|
||||
.replace("%PORT%", Int2String(dataStore->inbound_socks_port));
|
||||
// write config
|
||||
QFile file;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
%IPV6_ADDRESS%
|
||||
"mtu": %MTU%,
|
||||
"auto_route": true,
|
||||
"strict_route": %STRICT_ROUTE%,
|
||||
"stack": "%STACK%",
|
||||
"endpoint_independent_nat": true,
|
||||
"sniff": false
|
||||
|
||||
@@ -36,6 +36,12 @@ namespace NekoRay::fmt {
|
||||
if (!alpn.trimmed().isEmpty()) {
|
||||
tls["alpn"] = QList2QJsonArray(alpn.split(","));
|
||||
}
|
||||
if (!utls.isEmpty()) {
|
||||
tls["utls"] = QJsonObject{
|
||||
{"enabled", true},
|
||||
{"fingerprint", utls},
|
||||
};
|
||||
}
|
||||
outbound->insert("tls", tls);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace NekoRay::fmt {
|
||||
QString sni = "";
|
||||
QString alpn = "";
|
||||
QString certificate = "";
|
||||
QString utls = "";
|
||||
bool allow_insecure = false;
|
||||
// ws early data
|
||||
QString ws_early_data_name = "";
|
||||
@@ -35,6 +36,7 @@ namespace NekoRay::fmt {
|
||||
_add(new configItem("h_type", &header_type, 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("utls", &utls, itemType::string));
|
||||
}
|
||||
|
||||
QJsonObject BuildStreamSettingsV2Ray();
|
||||
|
||||
@@ -54,7 +54,8 @@ namespace NekoRay {
|
||||
_add(new configItem("vpn_impl", &vpn_implementation, itemType::integer));
|
||||
_add(new configItem("vpn_mtu", &vpn_mtu, itemType::integer));
|
||||
_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_cidr", &vpn_bypass_cidr, itemType::string));
|
||||
_add(new configItem("check_include_pre", &check_include_pre, itemType::boolean));
|
||||
|
||||
@@ -112,7 +112,8 @@ namespace NekoRay {
|
||||
int vpn_implementation = 0;
|
||||
int vpn_mtu = 9000;
|
||||
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_cidr = "";
|
||||
|
||||
|
||||
@@ -341,14 +341,6 @@
|
||||
<source>Already set</source>
|
||||
<translation>已设置</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Path</source>
|
||||
<translation>路径(Path)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Host</source>
|
||||
<translation>主机(Host)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Packet Encoding</source>
|
||||
<translation>包编码</translation>
|
||||
|
||||
@@ -598,33 +598,6 @@
|
||||
<header>ui/widget/MyLineEdit.h</header>
|
||||
</customwidget>
|
||||
</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/>
|
||||
<connections>
|
||||
<connection>
|
||||
|
||||
@@ -14,10 +14,11 @@ DialogVPNSettings::DialogVPNSettings(QWidget *parent) :
|
||||
ui->vpn_implementation->setCurrentIndex(NekoRay::dataStore->vpn_implementation);
|
||||
ui->vpn_mtu->setCurrentText(Int2String(NekoRay::dataStore->vpn_mtu));
|
||||
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
|
||||
ui->hide_console->setVisible(false);
|
||||
#endif
|
||||
ui->strict_route->setChecked(NekoRay::dataStore->vpn_strict_route);
|
||||
//
|
||||
D_LOAD_STRING(vpn_bypass_cidr)
|
||||
D_LOAD_STRING(vpn_bypass_process)
|
||||
@@ -35,7 +36,8 @@ void DialogVPNSettings::accept() {
|
||||
NekoRay::dataStore->fake_dns = ui->fake_dns->isChecked();
|
||||
NekoRay::dataStore->vpn_mtu = mtu;
|
||||
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_process)
|
||||
|
||||
@@ -107,6 +107,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="strict_route">
|
||||
<property name="text">
|
||||
<string notr="true">Strict Route</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -147,15 +154,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</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/>
|
||||
<connections>
|
||||
<connection>
|
||||
|
||||
@@ -190,6 +190,7 @@ void DialogEditProfile::typeSelected(const QString &newType) {
|
||||
ui->host->setText(stream->host);
|
||||
ui->sni->setText(stream->sni);
|
||||
ui->alpn->setText(stream->alpn);
|
||||
ui->utls->setCurrentText(stream->utls);
|
||||
ui->insecure->setChecked(stream->allow_insecure);
|
||||
ui->header_type->setCurrentText(stream->header_type);
|
||||
ui->ws_early_data_name->setText(stream->ws_early_data_name);
|
||||
@@ -309,6 +310,7 @@ void DialogEditProfile::accept() {
|
||||
stream->host = ui->host->text();
|
||||
stream->sni = ui->sni->text();
|
||||
stream->alpn = ui->alpn->text();
|
||||
stream->utls = ui->utls->currentText();
|
||||
stream->allow_insecure = ui->insecure->isChecked();
|
||||
stream->header_type = ui->header_type->currentText();
|
||||
stream->ws_early_data_name = ui->ws_early_data_name->text();
|
||||
|
||||
@@ -319,7 +319,7 @@ serviceName (gRPC)
|
||||
key (QUIC)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Path</string>
|
||||
<string notr="true">Path</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -333,7 +333,7 @@ key (QUIC)</string>
|
||||
security (QUIC)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Host</string>
|
||||
<string notr="true">Host</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -346,10 +346,10 @@ security (QUIC)</string>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string notr="true">伪装头部 (tcp/quic)</string>
|
||||
<string notr="true">伪装头部类型 (tcp/quic)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">headerType</string>
|
||||
<string notr="true">header</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -415,14 +415,104 @@ security (QUIC)</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="insecure">
|
||||
<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>
|
||||
<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::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>
|
||||
<layout class="QGridLayout" name="_3">
|
||||
@@ -501,6 +591,7 @@ security (QUIC)</string>
|
||||
<tabstop>ws_early_data_length</tabstop>
|
||||
<tabstop>ws_early_data_name</tabstop>
|
||||
<tabstop>insecure</tabstop>
|
||||
<tabstop>utls</tabstop>
|
||||
<tabstop>sni</tabstop>
|
||||
<tabstop>alpn</tabstop>
|
||||
<tabstop>certificate_edit</tabstop>
|
||||
|
||||
@@ -1469,7 +1469,7 @@ bool MainWindow::StartVPNProcess() {
|
||||
WinCommander::runProcessElevated(QApplication::applicationDirPath() + "/nekobox_core.exe",
|
||||
{"--disable-color", "run", "-c", configPath},
|
||||
"",
|
||||
NekoRay::dataStore->vpn_hide_consloe
|
||||
NekoRay::dataStore->vpn_hide_console
|
||||
); // blocking
|
||||
vpn_pid = 0;
|
||||
runOnUiThread([=] {
|
||||
|
||||
Reference in New Issue
Block a user