Configuration Parameters Reference

This page is the complete reference for every parameter accepted by the CodexDNS JSON configuration file (default: config.json). Parameters are organized by functional group.

Every parameter can also be set via an environment variable — see Environment Variables for the naming convention and special variables.

The JSON config file is the bootstrap source: it is read once at startup. A subset of settings can also be changed at runtime via the Web UI without restarting — see Runtime Configuration.


Server

Core startup addresses and ports.

KeyTypeDefaultEnv VarDescription
http_portstring8080CODEXDNS_HTTP_PORTPort for the web UI and REST API
dns_hoststring0.0.0.0CODEXDNS_DNS_HOSTIP address the DNS server binds to
dns_portstring53CODEXDNS_DNS_PORTPort for the DNS server (UDP and TCP)

Web Server (HTTP / HTTPS)

KeyTypeDefaultEnv VarDescription
http_enabledbooltrueCODEXDNS_HTTP_ENABLEDEnable the HTTP web server
https_enabledboolfalseCODEXDNS_HTTPS_ENABLEDEnable the HTTPS web server
https_portint8443CODEXDNS_HTTPS_PORTHTTPS port number
https_cert_pathstringCODEXDNS_HTTPS_CERT_PATHCertificate file for the HTTPS listener (overrides tls_cert_path)
https_key_pathstringCODEXDNS_HTTPS_KEY_PATHPrivate key for the HTTPS listener (overrides tls_key_path)
http_redirect_to_httpsboolfalseCODEXDNS_HTTP_REDIRECT_TO_HTTPSRedirect all HTTP requests to HTTPS
hsts_enabledboolfalseCODEXDNS_HSTS_ENABLEDSend Strict-Transport-Security headers
hsts_max_age_secondsint31536000CODEXDNS_HSTS_MAX_AGE_SECONDSmax-age value for HSTS header (seconds)
gin_modestringreleaseCODEXDNS_GIN_MODEGin framework mode: debug, release, or test. Use release in production
session_secretstringCODEXDNS_SESSION_SECRETSecret key for signing sessions (minimum 32 characters). Set via env var only — never store in config file. Required in production; startup aborts if missing or too short. Generate: openssl rand -hex 32

TLS Certificates

Default certificate paths shared across all encrypted services (DoT, DoH, DoQ, HTTPS). Per-service overrides take precedence when set.

KeyTypeDefaultEnv VarDescription
tls_cert_pathstringCODEXDNS_TLS_CERT_PATHDefault TLS certificate file (PEM)
tls_key_pathstringCODEXDNS_TLS_KEY_PATHDefault TLS private key file (PEM)
tls_use_wildcardboolfalseCODEXDNS_TLS_USE_WILDCARDUse a wildcard certificate
tls_use_self_signedboolfalseCODEXDNS_TLS_USE_SELF_SIGNEDUse a self-signed certificate

Auto TLS (Let’s Encrypt)

KeyTypeDefaultEnv VarDescription
auto_tls_enabledboolfalseCODEXDNS_AUTO_TLS_ENABLEDEnable automatic certificate management via Let’s Encrypt
auto_tls_domainstringCODEXDNS_AUTO_TLS_DOMAINPrimary domain for the certificate (FQDN)
auto_tls_emailstringCODEXDNS_AUTO_TLS_EMAILContact email for expiry notifications
auto_tls_cache_dirstring./certs/autocertCODEXDNS_AUTO_TLS_CACHE_DIRDirectory to store issued certificates
auto_tls_stagingboolfalseCODEXDNS_AUTO_TLS_STAGINGUse Let’s Encrypt staging environment (for testing)
auto_tls_auto_renewbooltrueCODEXDNS_AUTO_TLS_AUTO_RENEWAutomatically renew certificates before expiry

DNS Protocols

UDP

