### Allowlist Configuration Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Example of how to configure the 'list' property for IP addresses or CIDRs in the allowlist. ```yaml 'list': - '192.168.1.4' - '192.175.2.1/16' ``` -------------------------------- ### Device ID Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/querylog.md Example of the 'i' property, representing the detected device ID. ```text "dev1234" ``` -------------------------------- ### Requested Resource Name Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/querylog.md Example of the 'n' property, representing the requested resource name. ```text "example.com." ``` -------------------------------- ### Account ID Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/querylog.md Example of the 'ac' property, representing the detected account ID. ```text 1234 ``` -------------------------------- ### Network Interface Listener Configuration Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Example of configuring network interface listeners. Maps interface-listener IDs to their specific interface and port configurations. ```yaml list: 'eth0_plain_dns': interface: 'eth0' port: 53 'eth0_plain_dns_secondary': interface: 'eth0' port: 5353 ``` -------------------------------- ### DDR Device Records Configuration Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md This example demonstrates how to configure device-specific DDR records, mapping device ID wildcards to record templates. It includes settings for DoH, DoQ, and DoT ports, as well as IPv4 and IPv6 hints for the resolvers. ```yaml 'device_records': '*.d.dns.example.com': doh_path: '/dns-query{?dns}' https_port: 443 quic_port: 853 tls_port: 853 ipv4_hints: - 1.2.3.4 ipv6_hints: - '2001::1234' '*.e.dns.example.org': doh_path: '/dns-query{?dns}' https_port: 10443 quic_port: 10853 tls_port: 10853 ipv4_hints: - 5.6.7.8 ipv6_hints: - '2001::5678' ``` -------------------------------- ### Install and Configure DNSCrypt Source: https://github.com/adguardteam/adguarddns/blob/master/doc/development.md Installs the dnscrypt tool via Homebrew on macOS or manually on other Unix systems. Then, generates a DNSCrypt configuration file. ```bash brew install ameshkov/tap/dnscrypt ``` ```bash dnscrypt generate -p testdns -o ./dnscrypt.yml ``` -------------------------------- ### Resource Record Type Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/querylog.md Example of the 'q' property, representing the type of the resource record of the query (numeric value). ```text 1 ``` -------------------------------- ### Prometheus Metric Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md An example of how additional information is exposed as a Prometheus metric. ```none # HELP dns_app_additional_info A metric with a constant '1' value labeled by additional info provided in configuration # TYPE dns_app_additional_info gauge dns_app_additional_info{info_key_1="info_value_1",info_key_2="info_value_2"} 1 ``` -------------------------------- ### Socket Receive Buffer Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Sets the socket receive buffer size in a human-readable format. Default is zero for system defaults. Example: 1MB. ```text 1MB ``` -------------------------------- ### DNS Server Check API Request Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/http.md Example of how to make a request to the DNS server check API endpoint. ```sh curl 'https://0123-abcd-dnscheck.example.com/dnscheck/test' ``` -------------------------------- ### Example Value for TYPOSQUATTING_CACHE_COUNT Source: https://github.com/adguardteam/adguarddns/blob/master/doc/environment.md This example shows a valid integer value for the TYPOSQUATTING_CACHE_COUNT environment variable, which specifies the maximum number of entries in the typosquatting-filter results cache. ```shell 100000 ``` -------------------------------- ### Profile ID Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/querylog.md Example of the 'b' property, representing the detected profile ID (also known as DNS ID and DNS Server ID). ```text "prof1234" ``` -------------------------------- ### Run bindtodevice test script with sudo Source: https://github.com/adguardteam/adguarddns/blob/master/doc/development.md Execute the bindtodevice test script. Use this if your Docker installation requires sudo privileges. ```sh env USE_SUDO=1 sh ./scripts/test/bindtodevice.sh ``` -------------------------------- ### Request Timestamp Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/querylog.md Example of the 't' property, representing the Unix time in milliseconds when the request was received. ```text 1629974298000 ``` -------------------------------- ### IPv4 Connectivity Check Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Specifies the IPv4 address and port for connectivity checks. Example: 8.8.8.8:53. ```text 8.8.8.8:53 ``` -------------------------------- ### Blocked Question Domains Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md A list of domains or AdBlock rules to block requests. Examples include 'test.org' and '||example.org^$dnstype=AAAA'. ```text test.org ``` ```text ||example.org^$dnstype=AAAA ``` -------------------------------- ### Configure Inline Static Content Mapping Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Example configuration for inline static content mapping, including content and required headers. ```yaml static_content: '/favicon.ico': content: 'base64content' headers: 'Content-Type': - 'image/x-icon' ``` -------------------------------- ### DNS Server Check API Response Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/http.md Example JSON output from the DNS server check API, detailing connection and server information. ```json { "client_ip": "1.2.3.4", "device_id": "abcd1234", "profile_id": "defa5678", "protocol": "dot", "node_location": "ams", "node_name": "eu-1.dns.example.com", "server_group_name": "adguard_dns_default", "server_name": "default_dns", "server_type": "private", "tls_curve_id": "X25519MLKEM768" } ``` -------------------------------- ### Matched Rule Text Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/querylog.md Example of the 'm' property, representing the text of the first rule that matched the query. It can also contain the ID of a blocked service or a category ID. ```text "||example.com^" ``` -------------------------------- ### Blocked Client Subnets Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md A list of IP addresses or CIDR ranges to block. Example: 127.0.0.1. ```text 127.0.0.1 ``` -------------------------------- ### DNSDB Enabled Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Enables or disables the DNSDB in-memory buffer. Set to true to activate. ```yaml enabled: true ``` -------------------------------- ### Deduplication Integer Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/querylog.md Example of the 'rn' property, a random unsigned integer for easier deduplication. ```text 12345 ``` -------------------------------- ### AdGuard DNS Query Log Entry Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/querylog.md An example of a single log entry in the AdGuard DNS query log. This format is used for efficient logging and compression. ```jsonl {"b":"prof1234","i":"dev1234","c":"RU","d":"US","n":"example.com.","l":"cdef5678","m":"||example.com^","t":1628590394000,"a":1234,"e":5,"ac":1234,"q":1,"rn":1234,"f":2,"s":0,"st":1,"p":8,"r":0} ``` ```jsonl {"b":"prof1234","i":"dev1234","c":"RU","d":"JP","n":"example.org.","l":"hijk9012","m":"||example.org^","t":1628590394100,"a":6789,"e":6,"ac":1234,"q":1,"rn":56789,"f":2,"s":0,"st":0,"p":8,"r":0} ``` -------------------------------- ### Elapsed Time Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/querylog.md Example of the 'e' property, representing the time in milliseconds passed since the beginning of the request processing. ```text 3 ``` -------------------------------- ### IPv6 Connectivity Check Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Specifies the optional IPv6 address and port for connectivity checks. Required if any IPv6 address is present in bind_addresses. Example: [2001:4860:4860::8888]:53. ```text [2001:4860:4860::8888]:53 ``` -------------------------------- ### Blocked Service Match Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/querylog.md Example of the 'm' property when a request is blocked by the service blocker. The 'l' property indicates the 'blocked_service' type. ```text "example" ``` -------------------------------- ### Run bindtodevice test script without sudo Source: https://github.com/adguardteam/adguarddns/blob/master/doc/development.md Execute the bindtodevice test script. This assumes Docker is installed and configured to not require sudo. ```sh sh ./scripts/test/bindtodevice.sh ``` -------------------------------- ### Destination Country Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/querylog.md Example of the 'd' property, representing the detected country of the first IP address in the response. 'XK' is used for Kosovo and 'QN' for non-IP responses. ```text "US" ``` -------------------------------- ### Client Country Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/querylog.md Example of the 'c' property, representing the detected country of the client's IP address as an ISO 3166-1 alpha-2 country code. 'XK' is used for Kosovo. ```text "AU" ``` -------------------------------- ### Additional Metrics Info YAML Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Configuration for additional metrics information in YAML format. Keys must match the regex ^[a-zA-Z_][a-zA-Z0-9_]*$. ```yaml 'additional_metrics_info': 'info_key_1': 'info_value_1' 'info_key_2': 'info_value_2' ``` -------------------------------- ### Filtering Group Safe Browsing Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Example of configuring general safe browsing settings for a filtering group. Enables blocking of dangerous and newly registered domains. ```yaml safe_browsing: enabled: true block_dangerous_domains: true block_newly_registered_domains: true ``` -------------------------------- ### Filtering Group Rule List Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Example of configuring rule lists within a filtering group. Ensures that the specified rule list IDs are enforced. ```yaml rule_lists: enabled: true ids: [adguard_dns_default] ``` -------------------------------- ### Query Log File Enabled Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Enables or disables JSONL file query logging. Set to 'true' to activate. ```yaml 'file': 'enabled': true ``` -------------------------------- ### Debug Info: User Subdivision and Country Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debugdns.md This example demonstrates how both the user's country code and subdivision code are reported. Note that the subdivision field can be empty. ```none country.adguard-dns.com. 10 CH TXT "US" subdivision.adguard-dns.com. 10 CH TXT "CA" ``` -------------------------------- ### Configure Non-DoH Bind Addresses Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Example configuration for non-DoH bind addresses and optional TLS configuration for the web service. ```yaml 'non_doh_bind': - 'address': '127.0.0.1:80' - 'address': '127.0.0.1:443' 'certificate_groups': - 'name': 'example-cert' ``` -------------------------------- ### Debug Info: Device ID Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debugdns.md This example illustrates how a device ID, if detected by the server, is reported. It uses the `device-id.adguard-dns.com` FQDN. ```none device-id.adguard-dns.com. 10 CH TXT "dev1234" ``` -------------------------------- ### Configure Linked IP Web Server Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Example configuration for the optional linked IP web server, including bind addresses and TLS certificate groups. ```yaml 'linked_ip': 'bind': - 'address': '127.0.0.1:80' - 'address': '127.0.0.1:443' 'certificate_groups': - 'name': 'example-cert' ``` -------------------------------- ### DNS TXT Record for Short Rule Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debugdns.md Example of a DNS TXT record showing a rule shorter than 255 bytes applied to a query. ```none req.rule.adguard-dns.com. 10 CH TXT "||example.com^" ``` -------------------------------- ### Filtering Group Block Chrome Prefetch Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Example of blocking Chrome prefetch domain queries for a filtering group. This forces the prefetch proxy into preflight mode. ```yaml block_chrome_prefetch: true ``` -------------------------------- ### Filtering Group Parental Protection Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Example of configuring parental protection settings for a filtering group. Enables blocking of adult content and safe search features. ```yaml parental: enabled: true block_adult: true general_safe_search: true youtube_safe_search: true ``` -------------------------------- ### Run AdGuard DNS with Environment Variables Source: https://github.com/adguardteam/adguarddns/blob/master/doc/development.md This command demonstrates how to set numerous environment variables to configure AdGuard DNS. It includes URLs for various blocking and filtering services, cache paths, refresh intervals, and network listening parameters. Ensure all required environment variables are set according to your network setup and desired features. ```sh env \ ADULT_BLOCKING_URL='https://raw.githubusercontent.com/ameshkov/stuff/master/DNS/adult_blocking.txt' \ BILLSTAT_URL='grpc://localhost:6062' \ BLOCKED_SERVICE_INDEX_URL='https://adguardteam.github.io/HostlistsRegistry/assets/services.json' \ CATEGORY_FILTER_INDEX_URL='https://filters.adtidy.org/dns/category/filters.json' \ CONSUL_ALLOWLIST_URL='https://raw.githubusercontent.com/ameshkov/stuff/master/DNS/consul_allowlist.json' \ CONFIG_PATH='./config.yaml' \ CUSTOM_DOMAINS_CACHE_PATH='/path/to/cache' \ CUSTOM_DOMAINS_REFRESH_INTERVAL='5s' \ CUSTOM_DOMAINS_URL='grpc://127.0.0.1:6062' \ DNSCHECK_KV_TYPE='backend' \ DNSCHECK_KV_TTL='5s' \ DNSCHECK_REMOTEKV_URL='grpc://127.0.0.1:6062' \ RATELIMIT_ALLOWLIST_TYPE='backend' \ BACKEND_RATELIMIT_URL='grpc://127.0.0.1:6062' \ SESSION_TICKET_TYPE='local' \ SESSION_TICKET_REFRESH_INTERVAL='5s' \ STANDARD_ACCESS_TYPE='off' \ FILTER_INDEX_URL='https://adguardteam.github.io/HostlistsRegistry/assets/filters.json' \ FILTER_CACHE_PATH='./path/to/filter/cache' \ FILTER_CACHE_MAX_STALENESS='72h' \ FILTER_REFRESH_INTERVAL='5s' \ NEW_REG_DOMAINS_URL='https://raw.githubusercontent.com/ameshkov/stuff/master/DNS/nrd.txt' \ NODE_NAME='node_name' \ PROFILES_CACHE_TYPE='none' \ PROFILES_CACHE_PATH='./test/profilecache.pb' \ PROFILES_URL='grpc://localhost:6062' \ SAFE_BROWSING_URL='https://raw.githubusercontent.com/ameshkov/stuff/master/DNS/safe_browsing.txt' \ GENERAL_SAFE_SEARCH_URL='https://adguardteam.github.io/HostlistsRegistry/assets/engines_safe_search.txt' \ GEOIP_ASN_PATH='./test/GeoIP2-ISP-Test.mmdb' \ GEOIP_COUNTRY_PATH='./test/GeoIP2-City-Test.mmdb' \ QUERYLOG_PATH='./test/cache/querylog.jsonl' \ LINKED_IP_TARGET_URL='https://httpbin.agrd.workers.dev/anything' \ LISTEN_ADDR='127.0.0.1' \ LISTEN_PORT='8081' \ RULESTAT_URL='https://httpbin.agrd.workers.dev/post' \ SENTRY_DSN='https://1:1@localhost/1' \ VERBOSE='1' \ YOUTUBE_SAFE_SEARCH_URL='https://adguardteam.github.io/HostlistsRegistry/assets/youtube_safe_search.txt' \ ./agdns ``` -------------------------------- ### Backend Billing Statistics Interval Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Configures how often AdGuard DNS sends billing statistics to the backend. ```yaml bill_stat_interval: 1m ``` -------------------------------- ### Filter List ID Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/querylog.md Example of the 'l' property, representing the ID of the first filter rule that matched the query. Special values indicate specific filtering actions. ```text "adguard_dns_filter" ``` -------------------------------- ### DNS Handle Timeout Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Sets the overall timeout for processing a single DNS query. This does not include the time taken for writing to a connection. ```yaml handle_timeout: 1s ``` -------------------------------- ### Backend Refresh Interval Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Specifies how frequently AdGuard DNS checks the backend for data updates. ```yaml refresh_interval: 1m ``` -------------------------------- ### Debug Info: Client IP Address Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debugdns.md This example shows how the client's IP address is reported in the additional section of the DNS reply. It uses the `client-ip.adguard-dns.com` FQDN. ```none client-ip.adguard-dns.com. 10 CH TXT "127.0.0.1" ``` -------------------------------- ### GET /debug/pprof Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debughttp.md Provides access to the Go PProf HTTP API for profiling and debugging. ```APIDOC ## GET /debug/pprof ### Description The HTTP interface of Go's [PProf HTTP API][pprof api]. ### Method GET ### Endpoint /debug/pprof ``` -------------------------------- ### Configure Safe Browsing Block-Page Server Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Example configuration for the safe browsing block-page web server, specifying bind addresses and the block page file. ```yaml 'safe_browsing': 'bind': - 'address': '127.0.0.1:80' - 'address': '127.0.0.1:443' 'certificate_groups': - 'name': 'example-cert' 'block_page': '/var/www/block_page.html' ``` -------------------------------- ### Backend Request Timeout Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Configures the timeout for all outgoing HTTP requests to the backend. Set to '0s' to disable timeouts. ```yaml timeout: 10s ``` -------------------------------- ### Test DNSCrypt Lookup Source: https://github.com/adguardteam/adguarddns/blob/master/doc/development.md Perform a DNS lookup using DNSCrypt. Ensure you replace the example SDNS stamp with your own configuration. ```sh dnslookup example.org sdns://AQcAAAAAAAAADjEyNy4wLjAuMTo1NDQzIAbKgP3dmXybr1DaKIFgKjsc8zSFX4rgT_hFgymSq6w1FzIuZG5zY3J5cHQtY2VydC50ZXN0ZG5z ``` -------------------------------- ### Query Log Entry with Filter Details Source: https://github.com/adguardteam/adguarddns/blob/master/doc/querylog.md Example of a query log entry showing filter list ID and matched rule text. ```json { "l": "adguard_dns_filter", "m": "||example.com^", "...": "..." } ``` -------------------------------- ### Query Log Entry with Blocked Service Details Source: https://github.com/adguardteam/adguarddns/blob/master/doc/querylog.md Example of a query log entry when a service is blocked, showing the 'l' and 'm' properties. ```json { "l": "blocked_service", "m": "example", "...": "..." } ``` -------------------------------- ### DNS Read Timeout Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Sets the timeout for initial reads from UDP or TCP/TLS connections. Does not apply to DNSCrypt, QUIC, or HTTPS. ```yaml read_timeout: 2s ``` -------------------------------- ### Robots.txt Content for Block Pages Source: https://github.com/adguardteam/adguarddns/blob/master/doc/http.md This is the content served for GET /favicon.ico requests on block page servers. ```none User-agent: * Disallow: / ``` -------------------------------- ### Debug Info: User ASN Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debugdns.md This example shows the user's Autonomous System Number (ASN) as reported by the DNS server. It uses the `asn.adguard-dns.com` FQDN. ```none asn.adguard-dns.com. 10 CH TXT "1234" ``` -------------------------------- ### Block Pages - Robots.txt Source: https://github.com/adguardteam/adguarddns/blob/master/doc/http.md Handles GET /robots.txt requests by responding with a disallow all directive. ```APIDOC ## GET /robots.txt ### Description Responds with a disallow all directive for robots.txt requests. ### Method GET ### Endpoint /robots.txt ### Response #### Success Response (200) - **content** (string) - User-agent: * Disallow: / ``` -------------------------------- ### DNSDB Max Size Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Sets the maximum capacity for the DNSDB in-memory buffer. The key for records is a combination of hostname and record type. ```yaml max_size: 500000 ``` -------------------------------- ### Block Pages - Favicon.ico Source: https://github.com/adguardteam/adguarddns/blob/master/doc/http.md Handles GET /favicon.ico requests by responding with a plain-text 404 Not Found. ```APIDOC ## GET /favicon.ico ### Description Responds with a plain-text 404 Not Found for favicon requests. ### Method GET ### Endpoint /favicon.ico ``` -------------------------------- ### Debug Info: Server IP Address Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debugdns.md This example demonstrates how the IP address of the AdGuard DNS server handling the query is provided. It uses the `server-ip.adguard-dns.com` FQDN. ```none server-ip.adguard-dns.com. 10 CH TXT "127.0.0.1" ``` -------------------------------- ### DNS Max UDP Response Size Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Defines the maximum allowed size for DNS responses transmitted over UDP. ```yaml max_udp_response_size: 1024B ``` -------------------------------- ### DNS TXT Record for Long Rule (Split) Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debugdns.md Example of a DNS TXT record showing a rule longer than 255 bytes, split into multiple consecutive strings. ```none req.rule.adguard-dns.com. 0 CH TXT "||heregoesthefirstpartoftherule" "heregoesthesecondpartoftherule" ``` -------------------------------- ### DNS Write Timeout Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Specifies the timeout for writing data to UDP or TCP/TLS connections. Does not affect DNSCrypt, QUIC, or HTTPS. ```yaml write_timeout: 2s ``` -------------------------------- ### GET /metrics Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debughttp.md Exposes Prometheus metrics for the AdGuard DNS service. Refer to the metrics page for more details. ```APIDOC ## GET /metrics ### Description Prometheus metrics HTTP API. See the [metrics page][metrics] for more details. ### Method GET ### Endpoint /metrics ``` -------------------------------- ### Prepare TLS Certificate and Keys Source: https://github.com/adguardteam/adguarddns/blob/master/doc/development.md Creates a directory for test files, generates a self-signed TLS certificate and key, and creates TLS session tickets. ```bash mkdir test cd test ``` ```bash openssl req -nodes -new -x509 -keyout cert.key -out cert.crt ``` ```bash openssl rand 32 > ./tls_key_1 openssl rand 32 > ./tls_key_2 ``` -------------------------------- ### Backend Full Refresh Retry Interval Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Sets the waiting period before retrying a failed full profile synchronization. Should ideally be longer than 'refresh_interval'. ```yaml full_refresh_retry_interval: 1h ``` -------------------------------- ### DNS TXT Record for Rule List ID Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debugdns.md Example of a DNS TXT record showing the ID of the rule list that was applied to a query. ```none req.rule-list-id.adguard-dns.com. 10 CH TXT "adguard_dns_filter" ``` -------------------------------- ### Linked IP Proxy - Robots.txt Source: https://github.com/adguardteam/adguarddns/blob/master/doc/http.md Handles GET /robots.txt requests for the linked IP proxy by serving a disallow all directive. ```APIDOC ## GET /robots.txt (Linked IP Proxy) ### Description Serves a special response for robots.txt requests when the linked IP configuration is enabled. ### Method GET ### Endpoint /robots.txt ### Response #### Success Response (200) - **content** (string) - User-agent: * Disallow: / ``` -------------------------------- ### Generate Go Build Binary Source: https://github.com/adguardteam/adguarddns/blob/master/doc/development.md Builds the AdGuard DNS binary. Supports enabling the race detector and verbose mode. ```makefile make init ``` ```makefile make go-build ``` -------------------------------- ### AdGuard DNS Debugging Reply Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debugdns.md This is a sample reply from AdGuard DNS when a debugging query is performed. It includes standard DNS answer sections and additional debug information. ```none ;; Warning: Message parser reports malformed message packet. ; <<>> DiG 9.10.6 <<>> @127.0.0.1 -p 8182 example.com CH ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40344 ;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 3 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags: do; udp: 4096 ;; QUESTION SECTION: ;example.com. CH A ;; ANSWER SECTION: example.com. 17597 IN A 93.184.216.34 ;; ADDITIONAL SECTION: client-ip.adguard-dns.com. 10 CH TXT "127.0.0.1" server-ip.adguard-dns.com. 10 CH TXT "94.140.14.14" node-name.adguard-dns.com. 10 CH TXT "lon-1" resp.res-type.adguard-dns.com. 10 CH TXT "normal" ;; Query time: 26 msec ;; SERVER: dns.adguard-dns.com#53(127.0.0.1) ;; WHEN: Wed Oct 27 16:54:47 MSK 2021 ;; MSG SIZE rcvd: 166 ``` -------------------------------- ### Debug Info: User Country Code Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debugdns.md This example displays the user's country code as determined by the DNS server. It uses the `country.adguard-dns.com` FQDN. ```none country.adguard-dns.com. 10 CH TXT "CY" ``` -------------------------------- ### DNS TCP Idle Timeout Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Configures the timeout for subsequent reads on an established TCP/TLS connection. Not applicable to DNSCrypt, QUIC, or HTTPS. ```yaml tcp_idle_timeout: 30s ``` -------------------------------- ### Prepare Configuration and Test Data Source: https://github.com/adguardteam/adguarddns/blob/master/doc/development.md Copies the distribution configuration file to config.yaml and creates HTML files for various block pages and errors. ```bash cd ../ cp -f config.dist.yaml config.yaml ``` ```bash echo 'General content ahead' > ./test/block_page_general.html ``` ```bash echo 'Dangerous content ahead' > ./test/block_page_sb.html ``` ```bash echo 'Adult content ahead' > ./test/block_page_adult.html ``` ```bash echo 'Error 404' > ./test/error_404.html ``` ```bash echo 'Error 500' > ./test/error_500.html ``` -------------------------------- ### Linked IP Proxy - Get Link Source: https://github.com/adguardteam/adguarddns/blob/master/doc/http.md Proxies GET /linkip/{device_id}/{encrypted} requests. ```APIDOC ## GET /linkip/{device_id}/{encrypted} ### Description Proxies requests to get linked IP information. ### Method GET ### Endpoint /linkip/{device_id}/{encrypted} ### Parameters #### Path Parameters - **device_id** (string) - Required - The ID of the device. - **encrypted** (string) - Required - The encrypted identifier. ``` -------------------------------- ### Run Go tests for bindtodevice package Source: https://github.com/adguardteam/adguarddns/blob/master/doc/development.md Execute Go tests for the internal bindtodevice package within the Docker container environment. ```sh go test --cover -v ./internal/bindtodevice/ ``` -------------------------------- ### Backend Full Refresh Interval Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Determines how often AdGuard DNS performs a full profile refresh. If PROFILES_CACHE_PATH is set, the cache is saved after this. ```yaml full_refresh_interval: 24h ``` -------------------------------- ### Debug Info: Server Node Name Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debugdns.md This example shows the name of the specific AdGuard DNS server node that processed the query. It uses the `node-name.adguard-dns.com` FQDN. ```none node-name.adguard-dns.com. 10 CH TXT "lon-1" ``` -------------------------------- ### Prepare Cache Data and GeoIP Databases Source: https://github.com/adguardteam/adguarddns/blob/master/doc/development.md Removes and recreates the cache directory, then downloads test GeoIP databases for City, Country, and ISP. ```bash rm -f -r ./test/cache/ ``` ```bash mkdir ./test/cache ``` ```bash curl 'https://raw.githubusercontent.com/maxmind/MaxMind-DB/main/test-data/GeoIP2-Country-Test.mmdb' -o ./test/GeoIP2-Country-Test.mmdb ``` ```bash curl 'https://raw.githubusercontent.com/maxmind/MaxMind-DB/main/test-data/GeoIP2-City-Test.mmdb' -o ./test/GeoIP2-City-Test.mmdb ``` ```bash curl 'https://raw.githubusercontent.com/maxmind/MaxMind-DB/main/test-data/GeoIP2-ISP-Test.mmdb' -o ./test/GeoIP2-ISP-Test.mmdb ``` -------------------------------- ### Filtering Group Block Private Relay Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Example of blocking Apple Private Relay queries for a filtering group. ```yaml private_relay: false ``` -------------------------------- ### Safe Search DNS Rewrite Rules Source: https://github.com/adguardteam/adguarddns/blob/master/doc/externalhttp.md Example filtering rule list with $dnsrewrite rules for A, AAAA, or CNAME types, used for safe search endpoints. ```none |m.youtube.com^$dnsrewrite=NOERROR;CNAME;restrictmoderate.youtube.com |www.youtube-nocookie.com^$dnsrewrite=NOERROR;CNAME;restrictmoderate.youtube.com |www.youtube.com^$dnsrewrite=NOERROR;CNAME;restrictmoderate.youtube.com |youtube.googleapis.com^$dnsrewrite=NOERROR;CNAME;restrictmoderate.youtube.com |youtubei.googleapis.com^$dnsrewrite=NOERROR;CNAME;restrictmoderate.youtube.com ``` -------------------------------- ### Debug Info: Response Type (Blocked) Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debugdns.md This example shows a response type indicating that the request was blocked by a filter list or parental protection. It uses the `req.res-type.adguard-dns.com` FQDN. ```none req.res-type.adguard-dns.com. 10 CH TXT "blocked" ``` -------------------------------- ### Filtering Group Block Firefox Canary Example Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Example of blocking Firefox canary domain queries for a filtering group. ```yaml block_firefox_canary: true ``` -------------------------------- ### Debug Info: Profile ID Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debugdns.md This example shows the ID of the AdGuard DNS profile (or 'DNS server' in the UI) that handled the query. It uses the `profile-id.adguard-dns.com` FQDN. ```none profile-id.adguard-dns.com. 10 CH TXT "prof1234" ``` -------------------------------- ### Generate Protobuf Files with Specific Options Source: https://github.com/adguardteam/adguarddns/blob/master/doc/development.md Regenerates specific automatically generated Go files, such as protobuf definitions. Use the ONLY environment variable to select parts. ```makefile make ONLY='dnspb fcpb' go-gen ``` -------------------------------- ### Test DNS-over-QUIC (DoQ) Lookup Source: https://github.com/adguardteam/adguarddns/blob/master/doc/development.md Perform a DNS lookup using DNS-over-QUIC against a local AdGuard DNS instance. ```sh VERIFY=0 dnslookup example.org quic://127.0.0.1:8853 ``` -------------------------------- ### Linked IP Proxy - Status Source: https://github.com/adguardteam/adguarddns/blob/master/doc/http.md Proxies GET /linkip/{device_id}/{encrypted}/status requests. ```APIDOC ## GET /linkip/{device_id}/{encrypted}/status ### Description Proxies requests to check the status of a linked IP. ### Method GET ### Endpoint /linkip/{device_id}/{encrypted}/status ### Parameters #### Path Parameters - **device_id** (string) - Required - The ID of the device. - **encrypted** (string) - Required - The encrypted identifier. ``` -------------------------------- ### GET /debug/api/geoip Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debughttp.md Retrieves GeoIP information for specified IP addresses. Useful for debugging network-related issues. ```APIDOC ## GET /debug/api/geoip ### Description A debugging endpoint that returns GeoIP information for the provided IP addresses. ### Method GET ### Endpoint /debug/api/geoip ### Parameters #### Query Parameters - **ip** (string) - Required - IP address to get GeoIP information for. ### Request Example ```sh curl "http://${LISTEN_ADDR}:${LISTEN_PORT}/debug/api/geoip?ip=1.2.3.4&ip=2.3.4.5" ``` ### Response #### Success Response (200) - **data** (object) - Contains GeoIP information for each requested IP address. - **[ip_address]** (object) - GeoIP details for a specific IP. - **asn** (integer) - Autonomous System Number. - **country** (string) - Two-letter country code. - **continent** (string) - Two-letter continent code. - **replacement_subnets** (object) - Subnets for replacement. - **ipv4** (string) - IPv4 subnet. - **ipv6** (string) - IPv6 subnet. - **top_subdivision** (string) - Top-level administrative subdivision (e.g., state or province). - **error** (string) - Error message if GeoIP lookup failed for this IP. #### Response Example ```json { "data": { "1.2.3.4": { "asn": 123, "country": "US", "continent": "NA", "replacement_subnets": { "ipv4": "2.2.2.0/24", "ipv6": "2222::/56" }, "top_subdivision": "US-CA" }, "2.3.4.5": { "error": "some error" } } } ``` ``` -------------------------------- ### Run Linters and Tests Source: https://github.com/adguardteam/adguarddns/blob/master/doc/development.md Executes Go checkers, static analysis, tests, and benchmarks. Also includes a target for plain text checkers. ```makefile make go-lint ``` ```makefile make go-test ``` ```makefile make go-bench ``` ```makefile make test ``` ```makefile make txt-lint ``` -------------------------------- ### Get GeoIP Information Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debughttp.md Retrieve GeoIP information for specified IP addresses. Useful for debugging network-related issues. ```sh curl "http://${LISTEN_ADDR}:${LISTEN_PORT}/debug/api/geoip?ip=1.2.3.4&ip=2.3.4.5" ``` -------------------------------- ### Server Bind Interfaces Configuration Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Configures server listening interfaces using 'id' and 'subnets'. This should be used instead of 'bind_addresses'. ```yaml 'bind_interfaces': - 'id': 'eth0_plain_dns' 'subnets': - '172.17.0.0/16' - 'id': 'eth0_plain_dns_secondary' 'subnets': - '172.17.0.0/16' ``` -------------------------------- ### GET /health-check Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debughttp.md A simple health check API that always responds with a 200 OK status and the plain-text body OK. ```APIDOC ## GET /health-check ### Description A simple health check API. Always responds with a `200 OK` status and the plain-text body `OK`. ### Method GET ### Endpoint /health-check ``` -------------------------------- ### DNS Check Domains Configuration Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Configure domain suffixes for DNS check by prepending random IDs. Ensure domains are valid suffixes for testing. ```yaml 'domains': - 'dnscheck.example.com' - 'checkdns.example.com' ``` -------------------------------- ### Compile AdGuard DNS Source: https://github.com/adguardteam/adguarddns/blob/master/doc/development.md Compiles the AdGuard DNS application. ```makefile make build ``` -------------------------------- ### Override Healthcheck Network Type Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Optionally override the upstream's network type specifically for healthcheck queries. For example, setting it to 'tcp'. ```text tcp ``` -------------------------------- ### Enable QUIC Rate Limiting Source: https://github.com/adguardteam/adguarddns/blob/master/doc/configuration.md Enable rate limiting for QUIC connections. This controls the number of concurrent streams per peer. ```yaml quic: enabled: true ``` -------------------------------- ### Get DNSDB Statistics CSV Source: https://github.com/adguardteam/adguarddns/blob/master/doc/debughttp.md Retrieve a CSV dump of current DNSDB statistics. The response includes an 'X-Error' trailer for any errors encountered. ```csv example.com,A,NOERROR,93.184.216.34,42 example.com,AAAA,NOERROR,2606:2800:220:1:248:1893:25c8:1946,123 ``` -------------------------------- ### Test Plain DNS Lookup Source: https://github.com/adguardteam/adguarddns/blob/master/doc/development.md Use this command to perform a plain DNS lookup against a local AdGuard DNS instance. ```sh dnslookup example.org 127.0.0.1:5354 ```