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

generalize capability validation

This commit is contained in:
Craig Peterson
2017-07-06 10:24:21 -04:00
parent aa92817116
commit 152892f62a
2 changed files with 46 additions and 37 deletions

View File

@@ -31,6 +31,25 @@ import (
"github.com/StackExchange/dnscontrol/providers/diff"
)
func initBind(config map[string]string, providermeta json.RawMessage) (providers.DNSServiceProvider, error) {
// config -- the key/values from creds.json
// meta -- the json blob from NewReq('name', 'TYPE', meta)
api := &Bind{}
if len(providermeta) != 0 {
err := json.Unmarshal(providermeta, api)
if err != nil {
return nil, err
}
}
api.nameservers = models.StringsToNameservers(api.DefaultNS)
return api, nil
}
func init() {
providers.RegisterDomainServiceProviderType("BIND", initBind, providers.CanUsePTR)
}
type SoaInfo struct {
Ns string `json:"master"`
Mbox string `json:"mbox"`
@@ -256,22 +275,3 @@ func (c *Bind) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Correcti
return corrections, nil
}
func initBind(config map[string]string, providermeta json.RawMessage) (providers.DNSServiceProvider, error) {
// config -- the key/values from creds.json
// meta -- the json blob from NewReq('name', 'TYPE', meta)
api := &Bind{}
if len(providermeta) != 0 {
err := json.Unmarshal(providermeta, api)
if err != nil {
return nil, err
}
}
api.nameservers = models.StringsToNameservers(api.DefaultNS)
return api, nil
}
func init() {
providers.RegisterDomainServiceProviderType("BIND", initBind)
}