KeyTypeDefaultEnv VarDescription
udp_enabledbooltrueCODEXDNS_UDP_ENABLEDEnable DNS over UDP
udp_addressstring0.0.0.0CODEXDNS_UDP_ADDRESSUDP listen address
udp_portint53CODEXDNS_UDP_PORTUDP port number

TCP

KeyTypeDefaultEnv VarDescription
tcp_enabledbooltrueCODEXDNS_TCP_ENABLEDEnable DNS over TCP
tcp_addressstring0.0.0.0CODEXDNS_TCP_ADDRESSTCP listen address
tcp_portint53CODEXDNS_TCP_PORTTCP port number

DNS-over-TLS (DoT)

KeyTypeDefaultEnv VarDescription
dot_enabledboolfalseCODEXDNS_DOT_ENABLEDEnable DNS-over-TLS
dot_addressstring0.0.0.0CODEXDNS_DOT_ADDRESSDoT listen address
dot_portint853CODEXDNS_DOT_PORTDoT port number
dot_cert_pathstringCODEXDNS_DOT_CERT_PATHCertificate for DoT (falls back to tls_cert_path)
dot_key_pathstringCODEXDNS_DOT_KEY_PATHPrivate key for DoT (falls back to tls_key_path)

DNS-over-HTTPS (DoH)

KeyTypeDefaultEnv VarDescription
doh_enabledboolfalseCODEXDNS_DOH_ENABLEDEnable DNS-over-HTTPS
doh_addressstring0.0.0.0CODEXDNS_DOH_ADDRESSDoH listen address
doh_portint443CODEXDNS_DOH_PORTDoH port number
doh_pathstring/dns-queryCODEXDNS_DOH_PATHURL path for the DoH endpoint
doh_http3_enabledboolfalseCODEXDNS_DOH_HTTP3_ENABLEDEnable HTTP/3 (QUIC) for DoH
doh_cert_pathstringCODEXDNS_DOH_CERT_PATHCertificate for DoH (falls back to tls_cert_path)
doh_key_pathstringCODEXDNS_DOH_KEY_PATHPrivate key for DoH (falls back to tls_key_path)

DNS-over-QUIC (DoQ)

KeyTypeDefaultEnv VarDescription
doq_enabledboolfalseCODEXDNS_DOQ_ENABLEDEnable DNS-over-QUIC
doq_addressstring0.0.0.0CODEXDNS_DOQ_ADDRESSDoQ listen address
doq_portint853CODEXDNS_DOQ_PORTDoQ port number
doq_cert_pathstringCODEXDNS_DOQ_CERT_PATHCertificate for DoQ (falls back to tls_cert_path)
doq_key_pathstringCODEXDNS_DOQ_KEY_PATHPrivate key for DoQ (falls back to tls_key_path)

DNS Server Tuning

Advanced parameters controlling DNS server concurrency, timeouts, and connection pooling.

KeyTypeDefaultRangeEnv VarDescription
dns_query_timeout_msint5000100–600000CODEXDNS_DNS_QUERY_TIMEOUT_MSMaximum time (ms) to process a DNS query before timing out
dns_tcp_read_timeout_msint5000100–600000CODEXDNS_DNS_TCP_READ_TIMEOUT_MSMaximum time (ms) to read a DNS query over TCP
dns_tcp_write_timeout_msint5000100–600000CODEXDNS_DNS_TCP_WRITE_TIMEOUT_MSMaximum time (ms) to write a DNS response over TCP
dns_tcp_idle_timeout_msint30000100–600000CODEXDNS_DNS_TCP_IDLE_TIMEOUT_MSMaximum idle time (ms) before closing a TCP connection
dns_max_concurrent_queriesint50001–100000CODEXDNS_DNS_MAX_CONCURRENT_QUERIESMaximum simultaneous DNS query handlers; requests are dropped above this limit
dns_goroutine_warn_thresholdint3000100–200000CODEXDNS_DNS_GOROUTINE_WARN_THRESHOLDLog a warning when total goroutine count exceeds this value
dns_upstream_max_concurrentint2000–100000CODEXDNS_DNS_UPSTREAM_MAX_CONCURRENTMaximum in-flight queries per upstream server (0 = unlimited)
dns_upstream_pool_minint00–1000CODEXDNS_DNS_UPSTREAM_POOL_MINMinimum idle DoT connections to keep per upstream server (0 = no warm pool)
dns_upstream_pool_maxint40–1000CODEXDNS_DNS_UPSTREAM_POOL_MAXMaximum idle DoT connections to keep per upstream server (0 = disable pooling)

