upstream

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package upstream connects DANS to its single PowerDNS API upstream.

Index

Constants

View Source
const MaxBrowseRRsetBytes = 8 << 20

MaxBrowseRRsetBytes bounds a single complete RRset, independently of zone size.

View Source
const (
	MaxKeyBytes = 4096
)
View Source
const MaxProbeBytes = 64 << 10

Variables

View Source
var (
	ErrUpstreamAuthentication = errors.New("powerdns authentication failed")
	ErrUpstreamProbe          = errors.New("powerdns probe failed")
	ErrIncompatibleVersion    = errors.New("incompatible powerdns version")
)
View Source
var ErrBrowseZoneAbsent = errors.New("upstream browse zone absent")

ErrBrowseZoneAbsent reports an authoritative 404, not a missing RRset.

Functions

func LoadKey

func LoadKey(sources KeySources) (httpapi.Secret, error)

LoadKey reads exactly one key source once and returns a redacting wrapper.

func NewHTTPClient

func NewHTTPClient(config TransportConfig) (*http.Client, *url.URL, error)

NewHTTPClient constructs a bounded, non-redirecting PowerDNS client.

func Relay

func Relay(destination http.ResponseWriter, response *http.Response, requestID string) error

Relay copies an observed PowerDNS response while removing transport-only and credential headers and applying DANS-owned authenticated-response headers.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the generated PowerDNS client plus DANS compatibility checks.

func New

func New(config TransportConfig, key httpapi.Secret) (*Client, error)

New constructs a client which replaces any caller-supplied PowerDNS key.

func (*Client) Forward

func (client *Client) Forward(operation Operation) (*http.Response, error)

Forward executes one typed generated-client operation without retries. Genuine upstream HTTP responses, including errors, are returned untouched.

func (*Client) Probe

func (client *Client) Probe(ctx context.Context) error

Probe authenticates to the authoritative server and enforces the supported version window.

func (*Client) StreamZoneRRsets

func (client *Client) StreamZoneRRsets(ctx context.Context, zoneID, name, recordType string, yield func(json.RawMessage) error) error

StreamZoneRRsets streams complete API RRsets, retaining at most one set. A filtered read returning no sets is an authoritative RRset deletion.

type KeySources

type KeySources struct {
	Environment      string
	File             string
	RenderedFragment string
}

KeySources selects exactly one approved plaintext PowerDNS-key source.

type Operation

type Operation func(api.ClientInterface) (*http.Response, error)

Operation constructs and sends one request through the generated client.

type TransportConfig

type TransportConfig struct {
	URL        string
	UnixSocket string
	Timeout    time.Duration
}

TransportConfig selects exactly one restricted PowerDNS transport.

Jump to

Keyboard shortcuts

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