Zone Handlers

The order of handler matters; Gravity will send a query to each handler in the order they are configured until a response is returned.

The handler configuration consists of a list of individual handler configurations. All list entries require a type attribute which must match one of the headers listed below. For example:

- cache_ttl: "3600"
  to: 8.8.8.8:53
  type: forward_blocky
- to: 8.8.8.8:53
  type: forward_ip

or

- type: memory
- type: etcd

etcd

Attempt to reply to query by looking for records in etcd. Keep in mind that because this is configured on zone level, this handler will only look for matching records in the current zone.

Configuration

None.

memory

Gravity watches the etcd database for changes and keeps all the records in memory. If this handler is enabled for a zone which has records in etcd, this handler will reply from memory.

Configuration

None.

forward_ip

Forward queries to another DNS server.

Configuration
  • to (required): List of DNS Servers to forward query to.

    Multiple servers should be separated by ;. For example 8.8.8.8:53;1.1.1.1.

  • cache_ttl: Optional TTL to cache responses in etcd.

    Defaults to 0. Attempts to cache for the TTL of the response. Set to -1 to never cache, and set to -2 to cache without a TTL.

Example
- type: forward_ip
  to: 8.8.8.8

forward_blocky

Forward queries to another DNS server via Blocky for advert/privacy blocking.

Configuration
Example
- type: forward_blocky
  to: 8.8.8.8
  blocklists: https://adaway.org/hosts.txt

coredns

Resolve queries by using a variety of CoreDNS Plugins. See here for all plugins.

Configuration
  • config: String configuration in the caddyfile format that is passed to CoreDNS.

    Example:

    .:1053 {
      whoami
    }
    

    Make sure your configuration uses a port other than the one Gravity uses to prevent any issues.

Example
- type: coredns
  config: |
    .:1053 {
      whoami
    }