lazydns

Hosts Plugin

The hosts plugin provides local name-to-IP mappings similar to /etc/hosts. It’s useful for local overrides, test environments, split-horizon behavior, or to block/redirect specific domains.

Features

Behavior

Hosts file syntax

Lines follow a flexible format similar to common hosts files:

Examples:

# IPv4 and IPv6 for localhost
127.0.0.1    localhost
::1          localhost ip6-localhost
# Multiple names on one line
93.184.216.34 example.com www.example.com
# Hostname-first example (supported)
example.org 203.0.113.5

The parser accepts both IP-first and hostname-first formats on the same line and will associate every hostname token with all parsed IPs on that line.

Configuration

The plugin supports the following configuration keys:

Example YAML configuration for the plugin:

plugins:
  - tag: hosts
    type: hosts
    args:
      files:
        - examples/etc/hosts.txt
      auto_reload: true

Notes:

Debugging and Troubleshooting

Best practices

See also