autopath

package
v0.0.0-...-e1c1521 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CNAME

func CNAME(name string, target string, ttl uint32) *dns.CNAME

CNAME returns a new CNAME formed from name target and ttl.

Types

type AutoPath

type AutoPath struct {
	NDots          int
	ResolvConfFile string
	HostSearchPath []string
	OnNXDOMAIN     int
}

AutoPath enables server side search path lookups for pods.

type Writer

type Writer struct {
	dns.ResponseWriter

	Rcode int
	Sent  bool
	// contains filtered or unexported fields
}

Writer implements a ResponseWriter that also does the following:

  • reverts question section of a packet to its original state. This is done to avoid the 'Question section mismatch:' error in client.
  • Defers write to the client if the response code is NXDOMAIN. This is needed to enable further search path probing if a search was not successful.
  • Allow forced write to client regardless of response code. This is needed to write the packet to the client if the final search in the path fails to produce results.
  • Overwrites response code with Writer.Rcode if the response code is NXDOMAIN (NameError). This is needed to support the AutoPath.OnNXDOMAIN function, which returns a NOERROR to client instead of NXDOMAIN if the final search in the path fails to produce results.

func NewWriter

func NewWriter(w dns.ResponseWriter, r *dns.Msg) *Writer

NewWriter returns a pointer to a new Writer

func (*Writer) ForceWriteMsg

func (apw *Writer) ForceWriteMsg(res *dns.Msg) error

ForceWriteMsg forces the write to client regardless of response code.

func (*Writer) Hijack

func (apw *Writer) Hijack()

Hijack implements dns.Hijacker. It simply wraps the underlying ResponseWriter's Hijack method if there is one, or returns an error.

func (*Writer) Write

func (apw *Writer) Write(buf []byte) (int, error)

Write is a wrapper that records the size of the message that gets written.

func (*Writer) WriteMsg

func (apw *Writer) WriteMsg(res *dns.Msg) error

WriteMsg writes to client, unless response will be NXDOMAIN.

Jump to

Keyboard shortcuts

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