query_context

package
v5.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: GPL-3.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

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

Context is a query context that pass through plugins A Context will always have a non-nil Q. Context MUST be created using NewContext. All Context funcs are not safe for concurrent use.

func NewContext

func NewContext(q *dns.Msg) *Context

NewContext creates a new query Context. q is the query dns msg. It cannot be nil, or NewContext will panic. meta can be nil.

func (*Context) Copy

func (ctx *Context) Copy() *Context

Copy deep copies this Context.

func (*Context) CopyTo

func (ctx *Context) CopyTo(d *Context) *Context

CopyTo deep copies this Context to d.

func (*Context) GetValue

func (ctx *Context) GetValue(k any) (any, bool)

func (*Context) HasMark

func (ctx *Context) HasMark(m uint32) bool

func (*Context) Id

func (ctx *Context) Id() uint32

Id returns the Context id. Note: This id is not the dns msg id. It's a unique uint32 growing with the number of query.

func (*Context) InfoField

func (ctx *Context) InfoField() zap.Field

InfoField returns a zap.Field. Just for convenience.

func (*Context) Q

func (ctx *Context) Q() *dns.Msg

Q returns the query msg. It always returns a non-nil msg.

func (*Context) R

func (ctx *Context) R() *dns.Msg

R returns the response. It might be nil.

func (*Context) SetKey

func (ctx *Context) SetKey(k, v any)

SetKey stores any v in to this Context k should be an interface that has type but has a nil value.

func (*Context) SetMark

func (ctx *Context) SetMark(m uint32)

func (*Context) SetResponse

func (ctx *Context) SetResponse(r *dns.Msg)

SetResponse stores the response r to the context. Note: It just stores the pointer of r. So the caller shouldn't modify or read r after the call.

func (*Context) StartTime

func (ctx *Context) StartTime() time.Time

StartTime returns the time when the Context was created.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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