Upstream DNS

KeyTypeDefaultEnv VarDescription
upstream_servers[]string["8.8.8.8:53", "1.1.1.1:53"]CODEXDNS_UPSTREAM_SERVERSDNS servers to forward queries to when no local authoritative record is found
upstream_strategystringorderedCODEXDNS_UPSTREAM_STRATEGYServer selection strategy: ordered, round-robin, fastest-response, lowest-latency
upstream_timeoutint5000CODEXDNS_UPSTREAM_TIMEOUTTimeout (ms) for upstream DNS queries (100–30000)
edns0_udp_sizeint1232CODEXDNS_EDNS0_UDP_SIZEEDNS0 UDP payload size advertised to upstream servers (512–4096). Recommended: 1232
local_records_overrideboolfalseCODEXDNS_LOCAL_RECORDS_OVERRIDECheck local authoritative records before forwarding to upstream
latency_measurement_intervalint30CODEXDNS_LATENCY_MEASUREMENT_INTERVALSeconds between upstream latency probes (10–300)

Cache

KeyTypeDefaultEnv VarDescription
cache_enabledbooltrueCODEXDNS_CACHE_ENABLEDEnable DNS response caching
cache_backendstringredisCODEXDNS_CACHE_BACKENDCache backend: redis, memory, or none
cache_forwarded_requestsbooltrueCODEXDNS_CACHE_FORWARDED_REQUESTSCache forwarded (non-authoritative) query responses
cache_ttlint300CODEXDNS_CACHE_TTLDefault TTL (s) for cached entries (1–86400)
cache_negative_ttlint60CODEXDNS_CACHE_NEGATIVE_TTLTTL (s) for NXDOMAIN and empty responses (0 = use cache_ttl)
cache_max_sizeint10000CODEXDNS_CACHE_MAX_SIZEMaximum number of cached entries
cache_memory_max_mbint100CODEXDNS_CACHE_MEMORY_MAX_MBMaximum memory (MB) for the memory cache backend
cache_eviction_policystringallkeys-lruCODEXDNS_CACHE_EVICTION_POLICYRedis eviction policy when memory limit is reached. Options: allkeys-lru, allkeys-lfu, allkeys-random, volatile-lru, volatile-lfu, volatile-random, volatile-ttl, noeviction
cache_local_lru_enabledbooltrueCODEXDNS_CACHE_LOCAL_LRU_ENABLEDEnable in-process LRU layer to short-circuit Redis for hot keys
cache_local_lru_max_entriesint2048CODEXDNS_CACHE_LOCAL_LRU_MAX_ENTRIESMaximum entries in the in-process LRU cache
cache_local_lru_ttlint5CODEXDNS_CACHE_LOCAL_LRU_TTLTTL (s) for in-process LRU entries (1–3600)
cache_redis_dial_timeout_msint2000CODEXDNS_CACHE_REDIS_DIAL_TIMEOUT_MSRedis connection dial timeout (ms) (100–10000)
cache_redis_read_timeout_msint1000CODEXDNS_CACHE_REDIS_READ_TIMEOUT_MSRedis read timeout (ms) (100–10000)
cache_redis_write_timeout_msint1000CODEXDNS_CACHE_REDIS_WRITE_TIMEOUT_MSRedis write timeout (ms) (100–10000)
cache_warmup_enabledbooltrueCODEXDNS_CACHE_WARMUP_ENABLEDPre-populate the cache on startup from most-queried domains
cache_warmup_domainsint100CODEXDNS_CACHE_WARMUP_DOMAINSNumber of top domains to pre-warm on startup (1–1000)

