dns

package
v2.2.13+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2018 License: Apache-2.0 Imports: 31 Imported by: 0

README

行为约定

A

names=''
names="$names titan" #ok, guest PlainName
names="$names titan.hq.cloud.yunionyun.com" #ok, guest CloudZoneFQDN
names="$names kubenode" #ok, host PlainName
names="$names kubenode.hq.cloud.yunionyun.com" #ok, host CloudZoneFQDN
names="$names whoever-the-ether" #NXDOMAIN, nonexistent PlainName
names="$names whoever-the-ether.titan.hq.cloud.yunionyun.com" #NXDOMAIN, nonexistent CloudZoneFQDN
names="$names mail.google.com" #ok, dnsrecords
names="$names www.douban.com" #ok, pub
names="$names app" #ok, k8s svc PlainName in "default" ns
names="$names app.default" #NXDOMAIN, k8s svc name.namespace
names="$names app.default.hq.cloud.yunionyun.com" #ok, k8s name.ns CloudZoneFQDN
names="$names mon-kafka.system" #NXDOMAIN, k8s svc name.namespace
names="$names mon-kafka.system.hq.cloud.yunionyun.com" #ok, k8s name.ns CloudZoneFQDN

# TODO source IP
# TODO other TYPEs
for name in $names; do
	echo "############### $name"
	#dig @192.168.222.171 $name
	#dig -p 54 @10.168.222.136 $name
	dig -p 54 @192.168.222.171 $name
done

PTR

names=''
names="$names " #ok, guest ip
names="$names " #ok, host ip
names="$names " #ok, ptr records in db
names="$names " #NXDOMAIN, others

for name in $names; do
	echo "############### $name"
	dig -p 54 @192.168.222.171 -x $name
done

配置

log {
	# note that apart from rcode like NXDOMAIN, SERVFAIL, coredns will also
	# log NOERROR response when it's NoData as defined by coredns itself
	#
	# > NoData indicates name found, but not the type: NOERROR in header, SOA in auth.
	#
	class denial
	class error
}

Documentation

Index

Constants

View Source
const (
	PluginName string = "yunion"
)

Variables

View Source
var (
	DNSTypeMap map[uint16]string = map[uint16]string{
		dns.TypeA:     "A",
		dns.TypeAAAA:  "AAAA",
		dns.TypeTXT:   "TXT",
		dns.TypeCNAME: "CNAME",
		dns.TypePTR:   "PTR",
		dns.TypeMX:    "MX",
		dns.TypeSRV:   "SRV",
		dns.TypeSOA:   "SOA",
		dns.TypeNS:    "NS",
	}
)

Functions

This section is empty.

Types

type K8sQueryInfo

type K8sQueryInfo struct {
	ServiceName string
	Namespace   string
}

type SRegionDNS

type SRegionDNS struct {
	Next          plugin.Handler
	Fall          fall.F
	Zones         []string
	PrimaryZone   string
	Upstream      upstream.Upstream
	SqlConnection string
	K8sConfigFile string
	K8sClient     *kubernetes.Clientset
}

func New

func New() *SRegionDNS

func (*SRegionDNS) IsNameError

func (r *SRegionDNS) IsNameError(err error) bool

IsNameError implements the ServiceBackend interface

func (*SRegionDNS) Lookup

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

Lookup implements the ServiceBackend interface

func (*SRegionDNS) MinTTL

func (r *SRegionDNS) MinTTL(state request.Request) uint32

MinTTL implements the Transferer interface

func (*SRegionDNS) Name

func (r *SRegionDNS) Name() string

func (*SRegionDNS) Records

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

Records looks up records in region mysql

func (*SRegionDNS) Reverse

func (r *SRegionDNS) Reverse(state request.Request, exact bool, opt plugin.Options) (services []msg.Service, err error)

Reverse implements the ServiceBackend interface

func (*SRegionDNS) Serial

func (r *SRegionDNS) Serial(state request.Request) uint32

Serial implements the Transferer interface

func (*SRegionDNS) ServeDNS

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

func (*SRegionDNS) Services

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

Services implements the ServiceBackend interface

func (*SRegionDNS) Transfer

func (r *SRegionDNS) Transfer(ctx context.Context, state request.Request) (int, error)

Transferer implements the Transferer interface

Jump to

Keyboard shortcuts

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