MCPcopy Index your code
hub / github.com/albertito/dnss

github.com/albertito/dnss @v0.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.1.0 ↗ · + Follow
251 symbols 1,067 edges 28 files 78 documented · 31%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

dnss

dnss is a daemon for using DNS over HTTPS.

It can act as a proxy, receiving DNS requests and resolving them using DNS-over-HTTPs (DoH). This can be useful to improve DNS security and privacy on laptops and small/home networks.

It can also act as a DoH server, in case you want end to end control.

Tests Go Report Card Coverage

Features

  • Supports the DNS Queries over HTTPS (DoH) standard (RFC 8484).
  • Local cache (optional).
  • HTTP(s) proxy support, autodetected from the environment.
  • Monitoring HTTP server, with exported variables and tracing to help debugging.
  • Separate resolution for specific domains, useful for home networks with local DNS servers.

Install

Debian/Ubuntu

The dnss package installs the daemon configured in proxy mode and ready to use, using Google's public resolvers (and easily changed via configuration).

sudo apt install dnss

Manual install

To clone the repository and build the binary:

git clone https://blitiri.com.ar/repos/dnss
cd dnss
go build

And if you want to configure the daemon to be automatically run by systemd:

# Copy the binary to a system-wide location.
sudo cp dnss /usr/local/bin/

# Set it up in systemd.
sudo cp etc/systemd/dns-to-https/*  /etc/systemd/system/

sudo systemctl dnss enable

On systems with SELinux, like Fedora, you might see hidden errors. In that case, run this to set the security context for the binary:

sudo semanage fcontext -a -t bin_t "/usr/local/bin/dnss"
sudo restorecon -v /usr/local/bin/dnss

Examples

DNS server (proxy mode)

Listens on port 53 for DNS queries, resolves them using the given HTTPS URL.

# Use the default HTTPS URL (currently, dns.google):
dnss -enable_dns_to_https

# Use Cloudflare's 1.1.1.1:
dnss -enable_dns_to_https -https_upstream="https://1.1.1.1/dns-query"

# Use Google's dns.google:
dnss -enable_dns_to_https -https_upstream="https://dns.google/dns-query"

# Use the default HTTPS URL for all resolutions, except for domain "myhome"
# which is resolved via a local DNS server.
dnss -enable_dns_to_https -dns_server_for_domain="myhome:10.0.1.1:53"

HTTPS server

Receives DNS over HTTPS requests, resolves them using the machine's configured DNS servers, and returns the replies. You will need to have certificates for the domains you want to serve.

Supports both DoH and JSON modes automatically, and the endpoints are /dns-query and /resolve.

# Serve DNS over HTTPS requests, take certificates from letsencrypt.
DOMAIN=yourdomain.com
dnss -enable_https_to_dns \
  -https_key=/etc/letsencrypt/live/$DOMAIN/privkey.pem \
  -https_cert=/etc/letsencrypt/live/$DOMAIN/fullchain.pem

Extension points exported contracts — how you extend this code

Resolver (Interface)
Resolver is the interface for DNS resolvers that can answer queries. [3 implementers]
internal/dnsserver/resolver.go
Trace (Interface)
Trace represents a single request trace. [1 implementers]
internal/nettrace/trace.go

Core symbols most depended-on inside this repo

Errorf
called by 120
internal/nettrace/trace.go
Printf
called by 72
internal/nettrace/trace.go
String
called by 40
internal/nettrace/trace.go
Finish
called by 39
internal/nettrace/trace.go
Error
called by 31
internal/trace/trace.go
Add
called by 30
internal/nettrace/trace.go
New
called by 27
internal/nettrace/trace.go
Set
called by 18
internal/dnsserver/domainmap.go

Shape

Function 146
Method 80
Struct 19
TypeAlias 4
Interface 2

Languages

Go100%

Modules by API surface

internal/nettrace/trace.go49 symbols
internal/dnsserver/resolver.go18 symbols
internal/dnsserver/caching_test.go16 symbols
internal/nettrace/http_test.go13 symbols
internal/nettrace/http.go13 symbols
internal/httpresolver/resolver_test.go13 symbols
internal/testutil/testutil.go12 symbols
internal/trace/trace.go11 symbols
internal/nettrace/test_server.go10 symbols
internal/httpresolver/resolver.go9 symbols
dnss_test.go9 symbols
tests/minidns.go8 symbols

For agents

$ claude mcp add dnss \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact