mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2026-01-02 08:19:02 +08:00
Add remote ruleset support to simple rules
This commit is contained in:
parent
95463f1d50
commit
e8615de6b2
@ -26,7 +26,7 @@ namespace Configs {
|
||||
|
||||
namespace Information {
|
||||
inline QString HijackInfo = "Listens on the given addr:port (on Windows, port is always 53) and redirects the requests to the DNS module. Domains that match the rules will have their requests hijacked and the A and AAAA queries will be responded with the Inet4 response and Inet6 response respectively.\nThe Redirect settings sets up an inbound that listens on the given addr:port, sniffs the destination if possible and redirects the requests to their true destination.\nThe use case of these settings is apps that do not respect the system proxy for resolving their DNS requests (one such example is discord), You can hijack their DNS requests to 127.0.0.1 and then route them through the Throne tunnel. The same effect could be achieved using Tun mode, but one may not want to tunnel the whole device (For example when Gaming), this is where DNS hijack can transparently handle things.\n\nCurrently you can Automatically set the System DNS in windows.";
|
||||
inline QString SimpleRuleInfo = "You can add rules with the following format:\ndomain:<your-domain>\nsuffix:<your-domain-suffix>\nkeyword:<your-domain-keyword>\nregex:<your-domain-keyword>\nruleset:<ruleset-name>\nip:<ip-cidr>\nprocessName:<process name>\nprocessPath:<process path>\nRules are validated on tab change or when pressing ok.\nImportant: On saving the rules, the previous rules are discarded, meaning\nany changes made to the generated rules in the Advanced tab will be lost.";
|
||||
inline QString SimpleRuleInfo = "You can add rules with the following format:\ndomain:<your-domain>\nsuffix:<your-domain-suffix>\nkeyword:<your-domain-keyword>\nregex:<your-domain-keyword>\nruleset:<ruleset-name> or ruleset:<remote-ruleset-URL>\nip:<ip-cidr>\nprocessName:<process name>\nprocessPath:<process path>\nRules are validated on tab change or when pressing ok.\nImportant: On saving the rules, the previous rules are discarded, meaning\nany changes made to the generated rules in the Advanced tab will be lost.";
|
||||
}
|
||||
|
||||
namespace GeoAssets {
|
||||
|
||||
@ -838,10 +838,10 @@ namespace Configs {
|
||||
|
||||
bool RoutingChain::add_simple_address_rule(const QString& content, const std::shared_ptr<RouteRule>& rule)
|
||||
{
|
||||
auto sp = content.split(":");
|
||||
if (sp.size() != 2) return false;
|
||||
const QString& address = sp[1];
|
||||
const QString& subType = sp[0];
|
||||
auto colonIdx = content.indexOf(':');
|
||||
if (colonIdx == -1) return false;
|
||||
const QString& address = content.mid(colonIdx+1);
|
||||
const QString& subType = content.left(colonIdx);
|
||||
if (subType == "domain") {
|
||||
if (!rule->domain.contains(address)) rule->domain.append(address);
|
||||
return true;
|
||||
|
||||
@ -124,7 +124,7 @@ RouteItem::RouteItem(QWidget *parent, const std::shared_ptr<Configs::RoutingChai
|
||||
ui->def_out->setCurrentText(Configs::outboundIDToString(chain->defaultOutboundID));
|
||||
|
||||
// simple rules setup
|
||||
QStringList ruleItems = {"domain:", "suffix:", "regex:", "keyword:", "ip:", "processName:", "processPath:"};
|
||||
QStringList ruleItems = {"domain:", "suffix:", "regex:", "keyword:", "ip:", "processName:", "processPath:", "ruleset:"};
|
||||
for (const auto& geoIP : geoIpList) {
|
||||
ruleItems.append("ruleset:"+geoIP);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user