Documentation ¶
Index ¶
- Constants
- Variables
- func Handle(ch Channel, session *Session)
- func TypeToRR() map[uint16]func() dns.RR
- type Amender
- type CP
- type Channel
- type ChannelMgr
- type Config
- type End
- type Error
- type Error_CP_Reason
- type FChannelByName
- type ListenerCfg
- type Logger
- type QueryLogConfig
- type Remote
- type Session
- type Starter
- type State
- type Validation
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 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"} )
View Source
var StateNChannel = map[State]string{ STAR: Channel_Validation, V1_OK: Channel_Amender, V1_NOK: Channel_Amender, V2_OK: Channel_Remote, V2_NOK: Channel_Amender, V3_OK: Channel_CP, V3_NOK: Channel_Amender, V45_OK: Channel_Logger, V4_NOK: Channel_Amender, A1_OK: Channel_CP, A23_OK: Channel_Validation, CP1_OK: Channel_Validation, CP1_NOK: Channel_Amender, CP2_OK: Channel_Amender, CP2_NOK: Channel_Amender, R_OK: Channel_Validation, R_NOK: Channel_Amender, RCP_NOK: Channel_Amender, L_OK: Channel_End, }
Functions ¶
Types ¶
type Amender ¶
type Amender struct { *Config // contains filtered or unexported fields }
func (*Amender) Init ¶
func (a *Amender) Init(cfg *Config, f FChannelByName)
type CP ¶
type CP struct { *Config // contains filtered or unexported fields }
caches and patterns; unitized handling
func (*CP) Init ¶
func (cp *CP) Init(cfg *Config, f FChannelByName)
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 Error ¶
type Error struct{ Ex string }
'Error' represents a fixed conclusion error thrown by channels.
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 ListenerCfg ¶
type Logger ¶
type Logger struct { *Config // contains filtered or unexported fields }
func (*Logger) Init ¶
func (l *Logger) Init(cfg *Config, f FChannelByName)
type QueryLogConfig ¶
type Remote ¶
type Remote struct {
// contains filtered or unexported fields
}
func (*Remote) Init ¶
func (r *Remote) Init(cfg *Config, f FChannelByName)
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) Init ¶
func (s *Starter) Init(_ *Config, f FChannelByName)
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
Click to show internal directories.
Click to hide internal directories.