dnsclients

package
v0.6.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2023 License: BSD-3-Clause Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DNSPodMaxTTL        int32 = 604800
	DNSPodInternational       = "international"
)
View Source
const CloudFlareAPIEndpoint = "https://api.cloudflare.com/client/v4/"
View Source
const CloudFlareDefaultRoute = "default"
View Source
const HuaweiDNSDefaultEndpoint = "https://dns.cn-north-4.myhuaweicloud.com/"

HuaweiDNSDefaultEndpoint 默认Endpoint 所有Endpoints:https://developer.huaweicloud.com/endpoint?DNS

Variables

This section is empty.

Functions

func FindAllProviderTypes

func FindAllProviderTypes() []maps.Map

FindAllProviderTypes 所有的服务商类型

func FindProviderTypeName

func FindProviderTypeName(providerType ProviderType) string

FindProviderTypeName 查找服务商名称

Types

type AliDNSProvider

type AliDNSProvider struct {
	BaseProvider

	ProviderId int64
	// contains filtered or unexported fields
}

AliDNSProvider 阿里云服务商

func (*AliDNSProvider) AddRecord

func (this *AliDNSProvider) AddRecord(domain string, newRecord *dnstypes.Record) error

AddRecord 设置记录

func (*AliDNSProvider) Auth

func (this *AliDNSProvider) Auth(params maps.Map) error

Auth 认证

func (*AliDNSProvider) DefaultRoute

func (this *AliDNSProvider) DefaultRoute() string

DefaultRoute 默认线路

func (*AliDNSProvider) DeleteRecord

func (this *AliDNSProvider) DeleteRecord(domain string, record *dnstypes.Record) error

DeleteRecord 删除记录

func (*AliDNSProvider) GetDomains

func (this *AliDNSProvider) GetDomains() (domains []string, err error)

GetDomains 获取所有域名列表

func (*AliDNSProvider) GetRecords

func (this *AliDNSProvider) GetRecords(domain string) (records []*dnstypes.Record, err error)

GetRecords 获取域名列表

func (*AliDNSProvider) GetRoutes

func (this *AliDNSProvider) GetRoutes(domain string) (routes []*dnstypes.Route, err error)

GetRoutes 读取域名支持的线路数据

func (*AliDNSProvider) QueryRecord

func (this *AliDNSProvider) QueryRecord(domain string, name string, recordType dnstypes.RecordType) (*dnstypes.Record, error)

QueryRecord 查询单个记录

func (*AliDNSProvider) QueryRecords added in v0.5.8

func (this *AliDNSProvider) QueryRecords(domain string, name string, recordType dnstypes.RecordType) ([]*dnstypes.Record, error)

QueryRecords 查询多个记录

func (*AliDNSProvider) UpdateRecord

func (this *AliDNSProvider) UpdateRecord(domain string, record *dnstypes.Record, newRecord *dnstypes.Record) error

UpdateRecord 修改记录

type BaseProvider

type BaseProvider struct{}

func (*BaseProvider) WrapError

func (this *BaseProvider) WrapError(err error, domain string, record *dnstypes.Record) error

WrapError 封装解析相关错误

type CloudFlareProvider

type CloudFlareProvider struct {
	BaseProvider

	ProviderId int64
	// contains filtered or unexported fields
}

func (*CloudFlareProvider) AddRecord

func (this *CloudFlareProvider) AddRecord(domain string, newRecord *dnstypes.Record) error

AddRecord 设置记录

func (*CloudFlareProvider) Auth

func (this *CloudFlareProvider) Auth(params maps.Map) error

Auth 认证

func (*CloudFlareProvider) DefaultRoute

func (this *CloudFlareProvider) DefaultRoute() string

DefaultRoute 默认线路

func (*CloudFlareProvider) DeleteRecord

func (this *CloudFlareProvider) DeleteRecord(domain string, record *dnstypes.Record) error

DeleteRecord 删除记录

func (*CloudFlareProvider) GetDomains

func (this *CloudFlareProvider) GetDomains() (domains []string, err error)

GetDomains 获取所有域名列表

func (*CloudFlareProvider) GetRecords

func (this *CloudFlareProvider) GetRecords(domain string) (records []*dnstypes.Record, err error)

GetRecords 获取域名解析记录列表

func (*CloudFlareProvider) GetRoutes

func (this *CloudFlareProvider) GetRoutes(domain string) (routes []*dnstypes.Route, err error)

GetRoutes 读取域名支持的线路数据

func (*CloudFlareProvider) QueryRecord

