Skip to content

Commit

Permalink
change RecordType to RecordTypeNew
Browse files Browse the repository at this point in the history
  • Loading branch information
honwen committed Aug 16, 2017
1 parent fa99d41 commit 0eaac3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM chenhw2/alpine:base
MAINTAINER CHENHW2 <https://github.com/chenhw2>

ARG VER=20170715
ARG VER=20170816
ARG URL=https://github.com/chenhw2/aliyun-ddns-cli/releases/download/v$VER/aliddns_linux-amd64-$VER.tar.gz

RUN mkdir -p /usr/bin \
Expand Down
11 changes: 6 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func (ak *AccessKey) getClient() *dns.Client {
}
if ak.client == nil {
ak.client = dns.NewClient(ak.ID, ak.Secret)
ak.client.SetEndpoint(dns.DNSDefaultEndpointNew)
}
return ak.client
}
Expand All @@ -36,9 +37,9 @@ func (ak AccessKey) String() string {
return fmt.Sprintf("Access Key: [ ID: %s ;\t Secret: %s ]", ak.ID, ak.Secret)
}

func (ak *AccessKey) listRecord(domain string) (dnsRecords []dns.RecordType, err error) {
res, err := ak.getClient().DescribeDomainRecords(
&dns.DescribeDomainRecordsArgs{
func (ak *AccessKey) listRecord(domain string) (dnsRecords []dns.RecordTypeNew, err error) {
res, err := ak.getClient().DescribeDomainRecordsNew(
&dns.DescribeDomainRecordsNewArgs{
DomainName: domain,
})
if err != nil {
Expand All @@ -52,7 +53,7 @@ func (ak *AccessKey) delRecord(fulldomain string) (err error) {
rr := regexp.MustCompile(`\.[^\.]*`).ReplaceAllString(fulldomain, "")
domain := regexp.MustCompile(`^[^\.]*\.`).ReplaceAllString(fulldomain, "")
// fmt.Println(rr, domain)
var target *dns.RecordType
var target *dns.RecordTypeNew
if dnsRecords, err := ak.listRecord(domain); err == nil {
for i := range dnsRecords {
if dnsRecords[i].RR == rr {
Expand Down Expand Up @@ -100,7 +101,7 @@ func (ak *AccessKey) doDDNSUpdate(fulldomain, ipaddr string) (err error) {
rr := regexp.MustCompile(`\.[^\.]*`).ReplaceAllString(fulldomain, "")
domain := regexp.MustCompile(`^[^\.]*\.`).ReplaceAllString(fulldomain, "")
// fmt.Println(rr, domain)
var target *dns.RecordType
var target *dns.RecordTypeNew
if dnsRecords, err := ak.listRecord(domain); err == nil {
for i := range dnsRecords {
if dnsRecords[i].RR == rr {
Expand Down

0 comments on commit 0eaac3b

Please sign in to comment.