channels

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: LGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Channel_Starter    = "Star" // *
	Channel_End        = "E"
	Channel_Validation = "V"
	Channel_Amender    = "A"
	Channel_CP         = "CP"       // caches and patterns; unitized handling
	Channel_Stub       = "Stub"     // query over recursive resolvers
	Channel_Remote     = "Resolver" // server selection/dispatching/coordination
	Channel_Logger     = "Log"

	Dot                        = "."
	EMPTY                      = "-"
	NonSvrName                 = EMPTY
	Session_State_Error        = "session contains wrong state"
	DefaultTTL          uint32 = 60
)
View Source
const (
	RF = "RF"
	NX = "NX"
	NC = "NC"
	PL = "PL"
	AS = "AS"
)
View Source
const (
	Zero_DNS_Msg_ID = true
)

Variables

View Source
var (
	Error_Stub_Internal = &Error{Ex: "remote: can not serve query due to internal fault"}
	Error_Stub_SvrFault = &Error{Ex: "remote: stub server fault"}
	Error_Stub_Timeout  = &Error{Ex: "remote: timeout"}
)
View Source
var (
	Error_Packet_Size1  = &Error{Ex: "validation: invalid packet size of query"}
	Error_Packet_Size2  = &Error{Ex: "validation: invalid packet size of answer"}
	Error_DNS_Header1   = &Error{Ex: "validation: invalid dns header of query"}
	Error_DNS_Header2   = &Error{Ex: "validation: invalid dns header of answer"}
	Error_DNS_QName     = &Error{Ex: "validation: invalid dns qname of query"}
	Error_DNS_Qualified = &Error{Ex: "validation: qname is not fully qualified"}
	Error_DNS_OPT       = &Error{Ex: "validation: OPT record is more than one"}
	Error_DNS_NO_IPv6   = &Error{Ex: "validation: disable IPv6 by default"}
)

Functions

func Handle

func Handle(ch Channel, session *Session)

func Sum512_256s added in v1.1.3

func Sum512_256s(datas ...[]byte) (sum256 *[sha512.Size256]byte)

func TypeToRR added in v1.1.1

func TypeToRR() map[uint16]func() dns.RR

TypeToRR is a restriction map of known/processing RR type.

Types

type Amender

type Amender struct {
	*Config
	// contains filtered or unexported fields
}

func (*Amender) Handle

func (a *Amender) Handle(s *Session) Channel

func (*Amender) Init

func (a *Amender) Init(cfg *Config, f FChannelByName)

func (*Amender) Name

func (a *Amender) Name() string

type CP

type CP struct {
	*Config
	// contains filtered or unexported fields
}

caches and patterns; unitized handling

func (*CP) Handle

func (cp *CP) Handle(s *Session) Channel

func (*CP) Init

func (cp *CP) Init(cfg *Config, f FChannelByName)

func (*CP) Name

func (cp *CP) Name() string

type Channel

type Channel interface {
	Name() string
	Init(*Config, FChannelByName)
	Handle(*Session) Channel // chain of reaction
}

type ChannelMgr

type ChannelMgr struct {
	*ListenerCfg
	// contains filtered or unexported fields
}

A simple channel manager across all listeners

func (*ChannelMgr) Handle

func (mgr *ChannelMgr) Handle(session *Session)

func (*ChannelMgr) Init

func (mgr *ChannelMgr) Init(listeners int)

func (*ChannelMgr) InitChannels

func (mgr *ChannelMgr) InitChannels(individual []int, shares []int)

individual,shares : array of listener idx

func (*ChannelMgr) Register

func (mgr *ChannelMgr) Register(idx int, ch Channel)

func (*ChannelMgr) Registers

func (mgr *ChannelMgr) Registers(shares []int, ch Channel)

type Config