func (this *CloudFlareProvider) QueryRecord(domain string, name string, recordType dnstypes.RecordType) (*dnstypes.Record, error)

QueryRecord 查询单个记录

func (*CloudFlareProvider) QueryRecords added in v0.5.8

func (this *CloudFlareProvider) QueryRecords(domain string, name string, recordType dnstypes.RecordType) (records []*dnstypes.Record, err error)

QueryRecords 查询多个记录

func (*CloudFlareProvider) UpdateRecord

func (this *CloudFlareProvider) UpdateRecord(domain string, record *dnstypes.Record, newRecord *dnstypes.Record) error

UpdateRecord 修改记录

type CustomHTTPProvider

type CustomHTTPProvider struct {
	ProviderId int64

	BaseProvider
	// contains filtered or unexported fields
}

CustomHTTPProvider HTTP自定义DNS

func (*CustomHTTPProvider) AddRecord

func (this *CustomHTTPProvider) AddRecord(domain string, newRecord *dnstypes.Record) error

AddRecord 设置记录

func (*CustomHTTPProvider) Auth

func (this *CustomHTTPProvider) Auth(params maps.Map) error

Auth 认证 参数:

  • url
  • secret

func (*CustomHTTPProvider) DefaultRoute

func (this *CustomHTTPProvider) DefaultRoute() string

DefaultRoute 默认线路

func (*CustomHTTPProvider) DeleteRecord

func (this *CustomHTTPProvider) DeleteRecord(domain string, record *dnstypes.Record) error

DeleteRecord 删除记录

func (*CustomHTTPProvider) GetDomains

func (this *CustomHTTPProvider) GetDomains() (domains []string, err error)

GetDomains 获取所有域名列表

func (*CustomHTTPProvider) GetRecords

func (this *CustomHTTPProvider) GetRecords(domain string) (records []*dnstypes.Record, err error)

GetRecords 获取域名解析记录列表

func (*CustomHTTPProvider) GetRoutes

func (this *CustomHTTPProvider) GetRoutes(domain string) (routes []*dnstypes.Route, err error)

GetRoutes 读取域名支持的线路数据

func (*CustomHTTPProvider) QueryRecord

func (this *CustomHTTPProvider) QueryRecord(domain string, name string, recordType dnstypes.RecordType) (*dnstypes.Record, error)

QueryRecord 查询单个记录

func (*CustomHTTPProvider) QueryRecords added in v0.5.8

func (this *CustomHTTPProvider) QueryRecords(domain string, name string, recordType dnstypes.RecordType) (result []*dnstypes.Record, err error)

QueryRecords 查询多个记录

func (*CustomHTTPProvider) UpdateRecord

func (this *CustomHTTPProvider) UpdateRecord(domain string, record *dnstypes.Record, newRecord *dnstypes.Record) error

UpdateRecord 修改记录

type DNSPodProvider

type DNSPodProvider struct {
	BaseProvider

	ProviderId int64
	// contains filtered or unexported fields
}

DNSPodProvider DNSPod服务商 TODO 考虑支持线路ID TODO 支持自定义线路

func (*DNSPodProvider) AddRecord

func (this *DNSPodProvider) AddRecord(domain string, newRecord *dnstypes.Record) error

AddRecord 设置记录

func (*DNSPodProvider) Auth

func (this *DNSPodProvider) Auth(params maps.Map) error

Auth 认证

func (*DNSPodProvider) DefaultRoute

func (this *DNSPodProvider) DefaultRoute() string

DefaultRoute 默认线路

func (*DNSPodProvider) DeleteRecord

func (this *DNSPodProvider) DeleteRecord(domain string, record *dnstypes.Record) error

DeleteRecord 删除记录

func (*DNSPodProvider) GetDomains

func (this *DNSPodProvider) GetDomains() (domains []string, err error)

GetDomains 获取所有域名列表

func (*DNSPodProvider) GetRecords

func (this *DNSPodProvider) GetRecords(domain string) (records []*dnstypes.Record, err error)

GetRecords 获取域名列表

func (*DNSPodProvider) GetRoutes

func (this *DNSPodProvider) GetRoutes(domain string) (routes []*dnstypes.Route, err error)

GetRoutes 读取线路数据

func (*DNSPodProvider) QueryRecord

func (this *DNSPodProvider) QueryRecord(domain string, name string, recordType dnstypes.RecordType) (*dnstypes.Record, error)

QueryRecord 查询单个记录

func (*DNSPodProvider) QueryRecords added in v0.5.8

func (this *DNSPodProvider) QueryRecords(domain string, name string, recordType dnstypes.RecordType) ([]*dnstypes.Record, error)

