url

package
v0.5.26 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: BSD-3-Clause Imports: 18 Imported by: 0

README

Name

url - serve zone data from an URL

Description

The url handler is used for serving zone data that is fetched from an URL. The most prominent example of this is downloading the root zone from https://www.internic.net/domain/root.zone.

The server will reply with minimal responses by default. The url handler will watch the zone file and when it receives a (kernel) notify it will reload the zone after 2 seconds.

Syntax

url FILE {
    URL
}
  • FILE the zone file to save the data to and to serve from. If the path is relative, the path from the global root config will be prepended to it.
  • URL the URL to fetch the zone from, a scheme must be used. This may be used multiple times, in which subsequent URLs are used as backup and downloaded when the earlier URL doesn't work.

If the server block specification contains multiple zones, they all will use the same FILE. And you must make sure that zone FILE is generic enough, i.e. use @ for zones instead of domain names.

Examples

Load the root zone from and save it in root.transferred.

. {
    url root.transferred {
        https://www.internic.net/domain/root.zone
    }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Err

func Err(err error) slog.Attr

Types

type Url

type Url struct {
	URLs []string
	Path string

	// Zones holds all the zone this instance of Url is called for.
	Zones        map[string]*zone.Zone
	sync.RWMutex // protects Zones
	// contains filtered or unexported fields
}

func (*Url) Err

func (h *Url) Err(err error) error

func (*Url) Fetch

func (u *Url) Fetch() error

func (*Url) HandlerFunc

func (u *Url) HandlerFunc(next dns.HandlerFunc) dns.HandlerFunc

func (*Url) Key

func (h *Url) Key() string

func (*Url) Refetch

func (u *Url) Refetch() error

func (*Url) Reload

func (u *Url) Reload() error

Reload launches a reload routine that listens for _write_ events to the zone files.

func (*Url) Setup

func (u *Url) Setup(co *dnsserver.Controller) error

func (*Url) Zone

func (u *Url) Zone(origin string) *zone.Zone

Jump to

Keyboard shortcuts

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