Database & Redis

KeyTypeDefaultEnv VarDescription
db_driverstringsqliteCODEXDNS_DB_DRIVERDatabase backend: sqlite, postgres, mysql, oracle
db_dsnstringcodexdns.dbCODEXDNS_DB_DSNConnection string for the chosen database backend. For SQLite: file path. For others: standard DSN
redis_addrstringlocalhost:6379CODEXDNS_REDIS_ADDRRedis server address (host:port) used for the redis cache backend

Logging

Log Paths

Each subsystem writes to its own log file. Paths are relative to the application working directory unless absolute.

KeyDefaultEnv VarDescription
application_log_pathlogs/application.logCODEXDNS_APPLICATION_LOG_PATHGeneral application logs (HTTP server, config, auth, services)
http_access_loglogs/access.logCODEXDNS_HTTP_ACCESS_LOGHTTP requests, status codes, response times
http_error_loglogs/error.logCODEXDNS_HTTP_ERROR_LOGHTTP errors, exceptions, middleware failures
dns_log_pathlogs/dns.logCODEXDNS_DNS_LOG_PATHDNS server start/stop, listener binding, protocol events
dns_query_log_pathlogs/dns_queries.logCODEXDNS_DNS_QUERY_LOG_PATHDNS query resolution, zone lookups, upstream forwarding
dns_query_failed_log_path(disabled)CODEXDNS_DNS_QUERY_FAILED_LOG_PATHFailed DNS queries (upstream timeouts, SERVFAIL, errors). Leave empty to disable
dhcp_log_pathlogs/dhcp.logCODEXDNS_DHCP_LOG_PATHDHCP requests, leases, lifecycle events
dhcp_dns_log_pathlogs/dhcp_dns.logCODEXDNS_DHCP_DNS_LOG_PATHRFC 2136 dynamic DNS updates from DHCP
ntp_log_pathlogs/ntp.logCODEXDNS_NTP_LOG_PATHNTP server operations, time sync, lifecycle events
ntp_query_log_path(disabled)CODEXDNS_NTP_QUERY_LOG_PATHIndividual NTP client requests and responses
cleanup_log_pathlogs/cleanup.logCODEXDNS_CLEANUP_LOG_PATHDatabase cleanup/purge operations
db_log_path(disabled)CODEXDNS_DB_LOG_PATHSQL queries and execution times
filter_log_pathlogs/filter.logCODEXDNS_FILTER_LOG_PATHBlocklist/allowlist matches, policy decisions, filter cache operations

Log Rotation

KeyTypeDefaultEnv VarDescription
log_levelstringinfoCODEXDNS_LOG_LEVELGlobal log level: debug, info, warn, error
log_max_size_mbint100CODEXDNS_LOG_MAX_SIZE_MBRotate log files when they exceed this size in MB (0 = disabled, max 10000)
log_max_backupsint10CODEXDNS_LOG_MAX_BACKUPSNumber of rotated backup files to keep (0 = unlimited)
log_max_age_daysint30CODEXDNS_LOG_MAX_AGE_DAYSDelete backup files older than this many days (0 = disabled)
log_compress_methodstringgzipCODEXDNS_LOG_COMPRESS_METHODCompression for rotated files: none or gzip

Note: log_compress (boolean) is deprecated. Use log_compress_method instead.


Debug Flags

Enable verbose diagnostic logging for individual subsystems without changing the global log level.

KeyDefaultEnv VarDescription
debug_dnsfalseCODEXDNS_DEBUG_DNSVerbose logging for DNS server operations
debug_resolverfalseCODEXDNS_DEBUG_RESOLVERVerbose logging for DNS resolver activity
debug_discoveryfalseCODEXDNS_DEBUG_DISCOVERYVerbose logging for hostname discovery (reverse DNS, NetBIOS, mDNS, LLMNR)
debug_cachefalseCODEXDNS_DEBUG_CACHEVerbose logging for cache operations
debug_httpfalseCODEXDNS_DEBUG_HTTPVerbose logging for HTTP requests and middleware
debug_ntpfalseCODEXDNS_DEBUG_NTPVerbose logging for NTP server operations
debug_dhcpfalseCODEXDNS_DEBUG_DHCPVerbose logging for DHCP server operations
debug_dhcp_dnsfalseCODEXDNS_DEBUG_DHCP_DNSVerbose logging for DHCP-DNS integration and dynamic record updates
debug_authfalseCODEXDNS_DEBUG_AUTHVerbose logging for authentication and permission checks
debug_latencyfalseCODEXDNS_DEBUG_LATENCYVerbose logging for upstream latency measurements
debug_dbfalseCODEXDNS_DEBUG_DBLog all SQL queries and execution times
debug_cleanupfalseCODEXDNS_DEBUG_CLEANUPVerbose logging for database cleanup operations
disable_limitsfalseCODEXDNS_DISABLE_LIMITSDisable all DNS concurrency and throttling limits. For load/stress testing only — never use in production

Monitoring

Prometheus

KeyTypeDefaultEnv VarDescription
prometheus_enabledboolfalseCODEXDNS_PROMETHEUS_ENABLEDEnable Prometheus /metrics endpoint on a dedicated port
prometheus_portint9190CODEXDNS_PROMETHEUS_PORTPort for the Prometheus metrics endpoint
prometheus_pathstring/metricsCODEXDNS_PROMETHEUS_PATHURL path for the metrics endpoint
prometheus_auth_tokenstringCODEXDNS_PROMETHEUS_AUTH_TOKENOptional Bearer token for metrics endpoint authentication. Leave empty for public access
prometheus_allowed_networksstringCODEXDNS_PROMETHEUS_ALLOWED_NETWORKSCIDR networks allowed to scrape metrics (newline-separated). Leave empty to allow any source
prometheus_use_forwarded_forboolfalseCODEXDNS_PROMETHEUS_USE_FORWARDED_FORParse X-Forwarded-For header for client IP detection (reverse proxy deployments)

pprof

⚠️ Security: Never expose pprof publicly in production. Restrict access via pprof_allowed_networks.

KeyTypeDefaultEnv VarDescription
pprof_enabledboolfalseCODEXDNS_PPROF_ENABLEDEnable Go pprof profiling endpoint on a dedicated port
pprof_portint6060CODEXDNS_PPROF_PORTPort for the pprof endpoint
pprof_allowed_networksstring127.0.0.1/8CODEXDNS_PPROF_ALLOWED_NETWORKSCIDR networks allowed to access pprof (newline-separated). Leave empty to allow any source

NTP Server

KeyTypeDefaultEnv VarDescription
ntp_enabledboolfalseCODEXDNS_NTP_ENABLEDEnable the built-in NTP server (RFC 5905)
ntp_listen_addressstring0.0.0.0CODEXDNS_NTP_LISTEN_ADDRESSIP address the NTP server binds to
ntp_listen_portint123CODEXDNS_NTP_LISTEN_PORTUDP port for the NTP server
ntp_protocolstringipv4CODEXDNS_NTP_PROTOCOLIP protocol version: ipv4, ipv6, or both
ntp_time_sync_enabledboolfalseCODEXDNS_NTP_TIME_SYNC_ENABLEDEnable upstream NTP time synchronization
ntp_time_sync_serverstringpool.ntp.org:123CODEXDNS_NTP_TIME_SYNC_SERVERUpstream NTP server (host:port) used to keep the system time updated
ntp_configure_systemboolfalseCODEXDNS_NTP_CONFIGURE_SYSTEMWrite /etc/chrony/chrony.conf and start chronyd. Requires root on Linux

Localization

KeyTypeDefaultEnv VarDescription
timezonestring(system default)CODEXDNS_TIMEZONEIANA timezone name for timestamp formatting (e.g. UTC, America/Sao_Paulo). Leave empty to use the system timezone

DHCP Built-in Server

Note: The built-in DHCP server is not yet fully implemented. This flag is locked to false in the UI.

KeyTypeDefaultEnv VarDescription
dhcp_enabledboolfalseCODEXDNS_DHCP_ENABLEDEnable the built-in DHCP server (not yet available)

DHCP Integration (RFC 2136 Dynamic DNS)

Accepts dynamic DNS update requests from external DHCP servers via RFC 2136.

KeyTypeDefaultEnv VarDescription
dhcp_int_enabledboolfalseCODEXDNS_DHCP_INT_ENABLEDEnable RFC 2136 dynamic DNS updates from external DHCP servers
dhcp_int_domainstringCODEXDNS_DHCP_INT_DOMAINDomain for DHCP client registrations (e.g. lan.example.com)
dhcp_int_listen_addressstring0.0.0.0CODEXDNS_DHCP_INT_LISTEN_ADDRESSIP address to accept DHCP-DNS update requests. Leave empty to use the main DNS address
dhcp_int_key_namestringCODEXDNS_DHCP_INT_KEY_NAMETSIG key name configured in your DHCP server
dhcp_int_key_secretstringCODEXDNS_DHCP_INT_KEY_SECRETBase64-encoded TSIG key secret. Treat as sensitive — prefer setting via env var
dhcp_int_key_algorithmstringhmac-sha256CODEXDNS_DHCP_INT_KEY_ALGORITHMHMAC algorithm for TSIG authentication: hmac-sha256, hmac-sha384, hmac-sha512
dhcp_int_default_ttlint3600CODEXDNS_DHCP_INT_DEFAULT_TTLTTL (s) for dynamically created DNS records (60–86400)
dhcp_int_reverse_zonestringCODEXDNS_DHCP_INT_REVERSE_ZONEReverse DNS zone for PTR records (e.g. 1.168.192.in-addr.arpa). Leave empty to auto-calculate
dhcp_int_auto_create_zoneboolfalseCODEXDNS_DHCP_INT_AUTO_CREATE_ZONEAutomatically create the DNS zone if it does not exist
dhcp_int_create_ptrbooltrueCODEXDNS_DHCP_INT_CREATE_PTRCreate PTR (reverse) records for DHCP leases
dhcp_int_update_client_namebooltrueCODEXDNS_DHCP_INT_UPDATE_CLIENT_NAMEUpdate client display names from DHCP hostnames (only when the name is system-generated and not locked)
dhcp_int_allowed_networksstringCODEXDNS_DHCP_INT_ALLOWED_NETWORKSCIDR networks allowed to send DHCP-DNS updates (newline-separated). Leave empty to allow any source
dhcp_int_cleanup_stalebooltrueCODEXDNS_DHCP_INT_CLEANUP_STALERemove DNS records that have not been refreshed within the cleanup window
dhcp_int_cleanup_after_hoursint168CODEXDNS_DHCP_INT_CLEANUP_AFTER_HOURSRemove stale DHCP-created records after this many hours without an update (1–8760)

Client Discovery

KeyTypeDefaultEnv VarDescription
discovery_enabledbooltrueCODEXDNS_DISCOVERY_ENABLEDEnable automatic client hostname discovery
discovery_methods[]string["reverse_dns", "netbios", "mdns", "llmnr"]CODEXDNS_DISCOVERY_METHODSOrdered list of discovery methods to try. Valid values: reverse_dns, netbios, mdns, llmnr, ssdp, dhcp, finger, arp
discovery_stop_on_firstbooltrueCODEXDNS_DISCOVERY_STOP_ON_FIRSTStop discovery after the first method successfully returns a hostname
discovery_timeoutint5000CODEXDNS_DISCOVERY_TIMEOUTTimeout (ms) for each individual discovery method (100–30000)

OUI (MAC Vendor Lookup)

