mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
@@ -30,6 +30,7 @@ var defaultNameServerNames = []string{
|
||||
"ns3.systemdns.com",
|
||||
}
|
||||
|
||||
// OpenSRSApi is the api handle.
|
||||
type OpenSRSApi struct {
|
||||
UserName string // reseller user name
|
||||
ApiKey string // API Key
|
||||
@@ -38,10 +39,12 @@ type OpenSRSApi struct {
|
||||
client *opensrs.Client // Client
|
||||
}
|
||||
|
||||
// GetNameservers returns a list of nameservers.
|
||||
func (c *OpenSRSApi) GetNameservers(domainName string) ([]*models.Nameserver, error) {
|
||||
return models.ToNameservers(defaultNameServerNames)
|
||||
}
|
||||
|
||||
// GetRegistrarCorrections returns a list of corrections for a registrar.
|
||||
func (c *OpenSRSApi) GetRegistrarCorrections(dc *models.DomainConfig) ([]*models.Correction, error) {
|
||||
corrections := []*models.Correction{}
|
||||
|
||||
@@ -95,9 +98,8 @@ func (c *OpenSRSApi) getNameservers(domainName string) ([]string, error) {
|
||||
return nil, err
|
||||
}
|
||||
return dom.Attributes.NameserverList.ToString(), nil
|
||||
} else {
|
||||
return nil, errors.New("Domain is locked")
|
||||
}
|
||||
return nil, errors.New("Domain is locked")
|
||||
}
|
||||
|
||||
// Returns a function that can be invoked to change the delegation of the domain to the given name server names.
|
||||
@@ -124,12 +126,12 @@ func newProvider(m map[string]string, metadata json.RawMessage) (*OpenSRSApi, er
|
||||
api.ApiKey = m["apikey"]
|
||||
|
||||
if api.ApiKey == "" {
|
||||
return nil, fmt.Errorf("OpenSRS apikey must be provided.")
|
||||
return nil, fmt.Errorf("openSRS apikey must be provided")
|
||||
}
|
||||
|
||||
api.UserName = m["username"]
|
||||
if api.UserName == "" {
|
||||
return nil, fmt.Errorf("OpenSRS username key must be provided.")
|
||||
return nil, fmt.Errorf("openSRS username key must be provided")
|
||||
}
|
||||
|
||||
if m["baseurl"] != "" {
|
||||
|
Reference in New Issue
Block a user