Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule process_name not working. #1574

Open
sub-kek opened this issue Jan 4, 2025 · 1 comment
Open

Rule process_name not working. #1574

sub-kek opened this issue Jan 4, 2025 · 1 comment

Comments

@sub-kek
Copy link

sub-kek commented Jan 4, 2025

Distro: Arch Linux
Kernel: 6.12.7-arch1-1
Arch: x86_64

When the server address includes a domain, nekobox_core cannot resolve it.
Maybe I'm a little dumb.

I think process_name not working for nekobox_core.

My DNS object:

{
  "servers": [
    {
      "tag": "cloudflare",
      "address": "1.1.1.1",
      "detour": "proxy"
    },
    {
      "tag": "cloudflare-tls",
      "address": "tls://cloudflare-dns.com",
      "address_resolver": "cloudflare",
      "detour": "proxy"
    },
    {
      "tag": "dns-direct",
      "address": "1.1.1.1",
      "detour": "direct"
    },
    {
      "tag": "dns-block",
      "address": "rcode://success"
    }
  ],
  "rules": [
    {
      "geosite": "private",
      "server": "dns-block"
    },
    {
      "domain_suffix": ".ru",
      "server": "dns-direct"
    },
    {
      "process_name": ["nekoray_core", "nekobox_core"],
      "server": "dns-direct"
    }
  ],
  "final": "cloudflare-tls"
}

My global routes:

{
  "rules": [
    {
      "geoip": "private",
      "outbound": "direct"
    },
    {
      "geosite": "private",
      "outbound": "direct"
    },
    {
      "domain_suffix": ".ru",
      "outbound": "direct"
    },
    {
      "process_name": [
        "nekoray_core",
        "nekobox_core"
      ],
      "outbound": "direct"
    }
  ],
  "auto_detect_interface": true,
  "final": "proxy"
}
@sub-kek
Copy link
Author

sub-kek commented Jan 6, 2025

True shitty but works

diff --git a/db/ConfigBuilder.cpp b/db/ConfigBuilder.cpp
index 379fff7..55fb50a 100644
--- a/db/ConfigBuilder.cpp
+++ b/db/ConfigBuilder.cpp
@@ -621,6 +621,25 @@ namespace NekoGui {
 
         if (dataStore->routing->use_dns_object) {
             dns = QString2QJsonObject(dataStore->routing->dns_object);
+
+            // std::cout << status->ent->bean->serverAddress.toStdString() << " Address\n";
+
+            auto dns_servers = dns["servers"].toArray();
+            auto dns_server = QJsonObject{
+                {"tag", "neko-dns-direct"},
+                {"address", "local"},
+                {"detour", "direct"},
+            };
+            dns_servers += dns_server;
+            dns["servers"] = dns_servers;
+
+            auto dns_rules = dns["rules"].toArray();
+            auto dns_rule = QJsonObject{
+                {"domain_suffix", status->ent->bean->serverAddress.toStdString().data()},
+                {"server", "neko-dns-direct"},
+            };
+            dns_rules += dns_rule;
+            dns["rules"] = dns_rules;
         }
         status->result->coreConfig.insert("dns", dns);

@sub-kek sub-kek changed the title Question about DNS object. Rule process_name not working. Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant