@@ -131,11 +131,11 @@ namespace NekoRay {
131
131
132
132
#define DOMAIN_USER_RULE \
133
133
for (const auto &line: SplitLinesSkipSharp(dataStore->routing->proxy_domain)) { \
134
- if (dataStore->dns_routing ) status->domainListDNSRemote += line; \
134
+ if (dataStore->routing -> dns_routing ) status->domainListDNSRemote += line; \
135
135
status->domainListRemote += line; \
136
136
} \
137
137
for (const auto &line: SplitLinesSkipSharp(dataStore->routing->direct_domain)) { \
138
- if (dataStore->dns_routing ) status->domainListDNSDirect += line; \
138
+ if (dataStore->routing -> dns_routing ) status->domainListDNSDirect += line; \
139
139
status->domainListDirect += line; \
140
140
} \
141
141
for (const auto &line: SplitLinesSkipSharp(dataStore->routing->block_domain)) { \
@@ -166,7 +166,7 @@ namespace NekoRay {
166
166
: QJsonArray{" http" , " tls" , " quic" }},
167
167
{" enabled" , true },
168
168
{" metadataOnly" , false },
169
- {" routeOnly" , dataStore->sniffing_mode == SniffingMode::FOR_ROUTING},
169
+ {" routeOnly" , dataStore->routing -> sniffing_mode == SniffingMode::FOR_ROUTING},
170
170
};
171
171
172
172
// socks-in
@@ -177,7 +177,7 @@ namespace NekoRay {
177
177
inboundObj[" listen" ] = dataStore->inbound_address ;
178
178
inboundObj[" port" ] = dataStore->inbound_socks_port ;
179
179
QJsonObject socksSettings = {{" udp" , true }};
180
- if (dataStore->fake_dns || dataStore->sniffing_mode != SniffingMode::DISABLE) {
180
+ if (dataStore->fake_dns || dataStore->routing -> sniffing_mode != SniffingMode::DISABLE) {
181
181
inboundObj[" sniffing" ] = sniffing;
182
182
}
183
183
if (dataStore->inbound_auth ->NeedAuth ()) {
@@ -199,7 +199,7 @@ namespace NekoRay {
199
199
inboundObj[" protocol" ] = " http" ;
200
200
inboundObj[" listen" ] = dataStore->inbound_address ;
201
201
inboundObj[" port" ] = dataStore->inbound_http_port ;
202
- if (dataStore->sniffing_mode != SniffingMode::DISABLE) {
202
+ if (dataStore->routing -> sniffing_mode != SniffingMode::DISABLE) {
203
203
inboundObj[" sniffing" ] = sniffing;
204
204
}
205
205
if (dataStore->inbound_auth ->NeedAuth ()) {
@@ -274,13 +274,13 @@ namespace NekoRay {
274
274
275
275
// Remote or FakeDNS
276
276
QJsonObject dnsServerRemote;
277
- dnsServerRemote[" address" ] = dataStore->fake_dns ? " fakedns" : dataStore->remote_dns ;
277
+ dnsServerRemote[" address" ] = dataStore->fake_dns ? " fakedns" : dataStore->routing -> remote_dns ;
278
278
dnsServerRemote[" domains" ] = QList2QJsonArray<QString>(status->domainListDNSRemote );
279
- dnsServerRemote[" queryStrategy" ] = dataStore->remote_dns_strategy ;
279
+ dnsServerRemote[" queryStrategy" ] = dataStore->routing -> remote_dns_strategy ;
280
280
if (!status->forTest ) dnsServers += dnsServerRemote;
281
281
282
282
// Direct
283
- auto directDnsAddress = dataStore->direct_dns ;
283
+ auto directDnsAddress = dataStore->routing -> direct_dns ;
284
284
if (directDnsAddress.contains (" ://" )) {
285
285
auto directDnsIp = SubStrBefore (SubStrAfter (directDnsAddress, " ://" ), " /" );
286
286
if (IsIpAddress (directDnsIp)) {
@@ -306,18 +306,22 @@ namespace NekoRay {
306
306
dnsServers += QJsonObject{
307
307
{" address" , directDnsAddress.replace (" https://" , " https+local://" )},
308
308
{" fallbackStrategy" , " disabled" },
309
- {" queryStrategy" , dataStore->direct_dns_strategy },
309
+ {" queryStrategy" , dataStore->routing -> direct_dns_strategy },
310
310
{" domains" , QList2QJsonArray<QString>(status->domainListDNSDirect )},
311
311
};
312
312
313
313
dns[" fallbackStrategy" ] = " disabled_if_any_match" ;
314
314
dns[" servers" ] = dnsServers;
315
315
dns[" tag" ] = " dns" ;
316
+
317
+ if (dataStore->routing ->use_dns_object ) {
318
+ dns = QString2QJsonObject (dataStore->routing ->dns_object );
319
+ }
316
320
status->result ->coreConfig .insert (" dns" , dns);
317
321
318
322
// Routing
319
323
QJsonObject routing;
320
- routing[" domainStrategy" ] = dataStore->domain_strategy ;
324
+ routing[" domainStrategy" ] = dataStore->routing -> domain_strategy ;
321
325
routing[" domainMatcher" ] = " mph" ;
322
326
if (status->forTest ) routing[" domainStrategy" ] = " AsIs" ;
323
327
@@ -627,7 +631,7 @@ namespace NekoRay {
627
631
// common
628
632
if (IS_NEKO_BOX) {
629
633
// apply domain_strategy
630
- outbound[" domain_strategy" ] = dataStore->outbound_domain_strategy ;
634
+ outbound[" domain_strategy" ] = dataStore->routing -> outbound_domain_strategy ;
631
635
// apply mux
632
636
if (!muxApplied && needMux) {
633
637
auto muxObj = QJsonObject{
@@ -640,7 +644,7 @@ namespace NekoRay {
640
644
}
641
645
} else {
642
646
// apply domain_strategy
643
- if (!status->forTest ) outbound[" domainStrategy" ] = dataStore->outbound_domain_strategy ;
647
+ if (!status->forTest ) outbound[" domainStrategy" ] = dataStore->routing -> outbound_domain_strategy ;
644
648
// apply mux
645
649
if (!muxApplied && needMux) {
646
650
auto muxObj = QJsonObject{
@@ -695,9 +699,9 @@ namespace NekoRay {
695
699
inboundObj[" type" ] = " mixed" ;
696
700
inboundObj[" listen" ] = dataStore->inbound_address ;
697
701
inboundObj[" listen_port" ] = dataStore->inbound_socks_port ;
698
- if (dataStore->sniffing_mode != SniffingMode::DISABLE) {
702
+ if (dataStore->routing -> sniffing_mode != SniffingMode::DISABLE) {
699
703
inboundObj[" sniff" ] = true ;
700
- inboundObj[" sniff_override_destination" ] = dataStore->sniffing_mode == SniffingMode::FOR_DESTINATION;
704
+ inboundObj[" sniff_override_destination" ] = dataStore->routing -> sniffing_mode == SniffingMode::FOR_DESTINATION;
701
705
}
702
706
if (dataStore->inbound_auth ->NeedAuth ()) {
703
707
inboundObj[" users" ] = QJsonArray{
@@ -707,7 +711,7 @@ namespace NekoRay {
707
711
},
708
712
};
709
713
}
710
- inboundObj[" domain_strategy" ] = dataStore->domain_strategy ;
714
+ inboundObj[" domain_strategy" ] = dataStore->routing -> domain_strategy ;
711
715
status->inbounds += inboundObj;
712
716
}
713
717
@@ -724,11 +728,11 @@ namespace NekoRay {
724
728
inboundObj[" strict_route" ] = dataStore->vpn_strict_route ;
725
729
inboundObj[" inet4_address" ] = " 172.19.0.1/28" ;
726
730
if (dataStore->vpn_ipv6 ) inboundObj[" inet4_address" ] = " fdfe:dcba:9876::1/126" ;
727
- if (dataStore->sniffing_mode != SniffingMode::DISABLE) {
731
+ if (dataStore->routing -> sniffing_mode != SniffingMode::DISABLE) {
728
732
inboundObj[" sniff" ] = true ;
729
- inboundObj[" sniff_override_destination" ] = dataStore->sniffing_mode == SniffingMode::FOR_DESTINATION;
733
+ inboundObj[" sniff_override_destination" ] = dataStore->routing -> sniffing_mode == SniffingMode::FOR_DESTINATION;
730
734
}
731
- inboundObj[" domain_strategy" ] = dataStore->domain_strategy ;
735
+ inboundObj[" domain_strategy" ] = dataStore->routing -> domain_strategy ;
732
736
status->inbounds += inboundObj;
733
737
}
734
738
@@ -831,19 +835,19 @@ namespace NekoRay {
831
835
dnsServers += QJsonObject{
832
836
{" tag" , " dns-remote" },
833
837
{" address_resolver" , " dns-local" },
834
- {" strategy" , dataStore->remote_dns_strategy },
835
- {" address" , dataStore->remote_dns },
838
+ {" strategy" , dataStore->routing -> remote_dns_strategy },
839
+ {" address" , dataStore->routing -> remote_dns },
836
840
{" detour" , tagProxy},
837
841
};
838
842
839
843
// Direct
840
- auto directDNSAddress = dataStore->direct_dns ;
844
+ auto directDNSAddress = dataStore->routing -> direct_dns ;
841
845
if (directDNSAddress == " localhost" ) directDNSAddress = BOX_UNDERLYING_DNS_EXPORT;
842
846
if (!status->forTest )
843
847
dnsServers += QJsonObject{
844
848
{" tag" , " dns-direct" },
845
849
{" address_resolver" , " dns-local" },
846
- {" strategy" , dataStore->direct_dns_strategy },
850
+ {" strategy" , dataStore->routing -> direct_dns_strategy },
847
851
{" address" , directDNSAddress.replace (" +local://" , " ://" )},
848
852
{" detour" , " direct" },
849
853
};
@@ -868,6 +872,10 @@ namespace NekoRay {
868
872
869
873
dns[" servers" ] = dnsServers;
870
874
dns[" rules" ] = dnsRules;
875
+
876
+ if (dataStore->routing ->use_dns_object ) {
877
+ dns = QString2QJsonObject (dataStore->routing ->dns_object );
878
+ }
871
879
status->result ->coreConfig .insert (" dns" , dns);
872
880
873
881
// Routing
0 commit comments