v1

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2018 License: MIT Imports: 5 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Writer dns.ResponseWriter
	Msg    *dns.Msg
	Errors []error
	KV     map[string]interface{}
	// contains filtered or unexported fields
}

Context pack up with a dns message, and is the most important part of apex It allow us to pass variables throught plugins, manage the work flow

func NewContext

func NewContext(w dns.ResponseWriter, m *dns.Msg, reqID uint64) *Context

NewContext with basic properties

func (*Context) Abort

func (c *Context) Abort()

Abort prevents plugins calling after current plugin

func (*Context) AbortWithError

func (c *Context) AbortWithError(err error) error

AbortWithError calls `Abort()` and `Error()`

func (*Context) AfterResponse

func (c *Context) AfterResponse(responseError error)

AfterResponse func

func (*Context) ClientIP

func (c *Context) ClientIP() net.IP

ClientIP return client request IP

func (*Context) Deadline

func (c *Context) Deadline() (deadline time.Time, ok bool)

Deadline implements context

func (*Context) Done

func (c *Context) Done() <-chan struct{}

Done implements context

func (*Context) Err

func (c *Context) Err() error

Err implements context

func (*Context) Error

func (c *Context) Error(err error) error

Error will panic if err is nil. Append err into context.errors

func (*Context) Get

func (c *Context) Get(key string) (value interface{}, exists bool)

Get value by key

func (*Context) GetBool

func (c *Context) GetBool(key string) (value bool)

GetBool by key

func (*Context) GetFloat64

func (c *Context) GetFloat64(key string) (value float64)

GetFloat64 by key

func (*Context) GetInt

func (c *Context) GetInt(key string) (value int)

GetInt by key

func (*Context) GetInt64

func (c *Context) GetInt64(key string) (value int64)

GetInt64 by key

func (*Context) GetString

func (c *Context) GetString(key string) (value string)

GetString by key

func (*Context) HasError

func (c *Context) HasError() bool

HasError returns true if the current context has some errors.

func (*Context) IsAborted

func (c *Context) IsAborted() bool

IsAborted returns true if the current context was aborted.

func (*Context) Logger

func (c *Context) Logger() *logrus.Entry

Logger returns logrus.Entry with request ID

func (*Context) MustRegisterPluginsOnce

func (c *Context) MustRegisterPluginsOnce(chain PluginChain)

MustRegisterPluginsOnce register plugins

func (*Context) Patch

func (c *Context) Patch()

Patch with plugins

func (*Context) Set

func (c *Context) Set(key string, value interface{})

Set key value pair into context

func (*Context) Value

func (c *Context) Value(key interface{}) interface{}

Value implements context

func (*Context) Warmup

func (c *Context) Warmup()

Warmup func

type Object

type Object interface {
	// Name get plugin object name
	Name() string
	// Initialize plugin object
	Initialize() error

	// Warmup before patch
	Warmup(*Context)
	// Patch dns message and return it back for chain-call
	Patch(*Context)
	// AfterResponse call after response with response status
	AfterResponse(*Context, error)
}

Object of Plugin system for APEX inject into lifecycle of DNS server handle

type PluginChain

type PluginChain []Object

PluginChain contain series of plugins

type PluginFunc

type PluginFunc func(*Context)

PluginFunc type

type PluginFuncChain

type PluginFuncChain []PluginFunc

PluginFuncChain type

Jump to

Keyboard shortcuts

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