AdguardTeam / AdGuardHome

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

Allow entering comments to the Upstreams box #2083

Closed emlimap closed 3 years ago

emlimap commented 4 years ago
  1. Comments support in upstream DNS box

At the moment the upstream DNS box parses lines that start with # or ! and throws an error message being unable to use that provider. Instead, it should ignore them when parsing similar to custom filtering rules box.

Comments are useful for a couple of use cases. 1st is to temporarily disable any upstream provider quickly by commenting it out. Other user case is to have comments for DNS stamps so you know which stamp is for which provider. At the moment you need to use the online decoder to find out.

  1. Option to specify multiple upstream servers for specific domain forwarding

At the moment, when specifying individual forwarding for specific domains the only way to specify backup upstream DNS servers is to duplicate the list and specify the backup DNS server. For example, at the moment it looks like this

[/example.com/example.net/]1.2.3.4
[/example.com/example.net/]5.6.7.8

It would be nice if we could specify multiple upstream DNS servers in one line. For example, something like below, separated by comma.

[/example.com/example.net/]1.2.3.4,5.6.7.8

The above example for unencrypted DNS but could be extended to support DoT, DoH & Dnscrypt

ameshkov commented 4 years ago

I like the idea about comments.

However, the second one is not too great, the syntax is already rather complicated, trying to fit everything in one line would make it really hard to understand what's written.

emlimap commented 4 years ago

Thinking about it. I think comments would definitely help with readability without the need for 2nd suggestion. Part of the reason for suggesting that was to declutter and improve readability of the list and comments will help with that. Something like this

# Use ISP DNS to get access to on-net Akamai cache
[/akamaized.net/akamaihd.net/akamai.net/akamaiedge.net/akadns.net/akahost.net/edgekey.net/]1.2.3.4
[/akamaized.net/akamaihd.net/akamai.net/akamaiedge.net/akadns.net/akahost.net/edgekey.net/]5.6.7.8
# CNAME's with Akamai/Edgecast
/media.dssott.com/hotstar.com/hotstarext.com/5centscdn.com/azureedge.net/footprint.net/1.2.3.4
/media.dssott.com/hotstar.com/hotstarext.com/5centscdn.com/azureedge.net/footprint.net/5.6.7.8
# Opennnic.org
[/bbs/chan/cyb/dyn/geek/gopher/indy/libre/neo/null/oss/oz/parody/pirate/]tls://dot.libredns.gr
[/bbs/chan/cyb/dyn/geek/gopher/indy/libre/neo/null/oss/oz/parody/pirate/]tls://ibksturm.synology.me
# Archive.is refuses to resolve when using Cloudflare DNS as they don't support EDNS client subnet
[/archive.today/archive.is/archive.fo/archive.li/archive.vn/archive.md/archive.ph/]tls://security-filter-dns.cleanbrowsing.org
[/archive.today/archive.is/archive.fo/archive.li/archive.vn/archive.md/archive.ph/]tls://dns.quad9.net

Another option that could help with making it easier for people to read and understand is syntax highlighting. Ublock origin has been doing some work in this area https://github.com/uBlockOrigin/uBlock-issues/issues/1134

For example in their rules section, they highlight action with different colours. Makes it easier to review rules as you end up with lot of rules when you use Ublock origin in medium mode image

The upstream DNS for specific domain forwarding can be different colour and comments can be in another colour. Maybe light colour for comments similar to above.

ameshkov commented 4 years ago

@ArtemBaskal

What needs to be done here:

  1. Change how the upstreams list is used on the server-side - filter out strings starting from # in the prepareUpstreamSettings function.
  2. You may also need to change the code that tests upstreams and filter out comments there (see handleTestUpstreamDNS function).
  3. Add simple color indication for comment lines -- they need to be gray
  4. Add # comment to the examples list below the field
  5. One more tiny little thing -- move the link to the list of known providers: https://uploads.adguard.com/up04_AdGuard_Home_6e324.png