Documentation ¶
Overview ¶
Package syncache is a CoreDNS plugin that caches lookups. If more than one request for the same resource is in flight, then they are queued to avoid redundant forwarding lookups
Index ¶
- Constants
- type ArchivingCache
- type Cache
- type CacheEntry
- type Connection
- type Recorder
- func (rec *Recorder) Close() error
- func (rec *Recorder) Hijack()
- func (rec *Recorder) LocalAddr() net.Addr
- func (rec *Recorder) NextPlugin(ctx context.Context, request *dns.Msg)
- func (rec *Recorder) RemoteAddr() net.Addr
- func (rec *Recorder) SetMsg(res *dns.Msg) error
- func (rec *Recorder) TsigStatus() error
- func (rec *Recorder) TsigTimersOnly(b bool)
- func (rec *Recorder) Write(b []byte) (int, error)
- func (rec *Recorder) WriteMsg(res *dns.Msg) error
- func (rec *Recorder) WriteRecordedMessage(rw dns.ResponseWriter, request *dns.Msg, shared bool) (int, error)
- type Server
Constants ¶
const ( // Success is the class for caching positive caching. Success = "success" // Denial is the class defined for negative caching. Denial = "denial" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArchivingCache ¶
type ArchivingCache struct { Next plugin.Handler UpstreamIP string UpstreamPort string Connection *Connection // contains filtered or unexported fields }
Syncache is a cache plugin.
func NewArchivingCache ¶
func NewArchivingCache(eviction time.Duration, maxSizeMb int, UpstreamIP string, UpstreamPort string, Connection *Connection) (*ArchivingCache, error)
NewArchivingCache returns a new instance of Syncache
func (*ArchivingCache) Close ¶
func (a *ArchivingCache) Close()
Close is a synonym for OnShutdown().
func (*ArchivingCache) Name ¶
func (a *ArchivingCache) Name() string
Name implements the Handler interface.
func (*ArchivingCache) OnShutdown ¶
func (a *ArchivingCache) OnShutdown() error
OnShutdown stops all configured proxies.
func (*ArchivingCache) OnStartup ¶
func (a *ArchivingCache) OnStartup() (err error)
OnStartup starts a goroutines for all proxies.
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a wrapper around *bigcache.BigCache which takes care of marshalling and unmarshalling of dns.Msg.
type CacheEntry ¶
type CacheEntry struct {
// contains filtered or unexported fields
}
func (*CacheEntry) AddCollectionId ¶
func (ce *CacheEntry) AddCollectionId(collectionId string) []string
func (*CacheEntry) HasCollectionId ¶
func (ce *CacheEntry) HasCollectionId(collectionId string) bool
func (*CacheEntry) String ¶
func (ce *CacheEntry) String() string
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection holds the connections for ContentWriter and Veidemann database
func NewConnection ¶
func NewConnection(dbHost string, dbPort int, dbUser string, dbPassword string, dbName string, contentWriterHost string, contentWriterPort int) *Connection
NewConnection creates a new Connection object
type Recorder ¶
type Recorder struct { Rcode int Err error Msg *dns.Msg FetchStart time.Time FetchDurationMs int64 RequestedHost string UpstreamIP string // contains filtered or unexported fields }
Recorder is a type of ResponseWriter that captures the message written to it.
func NewRecorder ¶
func NewRecorder(a *ArchivingCache, key string, server string, connection *Connection, requestedHost string, upstreamIP string, collectionRef *configV1.ConfigRef) *Recorder
NewRecorder makes and returns a new Recorder,
func (*Recorder) Hijack ¶
func (rec *Recorder) Hijack()
Hijack implement the dns.ResponseWriter interface from Go DNS.
func (*Recorder) NextPlugin ¶
NextPlugin runs the next plugin and captures the result
func (*Recorder) RemoteAddr ¶
RemoteAddr implement the dns.ResponseWriter interface from Go DNS.
func (*Recorder) TsigStatus ¶
TsigStatus implement the dns.ResponseWriter interface from Go DNS.
func (*Recorder) TsigTimersOnly ¶
TsigTimersOnly implement the dns.ResponseWriter interface from Go DNS.
func (*Recorder) Write ¶
Write is the hack that makes this work. It does not actually write the message but returns the bytes we need to to write in r. We can then pick this up in Query and write a proper protobuf back to the client. Write implements the dns.ResponseWriter interface.
func (*Recorder) WriteMsg ¶
WriteMsg records the messsage. WriteMsg implements the dns.ResponseWriter interface.
func (*Recorder) WriteRecordedMessage ¶
func (rec *Recorder) WriteRecordedMessage(rw dns.ResponseWriter, request *dns.Msg, shared bool) (int, error)
WriteRecordedMessage writes the message to the wrapped ResponseWriter
type Server ¶
type Server struct { Header *contentwriterV1.Data Payload *contentwriterV1.Data Meta *contentwriterV1.WriteRequestMeta Cancel string // contains filtered or unexported fields }
Server is used to implement ContentWriterServer.
func NewCWServer ¶
NewCWServer creates a new ContentWriterServerMock
func (*Server) Write ¶
func (s *Server) Write(stream contentwriterV1.ContentWriter_WriteServer) error
Write implements ContentWriterServer