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

Switch from govendor to go modules. (#587)

Thanks to @BenoitKnecht for leading the way on this.
This commit is contained in:
Tom Limoncelli
2020-01-18 14:40:28 -05:00
committed by GitHub
parent 31188c3a70
commit 16d0043cce
1554 changed files with 400867 additions and 98222 deletions

View File

@@ -26,6 +26,7 @@ func (s *DomainsService) GetDomain(domainIdentifier string, domainType string, l
}
// UpdateDomainNameservers changes domain servers on a domain.
//
func (s *DomainsService) UpdateDomainNameservers(domainIdentifier string, newDs []string) (*OpsResponse, error) {
opsResponse := OpsResponse{}
@@ -39,18 +40,3 @@ func (s *DomainsService) UpdateDomainNameservers(domainIdentifier string, newDs
_ = resp
return &opsResponse, nil
}
// GetDNSZone fetches zone info for a domain.
//
func (s *DomainsService) GetDNSZone(domainIdentifier string) (*OpsResponse, error) {
opsResponse := OpsResponse{}
opsRequestAttributes := OpsRequestAttributes{Domain: domainIdentifier}
resp, err := s.client.post("GET_DNS_ZONE", "DOMAIN", opsRequestAttributes, &opsResponse)
if err != nil {
return nil, err
}
_ = resp
return &opsResponse, nil
}

View File

@@ -4,12 +4,10 @@ package opensrs
import (
"bytes"
"crypto/tls"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
)
const (
@@ -20,8 +18,8 @@ const (
Version = "0.0.1"
// defaultBaseURL to the OpenSRS production API.
//defaultBaseURL = "https://rr-n1-tor.opensrs.net:55443"
defaultBaseURL = "https://horizon.opensrs.net:55443"
defaultBaseURL = "https://rr-n1-tor.opensrs.net:55443"
//defaultBaseURL = "https://horizon.opensrs.net:55443"
// userAgent represents the default user agent used
// when no other user agent is set.
@@ -53,13 +51,7 @@ type Client struct {
// NewClient returns a new OpenSRS API client using the given credentials.
func NewClient(credentials Credentials) *Client {
proxyUrl, _ := url.Parse("http://127.0.0.1:8080")
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify : true},
Proxy: http.ProxyURL(proxyUrl),
}
c := &Client{Credentials: credentials, HttpClient: &http.Client{Transport: tr}, BaseURL: defaultBaseURL}
c := &Client{Credentials: credentials, HttpClient: &http.Client{}, BaseURL: defaultBaseURL}
c.Domains = &DomainsService{client: c}
return c
}

View File

@@ -7,49 +7,6 @@ type NameserverList []struct {
SortOrder string `json:"sortorder,omitempty"`
}
type ARecord struct {
IpAddress string `json:"ipaddress,omitempty"`
SubDomain string `json:"subdomain,omitempty"`
}
type AAAARecord struct {
Ipv6Address string `json:"ipv6_address,omitempty"`
SubDomain string `json:"subdomain,omitempty"`
}
type CNAMERecord struct {
HostName string `json:"hostname,omitempty"`
SubDomain string `json:"subdomain,omitempty"`
}
type MXRecord struct {
Priority string `json:"priority,omitempty"`
SubDomain string `json:"subdomain,omitempty"`
HostName string `json:"hostname,omitempty"`
}
type SRVRecord struct {
Priority string `json:"priority,omitempty"`
Weight string `json:"weight,omitempty"`
SubDomain string `json:"subdomain,omitempty"`
HostName string `json:"hostname,omitempty"`
Port string `json:"port,omitempty"`
}
type TXTRecord struct {
SubDomain string `json:"subdomain,omitempty"`
Text string `json:"text,omitempty"`
}
type DnsRecords struct {
A []ARecord `json:"A,omitempty"`
AAAA []AAAARecord `json:"AAAA,omitempty"`
CNAME []CNAMERecord `json:"CNAME,omitempty"`
MX []MXRecord `json:"MX,omitempty"`
SRV []SRVRecord `json:"SRV,omitempty"`
TXT []TXTRecord `json:"TXT,omitempty"`
}
func (n NameserverList) ToString() []string {
domains := make([]string, len(n))
for i, ns := range n {
@@ -80,7 +37,6 @@ type OpsResponse struct {
NameserverList NameserverList `json:"nameserver_list,omitempty"`
Type string `json:"type,omitempty"`
LockState string `json:"lock_state,omitempty"`
Records DnsRecords `json:"records,omitempty"`
} `json:"attributes"`
}

View File

@@ -155,7 +155,7 @@ func FromXml(b []byte, v interface{}) error {
}
m := q.Body.DataBlock.decode()
jsonString, _ := json.Marshal(m)
log.Println(string(jsonString))
return json.Unmarshal(jsonString, &v)
}