responses

package
v0.0.0-...-447c91e Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogFormat = "{{.Time}} [consulrpz] {{.RemoteIP}} made {{.QType}} query for {{.QName}}"

Functions

func AppendAAAARecordToResponse

func AppendAAAARecordToResponse(state request.Request, response *PolicyResponse, ttl int, value json.RawMessage) error

func AppendARecordToResponse

func AppendARecordToResponse(state request.Request, response *PolicyResponse, ttl int, value json.RawMessage) error

func AppendExtraToResponse

func AppendExtraToResponse(state request.Request, value json.RawMessage, response *PolicyResponse) error

func AppendInAddrToResponse

func AppendInAddrToResponse(state request.Request, aliastype string, response *PolicyResponse) error

func AppendRcodeToResponse

func AppendRcodeToResponse(state request.Request, value json.RawMessage, response *PolicyResponse) error

func AppendRecordToResponse

func AppendRecordToResponse(state request.Request, value json.RawMessage, response *PolicyResponse) error

func CreateDnsRecord

func CreateDnsRecord(qname string, qtype uint16, ttl uint32, address string) *dns.A

func HandleLogResponse

func HandleLogResponse(state request.Request, value json.RawMessage, result *matches.MatchResult, policy policies.Policy, response *PolicyResponse) error

func LogFormatResponse

func LogFormatResponse(f os.File, msg LogMessage, format string) error

func LogJsonResponse

func LogJsonResponse(f os.File, msg LogMessage) error

func StringToRcode

func StringToRcode(s string) (uint16, error)

func WriteExtraHandle

func WriteExtraHandle(msg *dns.Msg, state request.Request, extra []string)

Types

type LogMessage

type LogMessage struct {
	Time     string `json:"time"`
	QName    string `json:"qname"`
	QType    uint16 `json:"qtype"`
	RemoteIP string `json:"remoteip"`
	Result   string `json:"result"`
}

type LogResponse

type LogResponse struct {
	Path   string `json:"path"`
	AsJson bool   `json:"as_json"`
	Format string `json:"format"`
}

type PolicyRecord

type PolicyRecord struct {
	TTL     *int `json:"ttl"`
	Records []struct {
		Type  string          `json:"type"`
		Value json.RawMessage `json:"value"`
	} `json:"records"`
}

func (PolicyRecord) GetRecordTTL

func (record PolicyRecord) GetRecordTTL() int

type PolicyResponse

type PolicyResponse struct {
	Deny        bool     `json:"deny"`
	Fallthrough bool     `json:"fallthrough"`
	Rcode       *uint16  `json:"rcode"`
	Records     []dns.RR `json:"records"`
	Extra       []string `json:"extra"`
}

func HandleResponse

func HandleResponse(state request.Request, ctx context.Context, server string, result *matches.MatchResult, policy policies.Policy, rule policies.PolicyRule) (*PolicyResponse, error)

Jump to

Keyboard shortcuts

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