2020-11-13 18:22:22 +08:00
|
|
|
package dnsclients
|
|
|
|
|
|
2021-06-02 18:13:48 +08:00
|
|
|
import (
|
|
|
|
|
"github.com/TeaOSLab/EdgeAPI/internal/dnsclients/dnstypes"
|
|
|
|
|
"github.com/iwind/TeaGo/maps"
|
|
|
|
|
)
|
2020-11-13 18:22:22 +08:00
|
|
|
|
2021-04-15 17:02:01 +08:00
|
|
|
// ProviderInterface DNS操作接口
|
2020-11-13 18:22:22 +08:00
|
|
|
type ProviderInterface interface {
|
2021-04-15 17:02:01 +08:00
|
|
|
// Auth 认证
|
2020-11-13 18:22:22 +08:00
|
|
|
Auth(params maps.Map) error
|
|
|
|
|
|
2021-08-19 14:26:34 +08:00
|
|
|
// GetDomains 获取所有域名列表
|
|
|
|
|
GetDomains() (domains []string, err error)
|
|
|
|
|
|
2021-04-15 17:02:01 +08:00
|
|
|
// GetRecords 获取域名解析记录列表
|
2021-06-02 18:13:48 +08:00
|
|
|
GetRecords(domain string) (records []*dnstypes.Record, err error)
|
2020-11-13 18:22:22 +08:00
|
|
|
|
2021-04-15 17:02:01 +08:00
|
|
|
// GetRoutes 读取域名支持的线路数据
|
2021-06-02 18:13:48 +08:00
|
|
|
GetRoutes(domain string) (routes []*dnstypes.Route, err error)
|
2020-11-13 18:22:22 +08:00
|
|
|
|
2021-04-15 17:02:01 +08:00
|
|
|
// QueryRecord 查询单个记录
|
2021-06-02 18:13:48 +08:00
|
|
|
QueryRecord(domain string, name string, recordType dnstypes.RecordType) (*dnstypes.Record, error)
|
2020-11-26 16:39:06 +08:00
|
|
|
|
2021-04-15 17:02:01 +08:00
|
|
|
// AddRecord 设置记录
|
2021-06-02 18:13:48 +08:00
|
|
|
AddRecord(domain string, newRecord *dnstypes.Record) error
|
2020-11-13 18:22:22 +08:00
|
|
|
|
2021-04-15 17:02:01 +08:00
|
|
|
// UpdateRecord 修改记录
|
2021-06-02 18:13:48 +08:00
|
|
|
UpdateRecord(domain string, record *dnstypes.Record, newRecord *dnstypes.Record) error
|
2020-11-13 18:22:22 +08:00
|
|
|
|
2021-04-15 17:02:01 +08:00
|
|
|
// DeleteRecord 删除记录
|
2021-06-02 18:13:48 +08:00
|
|
|
DeleteRecord(domain string, record *dnstypes.Record) error
|
2020-11-14 21:28:07 +08:00
|
|
|
|
2021-04-15 17:02:01 +08:00
|
|
|
// DefaultRoute 默认线路
|
2020-11-14 21:28:07 +08:00
|
|
|
DefaultRoute() string
|
2020-11-13 18:22:22 +08:00
|
|
|
}
|