mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2026-03-17 13:55:37 +08:00
优化DNSPod和Alidns相关代码
This commit is contained in:
18
internal/dnsclients/dnspod/response_base.go
Normal file
18
internal/dnsclients/dnspod/response_base.go
Normal 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
|
||||
}
|
||||
13
internal/dnsclients/dnspod/response_domain_info.go
Normal file
13
internal/dnsclients/dnspod/response_domain_info.go
Normal 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"`
|
||||
}
|
||||
17
internal/dnsclients/dnspod/response_domain_list.go
Normal file
17
internal/dnsclients/dnspod/response_domain_list.go
Normal 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"`
|
||||
}
|
||||
8
internal/dnsclients/dnspod/response_interface.go
Normal file
8
internal/dnsclients/dnspod/response_interface.go
Normal 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)
|
||||
}
|
||||
13
internal/dnsclients/dnspod/response_record_create.go
Normal file
13
internal/dnsclients/dnspod/response_record_create.go
Normal 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"`
|
||||
}
|
||||
9
internal/dnsclients/dnspod/response_record_line.go
Normal file
9
internal/dnsclients/dnspod/response_record_line.go
Normal 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"`
|
||||
}
|
||||
23
internal/dnsclients/dnspod/response_record_list.go
Normal file
23
internal/dnsclients/dnspod/response_record_list.go
Normal 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"`
|
||||
}
|
||||
14
internal/dnsclients/dnspod/response_record_modify.go
Normal file
14
internal/dnsclients/dnspod/response_record_modify.go
Normal 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"`
|
||||
}
|
||||
7
internal/dnsclients/dnspod/response_record_remove.go
Normal file
7
internal/dnsclients/dnspod/response_record_remove.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user