KeyTypeDefaultEnv VarDescription
oui_enabledbooltrueCODEXDNS_OUI_ENABLEDEnable IEEE OUI database lookups for MAC address vendor identification
oui_auto_updateboolfalseCODEXDNS_OUI_AUTO_UPDATEAutomatically update the OUI database on startup if older than 7 days
oui_update_urlstringhttps://standards-oui.ieee.org/oui/oui.csvCODEXDNS_OUI_UPDATE_URLURL to download the OUI database from
oui_database_pathstringdata/oui.txtCODEXDNS_OUI_DATABASE_PATHLocal path where the OUI database file is stored

Authentication

WebAuthn (Passkeys)

KeyTypeDefaultEnv VarDescription
webauthn_rp_idstringlocalhostCODEXDNS_WEBAUTHN_RP_IDRelying Party ID — typically the bare domain name (e.g. example.com)
webauthn_rp_display_namestringCodexDNSCODEXDNS_WEBAUTHN_RP_DISPLAY_NAMEHuman-readable name shown in passkey prompts
webauthn_rp_origins[]string["http://localhost:8080"]CODEXDNS_WEBAUTHN_RP_ORIGINSAllowed origins for WebAuthn (must match the browser URL exactly)

Two-Factor Authentication (TOTP)

KeyTypeDefaultEnv VarDescription
twofa_issuerstringCodexDNSCODEXDNS_TWOFA_ISSUERIssuer name shown in authenticator apps (e.g. Google Authenticator)

Certificates

KeyTypeDefaultEnv VarDescription
certificate_import_on_startupboolfalseCODEXDNS_CERTIFICATE_IMPORT_ON_STARTUPScan the ./certs directory on startup and import any certificate/key pairs not already in the database

SMTP (Email)

Used for email-based 2FA codes and notifications.

KeyTypeDefaultEnv VarDescription
smtp_hoststringCODEXDNS_SMTP_HOSTSMTP server hostname or IP address
smtp_portint587CODEXDNS_SMTP_PORTSMTP port. Common values: 25 (SMTP), 465 (implicit TLS), 587 (STARTTLS)
smtp_usernamestringCODEXDNS_SMTP_USERNAMESMTP authentication username
smtp_passwordstringCODEXDNS_SMTP_PASSWORDSMTP authentication password. Treat as sensitive — prefer setting via env var
smtp_fromstringCODEXDNS_SMTP_FROMFrom email address for sent messages
smtp_from_namestringCodexDNSCODEXDNS_SMTP_FROM_NAMEFrom display name for sent messages
smtp_use_tlsbooltrueCODEXDNS_SMTP_USE_TLSUse implicit TLS (port 465). For STARTTLS (port 587), leave this false
smtp_skip_verifyboolfalseCODEXDNS_SMTP_SKIP_VERIFYSkip TLS certificate verification. Only use on trusted networks with self-signed certs

Filter & Blocking

KeyTypeDefaultEnv VarDescription
filter_enabledbooltrueCODEXDNS_FILTER_ENABLEDMaster switch for DNS filtering and blocklists
filter_load_modestringbackgroundCODEXDNS_FILTER_LOAD_MODEHow filter rules are loaded at startup: background (non-blocking), sync / blocking (wait for completion)
filter_cache_methodstringradixCODEXDNS_FILTER_CACHE_METHODData structure for wildcard domain matching: radix (recommended), trie, hashmap
filter_debugboolfalseCODEXDNS_FILTER_DEBUGEnable verbose logging for filter rule matching and cache operations
filter_update_interval_hoursint24CODEXDNS_FILTER_UPDATE_INTERVAL_HOURSHours between automatic filter list updates from remote sources (1–720, 0 = disable)
blocking_modestringnxdomainCODEXDNS_BLOCKING_MODEDNS response for blocked domains: nxdomain, refused, null_ip, custom_ip
blocking_ipv4string0.0.0.0CODEXDNS_BLOCKING_IPV4IPv4 address returned for blocked domains when blocking_mode is null_ip or custom_ip
blocking_ipv6string::CODEXDNS_BLOCKING_IPV6IPv6 address returned for blocked domains when blocking_mode is null_ip or custom_ip

