1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

Enable PTR records for BIND driver (#146)

* WIP

* Enable PTR records in dnsconfig.js, in BIND provider.

* Rename REVERSE() to REV().

* More accurate PTR target checking

* Document REV()

* Fix broken test
This commit is contained in:
Tom Limoncelli
2017-07-06 10:18:15 -04:00
committed by Craig Peterson
parent bce99a1c25
commit aa92817116
9 changed files with 135 additions and 55 deletions

View File

@ -19,7 +19,7 @@ func ExecuteJavascript(script string, devMode bool) (*models.DNSConfig, error) {
vm := otto.New()
vm.Set("require", require)
vm.Set("REVERSE", reverse)
vm.Set("REV", reverse)
helperJs := GetHelpers(devMode)
// run helper script to prime vm and initialize variables
@ -75,11 +75,10 @@ func throw(vm *otto.Otto, str string) {
func reverse(call otto.FunctionCall) otto.Value {
if len(call.ArgumentList) != 1 {
throw(call.Otto, "REVERSE takes exactly one argument")
throw(call.Otto, "REV takes exactly one argument")
}
dom := call.Argument(0).String()
rev, err := transform.ReverseDomainName(dom)
fmt.Println(dom, rev, err)
if err != nil {
throw(call.Otto, err.Error())
}