This commit is contained in:
arm64v8a
2023-07-25 13:03:02 +09:00
parent ad00b8db74
commit e8147589f7
5 changed files with 144 additions and 117 deletions

View File

@@ -863,6 +863,13 @@ namespace NekoGui {
{"detour", "direct"},
};
// block
if (!status->forTest)
dnsServers += QJsonObject{
{"tag", "dns-block"},
{"address", "rcode://success"},
};
// Fakedns
if (dataStore->fake_dns && IS_NEKO_BOX_INTERNAL_TUN && dataStore->spmode_vpn && !status->forTest) {
dnsServers += QJsonObject{
@@ -893,6 +900,18 @@ namespace NekoGui {
add_rule_dns(status->domainListDNSRemote, "dns-remote");
add_rule_dns(status->domainListDNSDirect, "dns-direct");
// built-in rules
if (!status->forTest) {
dnsRules += QJsonObject{
{"query_type", QJsonArray{32, 33}},
{"server", "dns-block"},
};
dnsRules += QJsonObject{
{"domain_suffix", ".lan"},
{"server", "dns-block"},
};
}
// fakedns rule
if (dataStore->fake_dns && IS_NEKO_BOX_INTERNAL_TUN && dataStore->spmode_vpn && !status->forTest) {
dnsRules += QJsonObject{
@@ -1071,7 +1090,6 @@ namespace NekoGui {
.replace("%STRICT_ROUTE%", dataStore->vpn_strict_route ? "true" : "false")
.replace("%FINAL_OUT%", no_match_out)
.replace("%DNS_ADDRESS%", BOX_UNDERLYING_DNS)
.replace("%FAKE_DNS_ENABLE%", dataStore->fake_dns ? "true" : "false")
.replace("%FAKE_DNS_INBOUND%", dataStore->fake_dns ? "tun-in" : "empty")
.replace("%PORT%", Int2String(dataStore->inbound_socks_port));
// hook.js

View File

@@ -4,7 +4,7 @@
},
"dns": {
"fakeip": {
"enabled": %FAKE_DNS_ENABLE%,
"enabled": true,
"inet4_range": "198.18.0.0/15",
"inet6_range": "fc00::/18"
},
@@ -29,6 +29,13 @@
}
],
"rules": [
{
"query_type": [
32,
33
],
"server": "dns-block"
},
{
"domain_suffix": [
".lan"
@@ -132,9 +139,10 @@
"nekobox_core.exe"
],
"outbound": "direct"
},
}
//%PROCESS_NAME_RULE%
//%CIDR_RULE%
,
{
"port": 53,
"outbound": "dns-out"

View File

@@ -13,30 +13,34 @@
<property name="windowTitle">
<string notr="true">EditHysteria</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Hop Port</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="MyLineEdit" name="hopPort"/>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_8">
<item row="1" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Auth Type</string>
<string>Hop Interval (s)</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_3">
<item row="1" column="1">
<widget class="MyLineEdit" name="hopInterval"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Protocol</string>
<string>Upload (Mbps)</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="MyLineEdit" name="obfsPassword"/>
</item>
<item row="10" column="1">
<widget class="MyLineEdit" name="sni"/>
</item>
<item row="2" column="1">
<widget class="MyLineEdit" name="uploadMbps"/>
</item>
@@ -47,7 +51,17 @@
</property>
</widget>
</item>
<item row="5" column="1">
<item row="3" column="1">
<widget class="MyLineEdit" name="downloadMbps"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Protocol</string>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QComboBox" name="protocol">
@@ -83,24 +97,24 @@
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_11">
<item row="5" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Hop Interval (s)</string>
<string>Obfs Password</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="MyLineEdit" name="hopInterval"/>
<item row="5" column="1">
<widget class="MyLineEdit" name="obfsPassword"/>
</item>
<item row="13" column="0">
<widget class="QLabel" name="label_7">
<item row="6" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Certificate</string>
<string>Auth Type</string>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="6" column="1">
<widget class="QComboBox" name="authPayloadType">
<item>
<property name="text">
@@ -119,7 +133,37 @@
</item>
</widget>
</item>
<item row="12" column="1">
<item row="7" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Auth Payload</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="MyLineEdit" name="authPayload"/>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>SNI</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="MyLineEdit" name="sni"/>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_5">
<property name="toolTip">
<string notr="true">Only 1 value</string>
</property>
<property name="text">
<string notr="true">ALPN</string>
</property>
</widget>
</item>
<item row="9" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="MyLineEdit" name="alpn"/>
@@ -133,84 +177,40 @@
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<item row="10" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Hop Port</string>
<string>Certificate</string>
</property>
</widget>
</item>
<item row="13" column="1">
<item row="10" column="1">
<widget class="QPushButton" name="certificate">
<property name="text">
<string notr="true">PushButton</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Upload (Mbps)</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Obfs Password</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>SNI</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="MyLineEdit" name="downloadMbps"/>
</item>
<item row="12" column="0">
<widget class="QLabel" name="label_5">
<property name="toolTip">
<string notr="true">Only 1 value</string>
</property>
<property name="text">
<string notr="true">ALPN</string>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="MyLineEdit" name="streamReceiveWindow"/>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Auth Payload</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="MyLineEdit" name="authPayload"/>
</item>
<item row="15" column="1">
<widget class="MyLineEdit" name="connectionReceiveWindow"/>
</item>
<item row="14" column="0">
<item row="11" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string notr="true">recv_window</string>
</property>
</widget>
</item>
<item row="15" column="0">
<item row="11" column="1">
<widget class="MyLineEdit" name="streamReceiveWindow"/>
</item>
<item row="12" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string notr="true">recv_window_conn</string>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="MyLineEdit" name="connectionReceiveWindow"/>
</item>
</layout>
</widget>
<customwidgets>
@@ -221,10 +221,21 @@
</customwidget>
</customwidgets>
<tabstops>
<tabstop>hopPort</tabstop>
<tabstop>hopInterval</tabstop>
<tabstop>uploadMbps</tabstop>
<tabstop>downloadMbps</tabstop>
<tabstop>protocol</tabstop>
<tabstop>disableMtuDiscovery</tabstop>
<tabstop>obfsPassword</tabstop>
<tabstop>authPayloadType</tabstop>
<tabstop>authPayload</tabstop>
<tabstop>sni</tabstop>
<tabstop>alpn</tabstop>
<tabstop>allowInsecure</tabstop>
<tabstop>certificate</tabstop>
<tabstop>streamReceiveWindow</tabstop>
<tabstop>connectionReceiveWindow</tabstop>
</tabstops>
<resources/>
<connections/>

View File

@@ -13,14 +13,17 @@
<property name="windowTitle">
<string notr="true">EditNaive</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Protocol</string>
<string>Username</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="MyLineEdit" name="username"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
@@ -31,6 +34,13 @@
<item row="1" column="1">
<widget class="MyLineEdit" name="password"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Protocol</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="protocol">
<item>
@@ -52,13 +62,6 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>SNI</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="extra_headers">
<property name="text">
@@ -66,16 +69,13 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<item row="4" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Username</string>
<string>SNI</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="MyLineEdit" name="username"/>
</item>
<item row="4" column="1">
<widget class="MyLineEdit" name="sni"/>
</item>
@@ -86,6 +86,13 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="certificate">
<property name="text">
<string notr="true">PushButton</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
@@ -96,13 +103,6 @@
<item row="6" column="1">
<widget class="MyLineEdit" name="insecure_concurrency"/>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="certificate">
<property name="text">
<string notr="true">PushButton</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
@@ -112,15 +112,6 @@
<header>ui/widget/MyLineEdit.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>username</tabstop>
<tabstop>password</tabstop>
<tabstop>protocol</tabstop>
<tabstop>extra_headers</tabstop>
<tabstop>sni</tabstop>
<tabstop>certificate</tabstop>
<tabstop>insecure_concurrency</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -335,7 +335,6 @@ void MainWindow::neko_start(int _id) {
if (!mu_stopping.tryLock()) {
MessageBoxWarning(software_name, "Another profile is stopping...");
mu_starting.unlock();
mu_stopping.unlock();
return;
}
mu_stopping.unlock();