header

package
v1.8.5 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2021 License: Apache-2.0 Imports: 8 Imported by: 6

README

header

Name

header - modifies the header for responses.

Description

header ensures that the flags are in the desired state for responses. The modifications are made transparently for the client.

Syntax

header {
    ACTION FLAGS...
    ACTION FLAGS...
}
  • ACTION defines the state for DNS message header flags. Actions are evaluated in the order they are defined so last one has the most precedence. Allowed values are:
    • set
    • clear
  • FLAGS are the DNS header flags that will be modified. Current supported flags include:
    • aa - Authoritative(Answer)
    • ra - RecursionAvailable
    • rd - RecursionDesired

Examples

Make sure recursive available ra flag is set in all the responses:

. {
    header {
        set ra
    }
}

Make sure "recursion available" ra and "authoritative answer" aa flags are set and "recursion desired" is cleared in all responses:

. {
    header {
        set ra aa
        clear rd
    }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Header struct {
	Rules []Rule
	Next  plugin.Handler
}

Header modifies dns.MsgHdr in the responses

func (Header) Name

func (h Header) Name() string

Name implements the plugin.Handler interface.

func (Header) ServeDNS

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

ServeDNS implements the plugin.Handler interface.

type ResponseHeaderWriter

type ResponseHeaderWriter struct {
	dns.ResponseWriter
	Rules []Rule
}

ResponseHeaderWriter is a response writer that allows modifying dns.MsgHdr

func (*ResponseHeaderWriter) Write

func (r *ResponseHeaderWriter) Write(buf []byte) (int, error)

Write implements the dns.ResponseWriter interface.

func (*ResponseHeaderWriter) WriteMsg

func (r *ResponseHeaderWriter) WriteMsg(res *dns.Msg) error

WriteMsg implements the dns.ResponseWriter interface.

type Rule

type Rule struct {
	Flag  string
	State bool
}

Rule is used to set/clear Flag in dns.MsgHdr

Jump to

Keyboard shortcuts

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