QueryRecords 查询多个记录

func (*DNSPodProvider) UpdateRecord

func (this *DNSPodProvider) UpdateRecord(domain string, record *dnstypes.Record, newRecord *dnstypes.Record) error

UpdateRecord 修改记录

type DomainRecordsCache added in v0.5.6

type DomainRecordsCache struct {
	// contains filtered or unexported fields
}

DomainRecordsCache 域名记录缓存

func NewDomainRecordsCache added in v0.5.6

func NewDomainRecordsCache() *DomainRecordsCache

func (*DomainRecordsCache) AddDomainRecord added in v0.5.6

func (this *DomainRecordsCache) AddDomainRecord(providerId int64, domain string, record *dnstypes.Record)

AddDomainRecord 添加域名记录缓存

func (*DomainRecordsCache) Clean added in v0.5.6

func (this *DomainRecordsCache) Clean()

Clean 清除过期缓存

func (*DomainRecordsCache) DeleteDomainRecord added in v0.5.6

func (this *DomainRecordsCache) DeleteDomainRecord(providerId int64, domain string, recordId string)

DeleteDomainRecord 删除域名记录缓存

func (*DomainRecordsCache) QueryDomainRecord added in v0.5.6

func (this *DomainRecordsCache) QueryDomainRecord(providerId int64, domain string, recordName string, recordType string) (record *dnstypes.Record, hasRecords bool, ok bool)

QueryDomainRecord 从缓存中读取单条域名记录

func (*DomainRecordsCache) QueryDomainRecords added in v0.5.8

func (this *DomainRecordsCache) QueryDomainRecords(providerId int64, domain string, recordName string, recordType string) (records []*dnstypes.Record, hasRecords bool, ok bool)

QueryDomainRecords 从缓存中读取多条域名记录

func (*DomainRecordsCache) UpdateDomainRecord added in v0.5.6

func (this *DomainRecordsCache) UpdateDomainRecord(providerId int64, domain string, record *dnstypes.Record)

UpdateDomainRecord 修改域名记录缓存

func (*DomainRecordsCache) WriteDomainRecords added in v0.5.6

func (this *DomainRecordsCache) WriteDomainRecords(providerId int64, domain string, records []*dnstypes.Record)

WriteDomainRecords 写入域名记录缓存

type EdgeDNSAPIProvider added in v0.5.3

type EdgeDNSAPIProvider struct {
	BaseProvider

	ProviderId int64
	// contains filtered or unexported fields
}

func (*EdgeDNSAPIProvider) AddRecord added in v0.5.3

func (this *EdgeDNSAPIProvider) AddRecord(domain string, newRecord *dnstypes.Record) error

AddRecord 设置记录

func (*EdgeDNSAPIProvider) Auth added in v0.5.3

func (this *EdgeDNSAPIProvider) Auth(params maps.Map) error

Auth 认证

func (*EdgeDNSAPIProvider) DefaultRoute added in v0.5.3

func (this *EdgeDNSAPIProvider) DefaultRoute() string

DefaultRoute 默认线路

func (*EdgeDNSAPIProvider) DeleteRecord added in v0.5.3

func (this *EdgeDNSAPIProvider) DeleteRecord(domain string, record *dnstypes.Record) error

DeleteRecord 删除记录

func (*EdgeDNSAPIProvider) GetDomains added in v0.5.3

func (this *EdgeDNSAPIProvider) GetDomains() (domains []string, err error)

GetDomains 获取所有域名列表

func (*EdgeDNSAPIProvider) GetRecords added in v0.5.3

func (this *EdgeDNSAPIProvider) GetRecords(domain string) (records []*dnstypes.Record, err error)

GetRecords 获取域名解析记录列表

func (*EdgeDNSAPIProvider) GetRoutes added in v0.5.3

func (this *EdgeDNSAPIProvider) GetRoutes(domain string) (routes []*dnstypes.Route, err error)

GetRoutes 读取域名支持的线路数据

func (*EdgeDNSAPIProvider) QueryRecord added in v0.5.3

func (this *EdgeDNSAPIProvider) QueryRecord(domain string, name string, recordType dnstypes.RecordType) (*dnstypes.Record, error)

QueryRecord 查询单个记录

func (*EdgeDNSAPIProvider) QueryRecords added in v0.5.8

func (this *EdgeDNSAPIProvider) QueryRecords(domain string, name string, recordType dnstypes.RecordType) ([]*dnstypes.Record, error)

QueryRecords 查询多个记录

func (*EdgeDNSAPIProvider) UpdateRecord added in v0.5.3

