Documentation ¶
Overview ¶
Simple DSL for pipebackend. Usage:
// Create new handle. You have to specify a default TTL here. x := dsl.New() root := regexp.QuoteMeta("example.com") // most zones need SOA + NS records x.SOA(root, func(c *dsl.Context) { c.Reply("ns1.example.com hostmaster.example.com 1 3600 1800 86400 3600") }) // Zones need NS records too. All replies will be returned x.NS(root, func(c *dsl.Context) { c.Reply("ns1.example.com") c.Reply("ns2.example.com") c.Reply("ns3.example.com") }) // You don't have to use anonymous functions, of course func answer(c *dsl.Context) { switch c.Query.QType { case "A" : c.Reply("169.254.0.1") case "AAAA": c.Reply("fe80::1" ) } } x.A(root, answer) x.AAAA(root, answer) // Setting c.Error at any point will suppress *all* replies from being // sent back. Instead, a FAIL response with the c.Error.Error() as the // content is returned to powerdns x.SSHFP(root, func(c *dsl.Context) { c.Reply("1 1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15") c.Error = errors.New("Don't use SSHFP on unsigned zones") c.Reply("1 2 e242ed3bffccdf271b7fbaf34ed72d089537b42f") }) // You can do anything in a callback, but be aware that powerdns has a // time limit on responses and there is no request concurrency within a // single pipe connection. pdns achieves concurrency through multiple // backend connections instead c := make(chan string) x.MX(root, func(c *dsl.Context) { c.Reply(<-c) }) // If your regexp includes capture groups, they are quoted back to you. // Here's a simple DNS echo server. Note the use of ReplyExtra to allow // a non-default TTL to be set. // // Don't forget: DNS is supposed to be case-insensitive. Be careful. c.TXT(`(.*)\.` + root, func(c *dsl.Context) { c.ReplyTTL(c.Query.QName, c.Matches[0], 0) }) // Dispatch is up to you. It will probably look like this, but you // might want to add logging around the request or something more // complicated (different DSL instance depending on backend version?) func doit(b *backend.Backend, q *backend.Query) ([]*backend.Response, error) { if q.QClass == "IN" { return x.Lookup(q) } return nil, errors.New("Only IN QClass is supported") } pipe := backend.New( r, w, "Example backend" ) err1 := pipe.Negotiate() // do check for errors err2 := pipe.Run(doit)
AUTOGENERATED helper methods for IANA-registered RRTYPES. Do not edit. See generate_dsl_helpers.sh for details
Index ¶
- Variables
- type Callback
- type Context
- type DSL
- func (d *DSL) A(matcher string, f Callback)
- func (d *DSL) AAAA(matcher string, f Callback)
- func (d *DSL) AFSDB(matcher string, f Callback)
- func (d *DSL) APL(matcher string, f Callback)
- func (d *DSL) ATMA(matcher string, f Callback)
- func (d *DSL) AXFR(matcher string, f Callback)
- func (d *DSL) Before(f Callback)
- func (d *DSL) CAA(matcher string, f Callback)
- func (d *DSL) CDNSKEY(matcher string, f Callback)
- func (d *DSL) CDS(matcher string, f Callback)
- func (d *DSL) CERT(matcher string, f Callback)
- func (d *DSL) CNAME(matcher string, f Callback)
- func (d *DSL) DHCID(matcher string, f Callback)
- func (d *DSL) DLV(matcher string, f Callback)
- func (d *DSL) DNAME(matcher string, f Callback)
- func (d *DSL) DNSKEY(matcher string, f Callback)
- func (d *DSL) DS(matcher string, f Callback)
- func (d *DSL) EID(matcher string, f Callback)
- func (d *DSL) GID(matcher string, f Callback)
- func (d *DSL) GPOS(matcher string, f Callback)
- func (d *DSL) HINFO(matcher string, f Callback)
- func (d *DSL) HIP(matcher string, f Callback)
- func (d *DSL) IPSECKEY(matcher string, f Callback)
- func (d *DSL) ISDN(matcher string, f Callback)
- func (d *DSL) IXFR(matcher string, f Callback)
- func (d *DSL) KEY(matcher string, f Callback)
- func (d *DSL) KX(matcher string, f Callback)
- func (d *DSL) LOC(matcher string, f Callback)
- func (d *DSL) LP(matcher string, f Callback)
- func (d *DSL) Lookup(q *backend.Query) ([]*backend.Response, error)
- func (d *DSL) MAILA(matcher string, f Callback)
- func (d *DSL) MAILB(matcher string, f Callback)
- func (d *DSL) MB(matcher string, f Callback)
- func (d *DSL) MD(matcher string, f Callback)
- func (d *DSL) MF(matcher string, f Callback)
- func (d *DSL) MG(matcher string, f Callback)
- func (d *DSL) MINFO(matcher string, f Callback)
- func (d *DSL) MR(matcher string, f Callback)
- func (d *DSL) MX(matcher string, f Callback)
- func (d *DSL) NAPTR(matcher string, f Callback)
- func (d *DSL) NID(matcher string, f Callback)
- func (d *DSL) NIMLOC(matcher string, f Callback)
- func (d *DSL) NINFO(matcher string, f Callback)
- func (d *DSL) NS(matcher string, f Callback)
- func (d *DSL) NSAP(matcher string, f Callback)
- func (d *DSL) NSEC(matcher string, f Callback)
- func (d *DSL) NULL(matcher string, f Callback)
- func (d *DSL) NXT(matcher string, f Callback)
- func (d *DSL) OPENPGPKEY(matcher string, f Callback)
- func (d *DSL) OPT(matcher string, f Callback)
- func (d *DSL) PTR(matcher string, f Callback)
- func (d *DSL) PX(matcher string, f Callback)
- func (d *DSL) RKEY(matcher string, f Callback)
- func (d *DSL) RP(matcher string, f Callback)
- func (d *DSL) RRSIG(matcher string, f Callback)
- func (d *DSL) RT(matcher string, f Callback)
- func (d *DSL) Register(qtype string, re *regexp.Regexp, f Callback)
- func (d *DSL) SIG(matcher string, f Callback)
- func (d *DSL) SINK(matcher string, f Callback)
- func (d *DSL) SOA(matcher string, f Callback)
- func (d *DSL) SPF(matcher string, f Callback)
- func (d *DSL) SRV(matcher string, f Callback)
- func (d *DSL) SSHFP(matcher string, f Callback)
- func (d *DSL) String() string
- func (d *DSL) TA(matcher string, f Callback)
- func (d *DSL) TALINK(matcher string, f Callback)
- func (d *DSL) TKEY(matcher string, f Callback)
- func (d *DSL) TLSA(matcher string, f Callback)
- func (d *DSL) TSIG(matcher string, f Callback)
- func (d *DSL) TXT(matcher string, f Callback)
- func (d *DSL) TYPE(matcher string, f Callback)
- func (d *DSL) UID(matcher string, f Callback)
- func (d *DSL) UINFO(matcher string, f Callback)
- func (d *DSL) UNSPEC(matcher string, f Callback)
- func (d *DSL) URI(matcher string, f Callback)
- func (d *DSL) WKS(matcher string, f Callback)
Constants ¶
This section is empty.
Variables ¶
var RRTypes = []string{
"A",
"AAAA",
"AFSDB",
"APL",
"ATMA",
"AXFR",
"CAA",
"CDNSKEY",
"CDS",
"CERT",
"CNAME",
"DHCID",
"DLV",
"DNAME",
"DNSKEY",
"DS",
"EID",
"GID",
"GPOS",
"HINFO",
"HIP",
"IPSECKEY",
"ISDN",
"IXFR",
"KEY",
"KX",
"LOC",
"LP",
"MAILA",
"MAILB",
"MB",
"MD",
"MF",
"MG",
"MINFO",
"MR",
"MX",
"NAPTR",
"NID",
"NIMLOC",
"NINFO",
"NS",
"NSAP",
"NSEC",
"NULL",
"NXT",
"OPENPGPKEY",
"OPT",
"PTR",
"PX",
"RKEY",
"RP",
"RRSIG",
"RT",
"SIG",
"SINK",
"SOA",
"SPF",
"SRV",
"SSHFP",
"TA",
"TALINK",
"TKEY",
"TLSA",
"TSIG",
"TXT",
"TYPE",
"UID",
"UINFO",
"UNSPEC",
"URI",
"WKS",
}
Functions ¶
This section is empty.
Types ¶
type Callback ¶
type Callback func(c *Context)
Callbacks are registered against the DSL instance and run against incoming queries if the regexp they are registered with matches the QName of the query
type Context ¶
type Context struct { // Replies that don't specify a TTL will be given this instead. DefaultTTL int // The query that triggered this callback run. Note that its QType // member may be "ANY" Query *backend.Query // QType this callback is being run as. Matches the qtype field given // with the callback at the time DSL.Register was called QType string // The callback is registered with a regexp; if that regexp contains // any match groups, then the matched text is placed here. Matches []string // Set this if an error has been encountered; no more callbacks will be // run, and the error text (only) will be reported to the backend. Error error // Answers to be sent to the backend are stored here. Context.Reply() // calls, etc, generate answers and put them here, for instance. // If multiple callbacks are being run, then later callbacks will be // able to see the answers earlier ones generated (for now) Answers []*backend.Response }
Callbacks are run with a context instance, which allows them to accumulate answers while maintaining a short type signature. It will also make concurrent callbacks easier, when we handle that, but for now one context is maintained across all callbacks for a particular query
func (*Context) ReplyExtra ¶
Add an answer, specifying both QName and TTL.
type DSL ¶
type DSL struct {
// contains filtered or unexported fields
}
Instances of this struct are used to hold onto registered callbacks, etc.
func NewWithTTL ¶
Get a new builder, specifying a default TTL explicitly
func (*DSL) A ¶
Helper function to register a callback for A queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "A" string directly.
func (*DSL) AAAA ¶
Helper function to register a callback for AAAA queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "AAAA" string directly.
func (*DSL) AFSDB ¶
Helper function to register a callback for AFSDB queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "AFSDB" string directly.
func (*DSL) APL ¶
Helper function to register a callback for APL queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "APL" string directly.
func (*DSL) ATMA ¶
Helper function to register a callback for ATMA queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "ATMA" string directly.
func (*DSL) AXFR ¶
Helper function to register a callback for AXFR queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "AXFR" string directly.
func (*DSL) Before ¶
Register a callback to run before every request. Set c.Error to halt processing, or mutate the context however you like.
func (*DSL) CAA ¶
Helper function to register a callback for CAA queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "CAA" string directly.
func (*DSL) CDNSKEY ¶
Helper function to register a callback for CDNSKEY queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "CDNSKEY" string directly.
func (*DSL) CDS ¶
Helper function to register a callback for CDS queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "CDS" string directly.
func (*DSL) CERT ¶
Helper function to register a callback for CERT queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "CERT" string directly.
func (*DSL) CNAME ¶
Helper function to register a callback for CNAME queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "CNAME" string directly.
func (*DSL) DHCID ¶
Helper function to register a callback for DHCID queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "DHCID" string directly.
func (*DSL) DLV ¶
Helper function to register a callback for DLV queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "DLV" string directly.
func (*DSL) DNAME ¶
Helper function to register a callback for DNAME queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "DNAME" string directly.
func (*DSL) DNSKEY ¶
Helper function to register a callback for DNSKEY queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "DNSKEY" string directly.
func (*DSL) DS ¶
Helper function to register a callback for DS queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "DS" string directly.
func (*DSL) EID ¶
Helper function to register a callback for EID queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "EID" string directly.
func (*DSL) GID ¶
Helper function to register a callback for GID queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "GID" string directly.
func (*DSL) GPOS ¶
Helper function to register a callback for GPOS queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "GPOS" string directly.
func (*DSL) HINFO ¶
Helper function to register a callback for HINFO queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "HINFO" string directly.
func (*DSL) HIP ¶
Helper function to register a callback for HIP queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "HIP" string directly.
func (*DSL) IPSECKEY ¶
Helper function to register a callback for IPSECKEY queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "IPSECKEY" string directly.
func (*DSL) ISDN ¶
Helper function to register a callback for ISDN queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "ISDN" string directly.
func (*DSL) IXFR ¶
Helper function to register a callback for IXFR queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "IXFR" string directly.
func (*DSL) KEY ¶
Helper function to register a callback for KEY queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "KEY" string directly.
func (*DSL) KX ¶
Helper function to register a callback for KX queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "KX" string directly.
func (*DSL) LOC ¶
Helper function to register a callback for LOC queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "LOC" string directly.
func (*DSL) LP ¶
Helper function to register a callback for LP queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "LP" string directly.
func (*DSL) Lookup ¶
Run all registered callbacks against the query. If any callbacks report an error, we halt and return the error only (partially constructed responses are discarded).
For now, callbacks are run sequentially, rather than in parallel. There could be a speedup to running each callback in its own goroutine. Currently, all callbacks share the same context instance; we'd have to change that if we ran them in parallel.
func (*DSL) MAILA ¶
Helper function to register a callback for MAILA queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "MAILA" string directly.
func (*DSL) MAILB ¶
Helper function to register a callback for MAILB queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "MAILB" string directly.
func (*DSL) MB ¶
Helper function to register a callback for MB queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "MB" string directly.
func (*DSL) MD ¶
Helper function to register a callback for MD queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "MD" string directly.
func (*DSL) MF ¶
Helper function to register a callback for MF queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "MF" string directly.
func (*DSL) MG ¶
Helper function to register a callback for MG queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "MG" string directly.
func (*DSL) MINFO ¶
Helper function to register a callback for MINFO queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "MINFO" string directly.
func (*DSL) MR ¶
Helper function to register a callback for MR queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "MR" string directly.
func (*DSL) MX ¶
Helper function to register a callback for MX queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "MX" string directly.
func (*DSL) NAPTR ¶
Helper function to register a callback for NAPTR queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "NAPTR" string directly.
func (*DSL) NID ¶
Helper function to register a callback for NID queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "NID" string directly.
func (*DSL) NIMLOC ¶
Helper function to register a callback for NIMLOC queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "NIMLOC" string directly.
func (*DSL) NINFO ¶
Helper function to register a callback for NINFO queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "NINFO" string directly.
func (*DSL) NS ¶
Helper function to register a callback for NS queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "NS" string directly.
func (*DSL) NSAP ¶
Helper function to register a callback for NSAP queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "NSAP" string directly.
func (*DSL) NSEC ¶
Helper function to register a callback for NSEC queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "NSEC" string directly.
func (*DSL) NULL ¶
Helper function to register a callback for NULL queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "NULL" string directly.
func (*DSL) NXT ¶
Helper function to register a callback for NXT queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "NXT" string directly.
func (*DSL) OPENPGPKEY ¶
Helper function to register a callback for OPENPGPKEY queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "OPENPGPKEY" string directly.
func (*DSL) OPT ¶
Helper function to register a callback for OPT queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "OPT" string directly.
func (*DSL) PTR ¶
Helper function to register a callback for PTR queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "PTR" string directly.
func (*DSL) PX ¶
Helper function to register a callback for PX queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "PX" string directly.
func (*DSL) RKEY ¶
Helper function to register a callback for RKEY queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "RKEY" string directly.
func (*DSL) RP ¶
Helper function to register a callback for RP queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "RP" string directly.
func (*DSL) RRSIG ¶
Helper function to register a callback for RRSIG queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "RRSIG" string directly.
func (*DSL) RT ¶
Helper function to register a callback for RT queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "RT" string directly.
func (*DSL) Register ¶
Register a callback to be run whenever a query with a QName matching the regular expression comes in. The regex is provided as a string (matcher) to keep ordinary invocations short; it's compiled immediately with regexp.MustCompile. Don't forget to anchor your regexes!
If match groups are included in the regex, then any matched text is placed in the Context the callback receives.
Callbacks are run with slightly obtuse ordering: all callbacks of a qtype are run in the order they were registered. We iterate the list of qtypes in the order that a callback with a matching qtype was *first* registered. If your pdns server has the "noshuffle" configuration directive, the order will be reflected in the responses returned by it; future concurrent DSL should maintain this ordering.
func (*DSL) SIG ¶
Helper function to register a callback for SIG queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "SIG" string directly.
func (*DSL) SINK ¶
Helper function to register a callback for SINK queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "SINK" string directly.
func (*DSL) SOA ¶
Helper function to register a callback for SOA queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "SOA" string directly.
func (*DSL) SPF ¶
Helper function to register a callback for SPF queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "SPF" string directly.
func (*DSL) SRV ¶
Helper function to register a callback for SRV queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "SRV" string directly.
func (*DSL) SSHFP ¶
Helper function to register a callback for SSHFP queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "SSHFP" string directly.
func (*DSL) TA ¶
Helper function to register a callback for TA queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "TA" string directly.
func (*DSL) TALINK ¶
Helper function to register a callback for TALINK queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "TALINK" string directly.
func (*DSL) TKEY ¶
Helper function to register a callback for TKEY queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "TKEY" string directly.
func (*DSL) TLSA ¶
Helper function to register a callback for TLSA queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "TLSA" string directly.
func (*DSL) TSIG ¶
Helper function to register a callback for TSIG queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "TSIG" string directly.
func (*DSL) TXT ¶
Helper function to register a callback for TXT queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "TXT" string directly.
func (*DSL) TYPE ¶
Helper function to register a callback for TYPE queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "TYPE" string directly.
func (*DSL) UID ¶
Helper function to register a callback for UID queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "UID" string directly.
func (*DSL) UINFO ¶
Helper function to register a callback for UINFO queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "UINFO" string directly.
func (*DSL) UNSPEC ¶
Helper function to register a callback for UNSPEC queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "UNSPEC" string directly.
func (*DSL) URI ¶
Helper function to register a callback for URI queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "URI" string directly.
func (*DSL) WKS ¶
Helper function to register a callback for WKS queries. The matcher is given as a string, which is compiled to a regular expression (using regexp.MustCompile) with the following rules:
* The regexp is anchored to the start of the match string("^" at start) * The case-insensitivity option is added "(?i)" * The regexp is anchored to the end of the match string ("$" at end)
If any of these options are unwelcome, you can use the DSL.Register and pass a regexp and the "WKS" string directly.