add: added External resolver, fixed DNS settings empty clientIP

This commit is contained in:
QwQ 2020-08-04 17:32:56 +08:00
parent 92a8b22f65
commit dde2849d49
No known key found for this signature in database
GPG Key ID: E7FAEFAFCD031D4B
4 changed files with 23 additions and 2 deletions

View File

@ -1 +1 @@
5854
5855

View File

@ -82,6 +82,23 @@ namespace Qv2ray::core::handler
return newOutbounds;
}
OUTBOUNDS RouteHandler::ExpandConnectionId(const OUTBOUNDS &outbounds) const
{
OUTBOUNDS result;
for (const auto &out : outbounds)
{
auto outObject = out.toObject();
const auto meta = OutboundObjectMeta::loadFromOutbound(OUTBOUND(outObject));
if (meta.metaType == METAOUTBOUND_EXTERNAL)
{
outObject = ConnectionManager->GetConnectionRoot(meta.connectionId)["outbounds"].toArray().first().toObject();
outObject["tag"] = meta.getDisplayName();
}
result << outObject;
}
return result;
}
OUTBOUNDS RouteHandler::ExpandProxyChains(const OUTBOUNDS &outbounds) const
{
QMap<QString, OUTBOUND> outboundMap;
@ -157,6 +174,7 @@ namespace Qv2ray::core::handler
routing["rules"] = newRules;
root["routing"] = routing;
root["outbounds"] = ExpandConnectionId(OUTBOUNDS(root["outbounds"].toArray()));
root["outbounds"] = ExpandProxyChains(OUTBOUNDS(root["outbounds"].toArray()));
}
else

View File

@ -24,6 +24,9 @@ namespace Qv2ray::core::handler
//
bool SetDNSSettings(const GroupRoutingId &id, bool overrideGlobal, const QvConfig_DNS &dns);
bool SetAdvancedRouteSettings(const GroupRoutingId &id, bool overrideGlobal, const QvConfig_Route &dns);
//
OUTBOUNDS ExpandConnectionId(const OUTBOUNDS &outbounds) const;
//
OUTBOUNDS ExpandProxyChains(const QMap<QString, OUTBOUND> &outbounds) const;
OUTBOUNDS ExpandProxyChains(const OUTBOUNDS &outbounds) const;
//

View File

@ -279,7 +279,7 @@ CONFIGROOT RouteEditor::OpenEditor()
outboundsArray.append(outboundJsonObject);
}
root["outbounds"] = outboundsArray;
root["dns"] = dnsWidget->GetDNSObject().toJson();
root["dns"] = GenerateDNS(false, dnsWidget->GetDNSObject());
return root;
}