AdguardTeam / AdguardTeam/AdGuardHome

Specific upstream for specific IP ranges.

未关闭
#4,726 3 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
feature request
主要语言
TypeScript
星标
36.9k
派生
2.5k
PR 合并指标
30 天内没有已合并 PR

描述

### Problem Description
AdGuardHome can use different upstream servers for different client requests, but here's about responses. Like I said in https://github.com/AdguardTeam/AdGuardHome/issues/4489:

> As we know, AdGuardHome can set specific upstream for specific domains, but sometimes we need specify upstream for a specific type. For example, we have IPv4 and IPv6 connections, but from different ISP, so we can set specific upstream for A/AAAA to improve our network. Another example, we use something like HE tunnel or Cloudflare WARP to get IPv6 connection, we can also set specific upstreams for them :)

In the actual network environment, in addition to the fact that IPv4 and IPv6 are provided by different ISPs, in fact IPv4 or IPv6 itself may be provided by multiple ISPs too, they are each more friendly to their own IP ranges. For example, when I use both the local ISP's network and Cloudflare WARP, I tend to prefer the local ISP's network for sites or services within its IP range, Cloudflare WARP for others. For best experience, we should send a request to the local ISP's DNS server first, and determine if the response is in the specified IP range, if so, use it, and if not, use other DNS servers (Cloudflare Public DNS in this example) to get a more friendly DNS record for Cloudflare WARP.

This also helps to solve the problem of confusion between private and public domains in some cases, such as schools or companies resolve some domains to `10.0.0.0/8` and so on, if I want to use the school or company's internal services, then I have to use internal DNS servers, but they tend to be pretty bad at resolving other domains. Of course, we can specify internal DNS servers for these domains used by internal services, but when there are more of these domains, or in conjunction with public domains, the situation becomes different. If we can specify an available IP range for the internal DNS server, we can use it only for internal services, send a request and determine whether the response belongs to `10.0.0.0/8`, if so, use it, if not, request other servers.

### Proposed Solution
Allows setting available IP ranges for DNS servers in Upstream DNS settings, in this case, if the result returned by this DNS upstream does not belong to the specified IP range, it will not be used. Actually, [shawn1m/overture](https://github.com/shawn1m/overture#dispatch-process) does already have this feature, which is a customized DNS relay server written by Golang too.

### Alternatives Considered
Fastest IP mode may solve this problem in some cases, but when there is a VPN or transparent proxy in the network environment, Fastest IP mode does not work fine. And Fastest IP mode is also not very suitable for using internal DNS for internal services.

### Additional Information
Here is another open source DNS server [pymumu/smartdns](https://github.com/pymumu/smartdns) written in C that implements this feature and introduces Fasest IP mode.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。