TechnitiumSoftware / DnsServer

Technitium DNS Server
https://technitium.com/dns/
GNU General Public License v3.0
4.44k stars 431 forks source link

Some comments on Advanced Forwarding configFile functionality #571

Open liang-hiwin opened 1 year ago

liang-hiwin commented 1 year ago

By looking at [https://github.com/TechnitiumSoftware/DnsServer/issues/489], we know that dnsserver supports the function of importing a large number of forwarding domain names. The landlord @ Potterli20 provided adghome file is too large and not conducive to modification, you can do it in the next version improve. For example, support such writing:

{
  "enableForwarding": true,
  "proxyServers": [
    {
      "name": "local-proxy",
      "type": "socks5",
      "proxyAddress": "localhost",
      "proxyPort": 1080,
      "proxyUsername": null,
      "proxyPassword": null
    }
  ],
  "forwarders": [
    {
      "name": "quad9-doh",
      "proxy": null,
      "dnssecValidation": true,
      "forwarderProtocol": "Https",
      "forwarderAddresses": [
        "https://dns.quad9.net/dns-query (9.9.9.9)"
      ]
    },
    {
      "name": "cloudflare-google",
      "proxy": null,
      "dnssecValidation": true,
      "forwarderProtocol": "Tls",
      "forwarderAddresses": [
        "1.1.1.1",
        "8.8.8.8"
      ]
    },
    {
      "name": "quad9-tls-proxied",
      "proxy": "local-proxy",
      "dnssecValidation": true,
      "forwarderProtocol": "Tls",
      "forwarderAddresses": [
        "9.9.9.9"
      ]
    }
  ],
  "networkGroupMap": {
    "0.0.0.0/0": "everyone"
  },
  "groups": [
    {
      "name": "everyone",
      "enableForwarding": true,
      "forwardings": [
        {
          "forwarders": [
            "quad9-doh"
          ],
          "domains": [
            "example.com"
          ]
        },
        {
          "forwarders": [
            "cloudflare-google"
          ],
          "domains": [
            "example.net"
          ]
        }
      ],
      "adguardUpstreams": [
        {
          "proxy": null,
          "dnssecValidation": true,
          "configFile": "adguard-upstreams.txt"
        }
      ]
    }
  ],
#####new function############
      "domainUpstreams": [
        {
          "proxy": null,
          "dnssecValidation": true,
          "forwarders":  "quad9-doh,cloudflare-google,quad9-tls-proxied",    ###forword dns Upstreams
          "configFile": "domains.txt"         ###The content of the domains.txt file is a domain name per line or supports regular expressions
        }
      ]
    }
  ]
}
liang-hiwin commented 1 year ago

The domain name matching rules for the domains.txt file follow the following rules:

for example:
domain:google.com                     #####domian: can be omitted, it will match its own google.com, and its subdomain www.google.com, maps.l.google.com,

full:google.com                       ### will only match itself
keyword:google.com                  ### will match the domain name containing this field, such as google.com.hk, www.google.com.hk
regexp:.+\.google\.com$            ###regular match
ShreyasZare commented 1 year ago

Thanks for the post. Yes, the app needs some better way to have bulk domain list similar to adguard format. Will get something like you say added to it.

liang-hiwin commented 1 year ago

Thanks for the post. Yes, the app needs some better way to have bulk domain list similar to adguard format. Will get something like you say added to it.

Yes, the current plan is inconvenient to modify

liang-hiwin commented 1 year ago
          "domains": [
            "example.com"
          ]

I have a question, can the domain name "example.com" of the above code match "www.example.com", "example.com"?

ShreyasZare commented 1 year ago
          "domains": [
            "example.com"
          ]

I have a question, can the domain name "example.com" of the above code match "www.example.com", "example.com"?

Yes, the domain name and all of its subdomain names will be forwarded.

liang-hiwin commented 1 year ago
          "domains": [
            "example.com"
          ]

I have a question, can the domain name "example.com" of the above code match "www.example.com", "example.com"?

Yes, the domain name and all of its subdomain names will be forwarded.

I think when I forward a certain domain name request in Advanced Forwarding configuration, the Response Type type in the Query Logs app should be marked as Forward instead of Recursive,what do you think?

$EZ@UJA{R{2LGX(C7{9}JKB

ShreyasZare commented 1 year ago

I think when I forward a certain domain name request in Advanced Forwarding configuration, the Response Type type in the Query Logs app should be marked as Forward instead of Recursive,what do you think?

$EZ@UJA{R{2LGX(C7{9}JKB

The DNS server considers both recursive resolution and forwarding same for stats and logs. This is even true for DNS server's forwarders settings.

Potterli20 commented 1 year ago

Thanks for the post. Yes, the app needs some better way to have bulk domain list similar to adguard format. Will get something like you say added to it.

It is suggested to press this button first, otherwise my file cannot be enabled. Now my file has nearly reached 300m

ShreyasZare commented 1 year ago

Thanks for the post. Yes, the app needs some better way to have bulk domain list similar to adguard format. Will get something like you say added to it.

It is suggested to press this button first, otherwise my file cannot be enabled. Now my file has nearly reached 300m

If you open the app config and click save then it will attempt to reload the files immediately. But, it checks if the file has modified every minute too so it will auto reload within a minute when the file has changed.