plankton

package module
v0.7.30 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package plankton is a CoreDNS plugin that prints "plankton" to stdout on every packet received.

It serves as an plankton CoreDNS plugin with numerous code comments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AAAA_Record

type AAAA_Record struct {
	Seq      int    `json:"seq,omitempty"`
	Ttl      uint32 `json:"ttl,omitempty"`
	Ip       net.IP `json:"ip"`
	GslbW    uint32 `json:"gslbw,omitempty"`
	Location uint32 `json:"location,omitempty"`
	HashId   string `json:"hashid,omitempty"`
}

AAAA_Record struct for IPv6 addresses

type A_Record

type A_Record struct {
	Seq      int    `json:"seq,omitempty"`
	Ttl      uint32 `json:"ttl,omitempty"`
	Ip       net.IP `json:"ip"`
	GslbW    uint32 `json:"gslbw,omitempty"`
	Location uint32 `json:"location,omitempty"`
	HashId   string `json:"hashid,omitempty"`
}

A_Record type record struct for ipv4

type CAA_Record

type CAA_Record struct {
	Seq      int    `json:"seq,omitempty"`
	Ttl      uint32 `json:"ttl,omitempty"`
	Flag     uint8  `json:"flag"`
	Tag      string `json:"tag"`
	Value    string `json:"value"`
	GslbW    uint32 `json:"gslbw,omitempty"`
	Location uint32 `json:"location,omitempty"`
	HashId   string `json:"hashid,omitempty"`
}

CAA_Record struct

type CNAME_Record

type CNAME_Record struct {
	Seq      int    `json:"seq,omitempty"`
	Ttl      uint32 `json:"ttl,omitempty"`
	Host     string `json:"host"`
	GslbW    uint32 `json:"gslbw,omitempty"`
	Location uint32 `json:"location,omitempty"`
	HashId   string `json:"hashid,omitempty"`
}

CNAME_Record struct

type HashItem

type HashItem struct {
	HashId string `json:"hashid,omitempty"`
	//Str     string `json:"str,omitempty"`
	Count   int  `json:"count,omitempty"`
	Enabled bool `json:"enabled,omitempty"`
}

Hash Item

type MX_Record

type MX_Record struct {
	Seq        int    `json:"seq,omitempty"`
	Ttl        uint32 `json:"ttl,omitempty"`
	Host       string `json:"host"`
	Preference uint16 `json:"preference"`
	GslbW      uint32 `json:"gslbw,omitempty"`
	Location   uint32 `json:"location,omitempty"`
	HashId     string `json:"hashid,omitempty"`
}

MX_Record struct

type NS_Record

type NS_Record struct {
	Seq      int    `json:"seq,omitempty"`
	Ttl      uint32 `json:"ttl,omitempty"`
	Host     string `json:"host"`
	GslbW    uint32 `json:"gslbw,omitempty"`
	Location uint32 `json:"location,omitempty"`
	HashId   string `json:"hashid,omitempty"`
}

NS_Record struct

type Plankton

type Plankton struct {
	Next plugin.Handler
	Pool *redis.Pool
	Path string
	Zone Zone

	Ttl uint32

	LastZoneUpdate time.Time

	MaxRespRec int
	// contains filtered or unexported fields
}

Plankton is an plankton plugin to show how to write a plugin. Redis struct policy types:

1 = round-robin,
2 = ordered
3 = geolocation

func (*Plankton) HashID

func (p *Plankton) HashID(s string) string

func (*Plankton) LoadZoneFromFile

func (p *Plankton) LoadZoneFromFile() error

func (*Plankton) Name

func (p *Plankton) Name() string

Name implements the Handler interface.

func (*Plankton) Ready

func (p *Plankton) Ready() bool

Ready implements the ready.Readiness interface, once this flips to true CoreDNS assumes this plugin is ready for queries; it is not checked again.

func (*Plankton) ServeDNS

func (p *Plankton) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)

ServeDNS implements the plugin.Handler interface. This method gets called when plankton is used in a Server.

type Record

type Record struct {
	Policy    int            `json:"policy,omitempty"`
	StickyTTL int            `json:"stickyttl,omitempty"`
	A         []A_Record     `json:"a,omitempty"`
	AAAA      []AAAA_Record  `json:"aaaa,omitempty"`
	TXT       []TXT_Record   `json:"txt,omitempty"`
	CNAME     []CNAME_Record `json:"cname,omitempty"`
	NS        []NS_Record    `json:"ns,omitempty"`
	MX        []MX_Record    `json:"mx,omitempty"`
	SRV       []SRV_Record   `json:"srv,omitempty"`
	CAA       []CAA_Record   `json:"caa,omitempty"`
	SOA       []SOA_Record   `json:"soa,omitempty"`
}

Record Struct with all types

type ResponsePrinter

type ResponsePrinter struct {
	dns.ResponseWriter
}

ResponsePrinter wrap a dns.ResponseWriter and will write plankton to standard output when WriteMsg is called.

func NewResponsePrinter

func NewResponsePrinter(w dns.ResponseWriter) *ResponsePrinter

NewResponsePrinter returns ResponseWriter.

func (*ResponsePrinter) WriteMsg

func (r *ResponsePrinter) WriteMsg(res *dns.Msg) error

WriteMsg calls the underlying ResponseWriter's WriteMsg method and prints "plankton" to standard output.

type SOA_Record

type SOA_Record struct {
	Seq      int    `json:"seq,omitempty"`
	Ttl      uint32 `json:"ttl,omitempty"`
	Ns       string `json:"ns"`
	MBox     string `json:"MBox"`
	Refresh  uint32 `json:"refresh"`
	Retry    uint32 `json:"retry"`
	Expire   uint32 `json:"expire"`
	MinTtl   uint32 `json:"minttl"`
	GslbW    uint32 `json:"gslbw,omitempty"`
	Location uint32 `json:"location,omitempty"`
	HashId   string `json:"hashid,omitempty"`
}

SOA_Record struct

type SRV_Record

type SRV_Record struct {
	Seq      int    `json:"seq,omitempty"`
	Ttl      uint32 `json:"ttl,omitempty"`
	Priority uint16 `json:"priority"`
	Weight   uint16 `json:"weight"`
	Port     uint16 `json:"port"`
	Target   string `json:"target"`
	GslbW    uint32 `json:"gslbw,omitempty"`
	Location uint32 `json:"location,omitempty"`
	HashId   string `json:"hashid,omitempty"`
}

SRV_Record struct

type TXT_Record

type TXT_Record struct {
	Seq      int    `json:"seq,omitempty"`
	Ttl      uint32 `json:"ttl,omitempty"`
	Text     string `json:"text"`
	GslbW    uint32 `json:"gslbw,omitempty"`
	Location uint32 `json:"location,omitempty"`
	HashId   string `json:"hashid,omitempty"`
}

TXT_Record struct

type Zone

type Zone struct {
	Name      string            `json:"domainname"`
	Locations map[string]Record `json:"locations"`
}

Zone basic struct

Jump to

Keyboard shortcuts

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