Redirect DNS queries for major search engines to their safe search variants.

KeyDefaultEnv VarDescription
safe_search_enabledfalseCODEXDNS_SAFE_SEARCH_ENABLEDMaster switch for safe search enforcement across all supported engines
safe_search_googlefalseCODEXDNS_SAFE_SEARCH_GOOGLERedirect google.com (and TLDs) to forcesafesearch.google.com
safe_search_youtubefalseCODEXDNS_SAFE_SEARCH_YOUTUBERedirect youtube.com and youtu.be to restrictmoderate.youtube.com
safe_search_bingfalseCODEXDNS_SAFE_SEARCH_BINGRedirect bing.com to strict.bing.com
safe_search_duckduckgofalseCODEXDNS_SAFE_SEARCH_DUCKDUCKGORedirect duckduckgo.com with safe search enabled
safe_search_ecosiafalseCODEXDNS_SAFE_SEARCH_ECOSIARedirect ecosia.org with adult content disabled
safe_search_yandexfalseCODEXDNS_SAFE_SEARCH_YANDEXRedirect yandex.com and yandex.ru to family.yandex.com
safe_search_pixabayfalseCODEXDNS_SAFE_SEARCH_PIXABAYRedirect pixabay.com with safe search enabled

Blocked Services

KeyTypeDefaultEnv VarDescription
blocked_servicesmap[string]bool{}Map of service IDs to their blocked status. When a service ID is true, all DNS domains associated with that service are blocked. Examples: "facebook", "tiktok", "youtube"

Worker Pools

Fine-tune goroutine pool sizes for client tracking and hostname discovery.

KeyTypeDefaultRangeEnv VarDescription
client_tracking_workersint1001–500CODEXDNS_CLIENT_TRACKING_WORKERSGoroutines for processing client DNS query tracking events
client_tracking_queue_sizeint10000100–50000CODEXDNS_CLIENT_TRACKING_QUEUE_SIZEBuffer size for the client tracking work queue
client_discovery_workersint101–100CODEXDNS_CLIENT_DISCOVERY_WORKERSGoroutines for background client hostname discovery
client_discovery_queue_sizeint1000100–10000CODEXDNS_CLIENT_DISCOVERY_QUEUE_SIZEBuffer size for the discovery work queue

Stats & Maintenance

KeyTypeDefaultEnv VarDescription
stats_retention_daysint90CODEXDNS_STATS_RETENTION_DAYSDays to keep statistics data (0 = never purge, max 3650)
stats_async_enabledbooltrueCODEXDNS_STATS_ASYNC_ENABLEDBuffer stats updates asynchronously to reduce hot-path lock contention
stats_async_buffer_sizeint10000CODEXDNS_STATS_ASYNC_BUFFER_SIZEBuffered channel size for async stats updates (100–100000)
cleanup_interval_hoursint24CODEXDNS_CLEANUP_INTERVAL_HOURSHow often the database cleanup job runs, in hours (1–168)
cleanup_dns_query_retention_daysint30CODEXDNS_CLEANUP_DNS_QUERY_RETENTION_DAYSDays to retain DNS query log records (0 = never purge)
cleanup_client_history_retention_daysint90CODEXDNS_CLEANUP_CLIENT_HISTORY_RETENTION_DAYSDays to retain client history records (0 = never purge)
cleanup_dhcp_update_retention_daysint30CODEXDNS_CLEANUP_DHCP_UPDATE_RETENTION_DAYSDays to retain DHCP integration update logs (0 = never purge)
cleanup_vacuum_enabledbooltrueCODEXDNS_CLEANUP_VACUUM_ENABLEDRun SQLite VACUUM after cleanup to reclaim disk space (SQLite only)