feat: utls

feat: vpn strict_route
This commit is contained in:
arm64v8a
2022-11-08 11:40:24 +09:00
parent 99c6a41c49
commit 9b7f982656
13 changed files with 131 additions and 61 deletions

View File

@@ -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;

View File

@@ -16,6 +16,7 @@
%IPV6_ADDRESS%
"mtu": %MTU%,
"auto_route": true,
"strict_route": %STRICT_ROUTE%,
"stack": "%STACK%",
"endpoint_independent_nat": true,
"sniff": false

View File

@@ -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);
}

View File

@@ -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();

View File

@@ -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));

View File

@@ -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 = "";

View File

@@ -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>

View File

@@ -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>

View File

@@ -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)

View File

@@ -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>

View File

@@ -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();

View File

@@ -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>
@@ -414,8 +414,16 @@ security (QUIC)</string>
<string>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>
@@ -424,6 +432,88 @@ security (QUIC)</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">
<item row="2" column="1">
@@ -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>

View File

@@ -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([=] {