func (this *EdgeDNSAPIProvider) UpdateRecord(domain string, record *dnstypes.Record, newRecord *dnstypes.Record) error

UpdateRecord 修改记录

type HuaweiDNSProvider

type HuaweiDNSProvider struct {
	BaseProvider

	ProviderId int64
	// contains filtered or unexported fields
}

HuaweiDNSProvider 华为云DNS 相关文档链接:https://support.huaweicloud.com/api-dns/dns_api_62001.html

func (*HuaweiDNSProvider) AddRecord

func (this *HuaweiDNSProvider) AddRecord(domain string, newRecord *dnstypes.Record) error

AddRecord 设置记录

func (*HuaweiDNSProvider) Auth

func (this *HuaweiDNSProvider) Auth(params maps.Map) error

Auth 认证

func (*HuaweiDNSProvider) DefaultRoute

func (this *HuaweiDNSProvider) DefaultRoute() string

DefaultRoute 默认线路

func (*HuaweiDNSProvider) DeleteRecord

func (this *HuaweiDNSProvider) DeleteRecord(domain string, record *dnstypes.Record) error

DeleteRecord 删除记录

func (*HuaweiDNSProvider) GetDomains

func (this *HuaweiDNSProvider) GetDomains() (domains []string, err error)

GetDomains 获取所有域名列表

func (*HuaweiDNSProvider) GetRecords

func (this *HuaweiDNSProvider) GetRecords(domain string) (records []*dnstypes.Record, err error)

GetRecords 获取域名解析记录列表

func (*HuaweiDNSProvider) GetRoutes

func (this *HuaweiDNSProvider) GetRoutes(domain string) (routes []*dnstypes.Route, err error)

GetRoutes 读取域名支持的线路数据

func (*HuaweiDNSProvider) QueryRecord

func (this *HuaweiDNSProvider) QueryRecord(domain string, name string, recordType dnstypes.RecordType) (*dnstypes.Record, error)

QueryRecord 查询单个记录

func (*HuaweiDNSProvider) QueryRecords added in v0.5.8

func (this *HuaweiDNSProvider) QueryRecords(domain string, name string, recordType dnstypes.RecordType) ([]*dnstypes.Record, error)

QueryRecords 查询多个记录

func (*HuaweiDNSProvider) UpdateRecord

func (this *HuaweiDNSProvider) UpdateRecord(domain string, record *dnstypes.Record, newRecord *dnstypes.Record) error

UpdateRecord 修改记录

type ProviderInterface

type ProviderInterface interface {
	// Auth 认证
	Auth(params maps.Map) error

	// GetDomains 获取所有域名列表
	GetDomains() (domains []string, err error)

	// GetRecords 获取域名解析记录列表
	GetRecords(domain string) (records []*dnstypes.Record, err error)

	// GetRoutes 读取域名支持的线路数据
	GetRoutes(domain string) (routes []*dnstypes.Route, err error)

	// QueryRecord 查询单个记录
	QueryRecord(domain string, name string, recordType dnstypes.RecordType) (*dnstypes.Record, error)

	// QueryRecords 查询多个记录
	QueryRecords(domain string, name string, recordType dnstypes.RecordType) ([]*dnstypes.Record, error)

	// AddRecord 设置记录
	AddRecord(domain string, newRecord *dnstypes.Record) error

	// UpdateRecord 修改记录
	UpdateRecord(domain string, record *dnstypes.Record, newRecord *dnstypes.Record) error

	// DeleteRecord 删除记录
	DeleteRecord(domain string, record *dnstypes.Record) error

	// DefaultRoute 默认线路
	DefaultRoute() string
}

ProviderInterface DNS操作接口

func FindProvider

func FindProvider(providerType ProviderType, providerId int64) ProviderInterface

FindProvider 查找服务商实例

type ProviderType

type ProviderType = string
const (
	ProviderTypeDNSPod       ProviderType = "dnspod"       // DNSPod
	ProviderTypeAliDNS       ProviderType = "alidns"       // 阿里云DNS
	ProviderTypeHuaweiDNS    ProviderType = "huaweiDNS"    // 华为DNS
	ProviderTypeCloudFlare   ProviderType = "cloudFlare"   // CloudFlare DNS
	ProviderTypeLocalEdgeDNS ProviderType = "localEdgeDNS" // 和当前系统集成的EdgeDNS
	ProviderTypeEdgeDNSAPI   ProviderType = "edgeDNSAPI"   // 通过API连接的EdgeDNS
	ProviderTypeCustomHTTP   ProviderType = "customHTTP"   // 自定义HTTP接口
)

服务商代号

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL