优化DNSPod和Alidns相关代码

This commit is contained in:
GoEdgeLab
2022-10-20 18:06:27 +08:00
parent 0dc5478bc6
commit 5fc0cd688b
14 changed files with 202 additions and 74 deletions

View File

@@ -0,0 +1,18 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package dnspod
type BaseResponse struct {
Status struct {
Code string `json:"code"`
Message string `json:"message"`
} `json:"status"`
}
func (this *BaseResponse) IsOk() bool {
return this.Status.Code == "1"
}
func (this *BaseResponse) LastError() (code string, message string) {
return this.Status.Code, this.Status.Message
}

View File

@@ -0,0 +1,13 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package dnspod
type DomainInfoResponse struct {
BaseResponse
Domain struct {
Id any `json:"id"`
Name string `json:"name"`
Grade string `json:"grade"`
} `json:"domain"`
}

View File

@@ -0,0 +1,17 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package dnspod
type DomainListResponse struct {
BaseResponse
Info struct {
DomainTotal int `json:"domain_total"`
AllTotal int `json:"all_total"`
MineTotal int `json:"mine_total"`
} `json:"info"`
Domains []struct {
Name string `json:"name"`
} `json:"domains"`
}

View File

@@ -0,0 +1,8 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package dnspod
type ResponseInterface interface {
IsOk() bool
LastError() (code string, message string)
}

View File

@@ -0,0 +1,13 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package dnspod
type RecordCreateResponse struct {
BaseResponse
Record struct {
Id any `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
} `json:"record"`
}

View File

@@ -0,0 +1,9 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package dnspod
type RecordLineResponse struct {
BaseResponse
Lines []string `json:"lines"`
}

View File

@@ -0,0 +1,23 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package dnspod
type RecordListResponse struct {
BaseResponse
Info struct {
SubDomains string `json:"sub_domains"`
RecordTotal string `json:"record_total"`
RecordsNum string `json:"records_num"`
} `json:"info"`
Records []struct {
Id any `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Value string `json:"value"`
Line string `json:"line"`
LineId string `json:"line_id"`
TTL string `json:"ttl"`
} `json:"records"`
}

View File

@@ -0,0 +1,14 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package dnspod
type RecordModifyResponse struct {
BaseResponse
Record struct {
Id any `json:"id"`
Name string `json:"name"`
Value string `json:"value"`
Status string `json:"status"`
} `json:"record"`
}

View File

@@ -0,0 +1,7 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
package dnspod
type RecordRemoveResponse struct {
BaseResponse
}