Documentation ¶
Overview ¶
Package rewrite is middleware for rewriting requests internally to something different.
Index ¶
Constants ¶
const ( Is = "is" Not = "not" Has = "has" NotHas = "not_has" StartsWith = "starts_with" EndsWith = "ends_with" Match = "match" NotMatch = "not_match" )
Operators
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResponseReverter ¶
type ResponseReverter struct { dns.ResponseWriter // contains filtered or unexported fields }
ResponseRevert reverses the operations done on the question section of a packet. This is need because the client will otherwise disregards the response, i.e. dig will complain with ';; Question section mismatch: got miek.nl/HINFO/IN'
func NewResponseReverter ¶
func NewResponseReverter(w dns.ResponseWriter, r *dns.Msg) *ResponseReverter
func (*ResponseReverter) Hijack ¶
func (r *ResponseReverter) Hijack()
Hijack implements dns.Hijacker. It simply wraps the underlying ResponseWriter's Hijack method if there is one, or returns an error.
type Rewrite ¶
type Rewrite struct { Next middleware.Handler Rules []Rule // contains filtered or unexported fields }
Rewrite is middleware to rewrite requests internally before being handled.
type Rule ¶
type Rule interface { // Rewrite rewrites the internal location of the current request. Rewrite(*dns.Msg) Result }
Rule describes an internal location rewrite rule.
type SimpleRule ¶
type SimpleRule struct {
From, To string
// contains filtered or unexported fields
}
SimpleRule is a simple rewrite rule. If the From and To look like a type the type of the request is rewritten, otherwise the name is. Note: TSIG signed requests will be invalid.
func NewSimpleRule ¶
func NewSimpleRule(from, to string) SimpleRule
NewSimpleRule creates a new Simple Rule