Documentation ¶
Overview ¶
Package rewrite is middleware for rewriting requests internally to something different.
Package rewrite is middleware for rewriting requests internally to something different.
Package rewrite is middleware for rewriting requests internally to something different.
Package rewrite is middleware for rewriting requests internally to something different.
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 ¶
var Fields = map[string]Rule{ "name": NameRule{}, "type": TypeRule{}, "class": ClassRule{}, }
Fields defines additional FIELD keywords may be implemented to support more rewrite use-cases. New Rule types must be added to the Fields map. The type must implement `New` and `Rewrite` functions.
Functions ¶
This section is empty.
Types ¶
type ClassRule ¶
type ClassRule struct {
// contains filtered or unexported fields
}
ClassRule is a class rewrite rule.
type ResponseReverter ¶
type ResponseReverter struct { dns.ResponseWriter // contains filtered or unexported fields }
ResponseReverter 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
NewResponseReverter returns a pointer to a new 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 // New returns a new rule. New(...string) Rule }
Rule describes an internal location rewrite rule.