Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request / Pull Request #207

Open
apearson opened this issue Jan 8, 2025 · 0 comments
Open

Feature Request / Pull Request #207

apearson opened this issue Jan 8, 2025 · 0 comments

Comments

@apearson
Copy link

apearson commented Jan 8, 2025

Hi,

I have a fork with a feature I would like to propose and get feedback on. Let me know if you'd like me to open a pull request.

I welcome any feedback (good or bad) and understand if this not a direction you want to go with ctrld.

Feature

A ClientId is passed to DoH upstream

How

Use DoH with ClientId in:

Why

Initial Problem: AdGuard Home doesn't allow identifying clients by mac address unless you use their DHCP server. This forces users to identify clients by IP address or ClientId. Since IPv6 clients have an always changing IPv6 address, this causes users to not be able to keeps stats for IPv6 clients.

Solution: Using ctrld on the router allows ctrld to know the mac address and host name of the client which it can set as the client id and send to AdGuard Home to allow for IPv4 and IPv6 client stat tracking.

But Why?

Why would I want to enable a feature for AdGuard Home instead of forcing users to come to ControlD?
Same reason there's a NextDNS mode. Get AdGuard Home users using ctrld and maybe they'll check out this Control D thing.

Example

I've created a patch on my fork:
https://github.com/apearson/ctrld

Technical How

  • Reuse the upstream option send_client_info to enable sending client info (id)
  • Reuse the service option client_id_preference to choose what is chosen for the clientId
  • New upstream option client_id_type (headers, subdomain, path) to choose where the clientId goes
  • Modify the URL in the DoH resolve function
  • Send ControlD headers to 3rd party resolver if client_id_type is set to headers

Test Case

mac + path
mac + subdomain
mac + headers

host + path
host + subdomain
host + headers

hash(mac + host) + path
hash(mac + host) + subdomain
hash(mac + host) + headers

Notes

  • There are no tests for the fork's code
  • The code is currently running fine on my router (Unifi Cloud Gateway Max)
  • Could be expanded to DoT (NextDNS does not have a . between clientId and endpoint)
  • AdGuard Home needs 1 char shorter hash(mac + host) to work. I'm guessing this is a overflow on their side

Thank you,

Screenshot 2025-01-08 at 12 46 41 AM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant