TechnitiumSoftware / DnsServer

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

Request geosite support #939

Closed mq00fc closed 3 months ago

mq00fc commented 3 months ago

Hello, I checked the project but didn't find any place to set geosite

GeoSite Or GeoIpIt is a site collection of regular VPN tools. Just enter geosite:google and all google domains will be mentioned

In addition to GFW, DNS pollution is also a very troublesome problem in China, so it needs to be handled separately. If you only set geoip:cn, then foreign companies such as Microsoft/Apple that have services in China will resolve to foreign servers

Currently using this project on my openwrt mosdns

When I go out, I can only use a not very robust DNS for diversion, so I want to deploy DNS (dot) on my server. Can you add this feature in the later version? Thank you

ShreyasZare commented 3 months ago

Thanks for the request. This is a very specific feature request and thus difficult to find time to implement it. I would suggest that you check the Advanced Forwarder app that is available with the DNS server and use some script to generate a json config for it so that you can forward DNS requests based on the domain names to different upstream servers.

mq00fc commented 3 months ago

Thanks for the request. This is a very specific feature request and thus difficult to find time to implement it. I would suggest that you check the Advanced Forwarder app that is available with the DNS server and use some script to generate a json config for it so that you can forward DNS requests based on the domain names to different upstream servers.

Thanks for your reply, that looks like a very good suggestion, I will try it later

mq00fc commented 3 months ago

The plugin seems to only match a single domain name, which gives me a headache and I can't achieve the functions I need. In the past two days, I have tried to carry out a new project

This file must be downloaded and placed in the root directory 【geosite.dat】

There is no performance optimization. Everything is just starting to achieve the most basic functions lol

GeoSmartDNS

This is a demo project, not extensively tested (tested udp on windows, tested doh on ubuntu22.04, no problems found so far), there is a memory leak problem, due to time constraints I can not further investigate

I used your TechnitiumLibrary to implement basic DNS resolution and response, and based on this, I completed the support for geosite and dot/doh, referring to your DNS-over-HTTPS

only need to set the json file to complete the upstream switching of different dns according to geosite:xxx or suffix, prefix, *,regex

like this

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*",
  "SmartDnsConfig": {
    "proxyServers": [
      {
        "name": "local-proxy",
        "type": "socks5",
        "proxyAddress": "localhost",
        "proxyPort": 1080,
        "proxyUsername": null,
        "proxyPassword": null
      }
    ],
    "dnsServers": [
      {
        "name": "cloudflare-dot",
        "proxy": "local-proxy",
        "dnssecValidation": true,
        "forwarderProtocol": "Tls",
        "forwarderAddresses": [
          "1.1.1.1",
          "1.0.0.1"
        ]
      },
      {
        "name": "cloudflare-doh",
        "proxy": "local-proxy",
        "dnssecValidation": true,
        "forwarderProtocol": "Https",
        "forwarderAddresses": [
          "1.1.1.1",
          "1.0.0.1"
        ]
      },
      {
        "name": "alidns-doh",
        "proxy": null,
        "dnssecValidation": true,
        "forwarderProtocol": "Https",
        "forwarderAddresses": [
          "223.5.5.5",
          "223.6.6.6"
        ]
      },
      {
        "name": "alidns-udp",
        "proxy": null,
        "dnssecValidation": true,
        "forwarderProtocol": "Udp",
        "forwarderAddresses": [
          "223.5.5.5",
          "223.6.6.6"
        ]
      }
    ],
    "rules": [
      {
        "domain": [
          "suffix:cn",
          "geosite:microsoft"
        ],
        "dnsServer": "alidns-doh"
      },
      {
        "domain": [
          "geosite:gfw"
        ],
        "dnsServer": "cloudflare-doh"
      },
      {
        "domain": [
          "geosite:google",
          "geosite:openai",
          "geosite:anthropic",
          "geosite:twitch",
          "geosite:twitter",
          "geosite:wikimedia",
          "geosite:github",
          "geosite:discord",
          "geosite:whatsapp",
          "geosite:tiktok",
          "geosite:facebook",
          "geosite:telegram",
          "geosite:reddit",
          "geosite:quora",
          "geosite:bing"
        ],
        "dnsServer": "cloudflare-doh"
      },
      {
        "domain": [
          "geosite:netflix",
          "geosite:disney"
        ],
        "dnsServer": "cloudflare-doh"
      },
      {
        "domain": [
          "suffix:kr",
          "suffix:kp",
          "suffix:jp",
          "suffix:tw",
          "suffix:ca",
          "suffix:ir",
          "suffix:sg",
          "suffix:ru",
          "suffix:in",
          "suffix:hk",
          "suffix:ne",
          "suffix:rw",
          "suffix:ac",
          "suffix:cc",
          "suffix:me",
          "suffix:io",
          "suffix:fr",
          "suffix:eu",
          "suffix:us",
          "suffix:de",
          "suffix:org",
          "suffix:dev"
        ],
        "dnsServer": "cloudflare-doh"
      },
      {
        "domain": [
          "*"
        ],
        "dnsServer": "alidns-doh"
      }
    ]
  }
}
ShreyasZare commented 3 months ago

Closing this issue since you have already created your own app.