bcscustom

package
v1.25.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Success = "success"
	Failure = "failure"
)

Variables

View Source
var (
	RequestCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: plugin.Namespace,
		Subsystem: "bcscustom",
		Name:      "request_count_total",
		Help:      "Counter of requests to plugin bcscustom.",
	}, []string{"status"})

	RequestLatency = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: plugin.Namespace,
		Subsystem: "bcscustom",
		Name:      "request_latency_seconds",
		Buckets:   plugin.TimeBuckets,
		Help:      "Histogram of the time (in seconds) each request took.",
	}, []string{"status"})

	DnsTotal = prometheus.NewGauge(prometheus.GaugeOpts{
		Namespace: plugin.Namespace,
		Subsystem: "bcscustom",
		Name:      "dns_total",
		Help:      "Total counter of dns in plugin bcscustom.",
	})
)

Metrics the bcscustom plugin exports.

Functions

This section is empty.

Types

type BcsCustom

type BcsCustom struct {
	Next        plugin.Handler
	FallThrough bool
	Zones       []string
	RootPrefix  string
	Upstream    upstream.Upstream // Proxy for looking up names during the resolution process
	EtcdCli     *etcdcv3.Client
	EtcdPlugin  *etcd.Etcd
	Ctx         context.Context
	Listen      string
	SvrTLS      TLS
	// contains filtered or unexported fields
}

BcsCustom represent a bcscustom server class Etcd is a plugin talks to an etcd cluster. BcsCustom is a plugin talks to an etcd cluster.

func (*BcsCustom) IsNameError

func (bc *BcsCustom) IsNameError(err error) bool

IsNameError implements the coredns.plugin.ServiceBackend interface. IsNameError return true if err indicated a record not found condition

func (*BcsCustom) Lookup

func (bc *BcsCustom) Lookup(state request.Request, name string, typ uint16) (*dns.Msg, error)

Lookup implements the coredns.plugin.ServiceBackend interface. Lookup is used to find records else where.

func (*BcsCustom) MinTTL

func (bc *BcsCustom) MinTTL(state request.Request) uint32

MinTTL implements the coredns.plugin.ServiceBackend interface. MinTTL returns the minimum TTL to be used in the SOA record.

func (*BcsCustom) Name

func (bc *BcsCustom) Name() string

Name implements the Handler interface.

func (*BcsCustom) Records

func (bc *BcsCustom) Records(state request.Request, exact bool) ([]msg.Service, error)

Records implements the coredns.plugin.ServiceBackend interface. Records _all_ services that matches a certain name. Note: it does not implement a specific service.

func (*BcsCustom) Reverse

func (bc *BcsCustom) Reverse(state request.Request, exact bool, opt plugin.Options) ([]msg.Service, error)

Reverse implements the coredns.plugin.ServiceBackend interface. Reverse communicates with the backend to retrieve service definition based on a IP address instead of a name. I.e. a reverse DNS lookup.

func (*BcsCustom) Serial

func (bc *BcsCustom) Serial(state request.Request) uint32

Serial implements the coredns.plugin.ServiceBackend interface. Serial returns a SOA serial number to construct a SOA record.

func (*BcsCustom) ServeDNS

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

ServeDNS implements the plugin.Handler interface.

func (*BcsCustom) Services

func (bc *BcsCustom) Services(state request.Request, exact bool, opt plugin.Options) (services []msg.Service, err error)

Services implements the coredns.plugin.ServiceBackend interface.

func (*BcsCustom) Transfer

func (bc *BcsCustom) Transfer(ctx context.Context, state request.Request) (int, error)

Transfer implements the coredns.plugin.ServiceBackend interface. Transfer handles a zone transfer it writes to the client just like any other handler.

type DNS

type DNS struct {
	DomainName string       `json:"domain"`
	Messages   []DNSMessage `json:"messages"`
}

DNS data structure for request

type DNSMessage

type DNSMessage struct {
	Alias    string `json:"alias"` // extend field, alias name for this message
	Host     string `json:"host,omitempty"`
	Port     int    `json:"port,omitempty"`
	Priority int    `json:"priority,omitempty"`
	Weight   int    `json:"weight,omitempty"`
	Text     string `json:"text,omitempty"`
	Mail     bool   `json:"mail,omitempty"`
	TTL      uint32 `json:"ttl,omitempty"`

	// When a SRV record with a "Host: IP-address" is added, we synthesize
	// a srv.Target domain name.  Normally we convert the full Key where
	// the record lives to a DNS name and use this as the srv.Target.  When
	// TargetStrip > 0 we strip the left most TargetStrip labels from the
	// DNS name.
	TargetStrip int `json:"targetstrip,omitempty"`

	// Group is used to group (or *not* to group) different services
	// together. Services with an identical Group are returned in the same
	// answer.
	Group string `json:"group,omitempty"`
}

DNSMessage dns detail for one host

type TLS

type TLS struct {
	CaFile   string
	KeyFile  string
	CertFile string
}

TLS tls info for plugin

Jump to

Keyboard shortcuts

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