type Config struct {
	QueryMeta            []string        `toml:"query_meta"`
	CacheSize            *int            `toml:"cache_size"`
	BlockIPv6            *bool           `toml:"sinkhole_ipv6"`
	CacheTTL             *uint32         `toml:"cache_ttl"`  // default an hour
	CloakTTL             *uint32         `toml:"cloak_ttl"`  // default an hour
	BlackTTL             *uint32         `toml:"black_ttl"`  //a.k.a. TTL of negative responses; no default
	NodataTTL            *uint32         `toml:"nodata_ttl"` // default an hour; sinkhole_ipv6 pops nodata RR
	BlackCloaking        *string         `toml:"black_cloaking_routine"`
	BlackCloakingMon     *bool           `toml:"windows_filemon"`
	BlockedQueryResponse string          `toml:"blocked_query_response"`
	QueryLog             *QueryLogConfig `toml:"query_log"`
}

type End

type End struct {
}

func (*End) Handle

func (_ *End) Handle(s *Session) Channel

func (*End) Init

func (_ *End) Init(_ *Config, _ FChannelByName)

func (*End) Name

func (_ *End) Name() string

type Error

type Error struct{ Ex string }

'Error' represents a fixed conclusion error thrown by channels.

func (*Error) Error

func (e *Error) Error() string

type Error_CP_Reason added in v1.1.1

type Error_CP_Reason Error

func (*Error_CP_Reason) CPCNAMEExplication added in v1.1.1

func (e *Error_CP_Reason) CPCNAMEExplication() *Error_CP_Reason

func (*Error_CP_Reason) Error added in v1.1.1

func (e *Error_CP_Reason) Error() string

type FChannelByName

type FChannelByName func(string) Channel

type ListenerCfg

type ListenerCfg struct {
	Cfgs map[int]*Config
}

type Logger

type Logger struct {
	*Config
	// contains filtered or unexported fields
}

func (*Logger) Handle

func (l *Logger) Handle(s *Session) Channel

func (*Logger) Init

func (l *Logger) Init(cfg *Config, f FChannelByName)

func (*Logger) Name

func (l *Logger) Name() string

type QueryLogConfig

type QueryLogConfig struct {
	File          *string  `toml:"file"`
	Format        *string  `toml:"format"`
	IgnoredQtypes []string `toml:"ignored_qtypes"`
}

type Remote

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

func (*Remote) Handle

func (r *Remote) Handle(s *Session) Channel

func (*Remote) Init

func (r *Remote) Init(cfg *Config, f FChannelByName)

func (*Remote) Name

func (r *Remote) Name() string

type Session

type Session struct {
	State
	*dns.Question
	OPTOrigin         *dns.OPT
	LastState         State
	RawIn, RawOut     *[]byte
	Request, Response *dns.Msg

	ServerName      *string
	ExtraServerName *string // for debug display of 'Anonymized' sever idx
	Listener        int
	Stopwatch       time.Time //not started yet
	LastError       error
	IsUDPClient     bool
	ID              uint16
	// contains filtered or unexported fields
}

act like self illumination of state flow

type Starter

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

func (*Starter) Handle

func (s *Starter) Handle(ss *Session) Channel

func (*Starter) Init

func (s *Starter) Init(_ *Config, f FChannelByName)

func (*Starter) Name

func (_ *Starter) Name() string

type State

type State uint32
const (
	STAR          = State(0)  // *
	V1_OK   State = 1 << iota // dns.unpack downstream
	V1_NOK                    //
	V2_OK                     // dns.pack
	V2_NOK                    //
	V3_OK                     // dns.unpack upstream
	V3_NOK                    //
	V45_OK                    // dns.pack outcome
	V4_NOK                    //
	A1_OK                     // pre-processing
	A23_OK                    // post-processing
	CP1_OK                    // pre-match
	CP1_NOK                   //
	CP2_OK                    // post-match
	CP2_NOK                   //
	R_OK                      // resolving
	R_NOK                     //
	RCP_NOK                   // failed with cache
	L_OK                      // logging
	E                         // E
)

type Validation

type Validation struct {
	*Config
	// contains filtered or unexported fields
}

func (*Validation) Handle

func (v *Validation) Handle(s *Session) Channel

func (*Validation) Init

func (v *Validation) Init(cfg *Config, f FChannelByName)

func (*Validation) Name

func (_ *Validation) Name() string

Jump to

Keyboard shortcuts

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