Documentation ¶
Overview ¶
Package request abstracts a client's request so that all plugins will handle them in an unified way.
Index ¶
- type Request
- func (r *Request) Class() string
- func (r *Request) Clear()
- func (r *Request) Do() bool
- func (r *Request) Family() int
- func (r *Request) IP() string
- func (r *Request) Len() int
- func (r *Request) LocalAddr() string
- func (r *Request) LocalIP() string
- func (r *Request) LocalPort() string
- func (r *Request) Match(reply *dns.Msg) bool
- func (r *Request) Name() string
- func (r *Request) NewWithQuestion(name string, typ uint16) Request
- func (r *Request) Port() string
- func (r *Request) Proto() string
- func (r *Request) QClass() uint16
- func (r *Request) QName() string
- func (r *Request) QType() uint16
- func (r *Request) RemoteAddr() string
- func (r *Request) Scrub(reply *dns.Msg) *dns.Msg
- func (r *Request) Size() int
- func (r *Request) SizeAndDo(m *dns.Msg) bool
- func (r *Request) Type() string
- type ScrubWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct { Req *dns.Msg W dns.ResponseWriter // Optional lowercased zone of this query. Zone string // contains filtered or unexported fields }
Request contains some connection state and is useful in plugin.
func (*Request) Class ¶
Class returns the class of the question in the request. If the request is malformed the empty string is returned.
func (*Request) LocalAddr ¶ added in v1.2.0
LocalAddr returns the net.Addr of the server handling the current request.
func (*Request) LocalIP ¶ added in v1.2.0
LocalIP gets the (local) IP address of server handling the request.
func (*Request) LocalPort ¶ added in v1.2.0
LocalPort gets the local port of the server handling the request.
func (*Request) Match ¶ added in v1.1.1
Match checks if the reply matches the qname and qtype from the request, it returns false when they don't match.
func (*Request) Name ¶
Name returns the name of the question in the request. Note this name will always have a closing dot and will be lower cased. After a call Name the value will be cached. To clear this caching call Clear. If the request is malformed the root zone is returned.
func (*Request) NewWithQuestion ¶
NewWithQuestion returns a new request based on the old, but with a new question section in the request.
func (*Request) QClass ¶
QClass returns the class of the question in the request. If the request is malformed 0 returned.
func (*Request) QName ¶
QName returns the name of the question in the request. If the request is malformed the root zone is returned.
func (*Request) QType ¶
QType returns the type of the question as an uint16. If the request is malformed 0 is returned.
func (*Request) RemoteAddr ¶
RemoteAddr returns the net.Addr of the client that sent the current request.
func (*Request) Scrub ¶
Scrub scrubs the reply message so that it will fit the client's buffer. It will first check if the reply fits without compression and then *with* compression. Note, the TC bit will be set regardless of protocol, even TCP message will get the bit, the client should then retry with pigeons.
func (*Request) Size ¶
Size returns if buffer size *advertised* in the requests OPT record. Or when the request was over TCP, we return the maximum allowed size of 64K.
type ScrubWriter ¶ added in v1.2.3
type ScrubWriter struct { dns.ResponseWriter // contains filtered or unexported fields }
ScrubWriter will, when writing the message, call scrub to make it fit the client's buffer.
func NewScrubWriter ¶ added in v1.2.3
func NewScrubWriter(req *dns.Msg, w dns.ResponseWriter) *ScrubWriter
NewScrubWriter returns a new and initialized ScrubWriter.