AdguardTeam / AdGuardHome

Network-wide ads & trackers blocking DNS server
https://adguard.com/adguard-home.html
GNU General Public License v3.0
24.67k stars 1.79k forks source link

Additional per-upstream settings (ECS, IPv6, etc) #6150

Open hellodword opened 1 year ago

hellodword commented 1 year ago

Prerequisites

The problem

Now the dnsproxy parses the upstream_dns as url

https://github.com/AdguardTeam/dnsproxy/blob/c060c2a788d961f9291afc93d7954022fc52b2e3/upstream/upstream.go#L180-L210

But I think different upstreams may have different purposes.

For example:

I use the upstream 8.8.8.8, it supports edns-client-subnet:

# JP
dig google.com +short +subnet=142.250.206.0/24 @8.8.8.8

# EU
dig google.com +short +subnet=109.232.208.0/24 @8.8.8.8

My ip location is US, now I want to resolve A.domain as JP and resolve B.domain as EU.

Proposed solution

- server: tls://8.8.8.8
  group: main

- server: tls://1.1.1.1
  group: main

- server: tls://8.8.8.8
  group: main-ipv4
  aaaa_disabled: true

- server: tls://1.1.1.1
  group: main-ipv4
  aaaa_disabled: true

- server: tls://8.8.8.8
  name: google-jp
  edns_client_subnet:
      use_custom: true
      custom_ip: 142.250.206.0/24

- server: tls://8.8.8.8
  name: google-eu
  edns_client_subnet:
      use_custom: true
      custom_ip: 109.232.208.0/24

or

tls://8.8.8.8,group=main
tls://1.1.1.1,group=main
tls://8.8.8.8,group=main-ipv4,aaaa_disabled=true
tls://1.1.1.1,group=main-ipv4,aaaa_disabled=true
tls://8.8.8.8,name=google-jp,edns_client_subnet=142.250.206.0/24
tls://8.8.8.8,name=google-eu,edns_client_subnet=109.232.208.0/24

[/A.domain/]@google-jp
[/B.domain/]@google-eu
[/C.domain/]*main, all_servers
[/D.domain/]*main-ipv4, fastest_addr

The group is another feature for upstream dns rules.

We could make the rules more powerful.

Alternatives considered and additional information

No response

hellodword commented 1 year ago

How do you think?

I'd love to try my best to contribute.

ainar-g commented 1 year ago

Related:

That would be a significant overhaul that introduces a lot of new logic, so I don't think it should be going into the v0.108 cycle. Feel free to make a fork and implement that feature there, if you would like to.

hellodword commented 1 year ago

After an overview of dnsproxy today, I've realized that implementing these features might be challenging. 💪

I have a feeling that these tasks are going to take a long time :)