addition

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 1, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

README

CoreDNS Addition Plugin

Introduction

The CoreDNS addition plugin is designed to extend the upstream DNS response by adding a specified DNS address to the response. This plugin shares a similar syntax to the official template extension but requires an additional line to forward the DNS address. The main usage of this plugin is to enhance the upstream response with additional DNS information. For example, add your LAN IP for a homelab server.

Example

To use the addition plugin, include the following configuration in your CoreDNS configuration file Corefile

. {
    addition ANY ANY domain.duckdns.org {
      forward DNS_ADDRESS
      match "(\w*\.)?(domain\.duckdns\.org\.)$"
      answer "{{ .Name }} 3600 {{ .Class }} A 192.168.1.100"
    }
    forward . 1.1.1.1
}

Replace DNS_ADDRESS with the desired upstream IPv4 UDP DNS address.

License

This project is licensed under the Apache License, Version 2.0. See the LICENSE file for more details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	Zones []string

	Next      plugin.Handler
	Templates []template
}

Handler is a plugin handler that takes a query and templates a response.

func (Handler) Name

func (h Handler) Name() string

Name implements the plugin.Handler interface.

func (Handler) ServeDNS

func (h Handler) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)

ServeDNS implements the plugin.Handler interface.

type Upstreamer

type Upstreamer interface {
	Lookup(ctx context.Context, state request.Request, name string, typ uint16) (*dns.Msg, error)
}

Upstreamer looks up targets of CNAME templates

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL