dns

package
v6.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Addresses = []string{
		alidnsEndpoint,
		baiduEndpoint,
		zonesAPI,
		recordListAPI,
		googleDomainEndpoint,
		huaweicloudEndpoint,
		nameCheapEndpoint,
		nameSiloListRecordEndpoint,
		porkbunEndpoint,
		tencentCloudEndPoint,
		dynadotEndpoint,
	}

	Ipcache = [][2]util.IpCache{}
)

Functions

func RunOnce

func RunOnce()

RunOnce RunOnce

func RunTimer

func RunTimer(delay time.Duration)

RunTimer 定时运行

Types

type Alidns

type Alidns struct {
	DNS     config.DNS
	Domains config.Domains
	TTL     string
}

https://help.aliyun.com/document_detail/29776.html?spm=a2c4g.11186623.6.672.715a45caji9dMA Alidns Alidns

func (*Alidns) AddUpdateDomainRecords

func (ali *Alidns) AddUpdateDomainRecords() config.Domains

AddUpdateDomainRecords 添加或更新IPv4/IPv6记录

func (*Alidns) Init

func (ali *Alidns) Init(dnsConf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache)

Init 初始化

type AlidnsRecord

type AlidnsRecord struct {
	DomainName string
	RecordID   string
	Value      string
}

AlidnsRecord record

type AlidnsResp

type AlidnsResp struct {
	RecordID  string
	RequestID string
}

AlidnsResp 修改/添加返回结果

type AlidnsSubDomainRecords

type AlidnsSubDomainRecords struct {
	TotalCount    int
	DomainRecords struct {
		Record []AlidnsRecord
	}
}

AlidnsSubDomainRecords 记录

type BaiduCloud

type BaiduCloud struct {
	DNS     config.DNS
	Domains config.Domains
	TTL     int
}

func (*BaiduCloud) AddUpdateDomainRecords

func (baidu *BaiduCloud) AddUpdateDomainRecords() config.Domains

AddUpdateDomainRecords 添加或更新IPv4/IPv6记录

func (*BaiduCloud) Init

func (baidu *BaiduCloud) Init(dnsConf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache)

type BaiduCreateRequest

type BaiduCreateRequest struct {
	Domain   string `json:"domain"`
	RdType   string `json:"rdType"`
	TTL      int    `json:"ttl"`
	Rdata    string `json:"rdata"`
	ZoneName string `json:"zoneName"`
}

BaiduCreateRequest 创建新解析请求的body json

type BaiduListRequest

type BaiduListRequest struct {
	Domain   string `json:"domain"`
	PageNum  int    `json:"pageNum"`
	PageSize int    `json:"pageSize"`
}

BaiduListRequest 获取解析列表请求的body json

type BaiduModifyRequest

type BaiduModifyRequest struct {
	RecordId uint   `json:"recordId"`
	Domain   string `json:"domain"`
	View     string `json:"view"`
	RdType   string `json:"rdType"`
	TTL      int    `json:"ttl"`
	Rdata    string `json:"rdata"`
	ZoneName string `json:"zoneName"`
}

BaiduModifyRequest 修改解析请求的body json

type BaiduRecord

type BaiduRecord struct {
	RecordId uint   `json:"recordId"`
	Domain   string `json:"domain"`
	View     string `json:"view"`
	Rdtype   string `json:"rdtype"`
	TTL      int    `json:"ttl"`
	Rdata    string `json:"rdata"`
	ZoneName string `json:"zoneName"`
	Status   string `json:"status"`
}

BaiduRecord 单条解析记录

type BaiduRecordsResp

type BaiduRecordsResp struct {
	TotalCount int           `json:"totalCount"`
	Result     []BaiduRecord `json:"result"`
}

BaiduRecordsResp 获取解析列表拿到的结果

type Callback

type Callback struct {
	DNS     config.DNS
	Domains config.Domains
	TTL     string
	// contains filtered or unexported fields
}

func (*Callback) AddUpdateDomainRecords

func (cb *Callback) AddUpdateDomainRecords() config.Domains

AddUpdateDomainRecords 添加或更新IPv4/IPv6记录

func (*Callback) Init

func (cb *Callback) Init(dnsConf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache)

Init 初始化

type Cloudflare

type Cloudflare struct {
	DNS     config.DNS
	Domains config.Domains
	TTL     int
}

Cloudflare Cloudflare实现

func (*Cloudflare) AddUpdateDomainRecords

func (cf *Cloudflare) AddUpdateDomainRecords() config.Domains

AddUpdateDomainRecords 添加或更新IPv4/IPv6记录

func (*Cloudflare) Init

func (cf *Cloudflare) Init(dnsConf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache)

Init 初始化

type CloudflareRecord

type CloudflareRecord struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Type    string `json:"type"`
	Content string `json:"content"`
	Proxied bool   `json:"proxied"`
	TTL     int    `json:"ttl"`
	Comment string `json:"comment"`
}

CloudflareRecord 记录实体

type CloudflareRecordsResp

type CloudflareRecordsResp struct {
	CloudflareStatus
	Result []CloudflareRecord
}

CloudflareRecordsResp records

type CloudflareStatus

type CloudflareStatus struct {
	Success  bool
	Messages []string
}

CloudflareStatus 公共状态

type CloudflareZonesResp

type CloudflareZonesResp struct {
	CloudflareStatus
	Result []struct {
		ID     string
		Name   string
		Status string
		Paused bool
	}
}

CloudflareZonesResp cloudflare zones返回结果

type DNS

type DNS interface {
	Init(dnsConf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache)
	// 添加或更新IPv4/IPv6记录
	AddUpdateDomainRecords() (domains config.Domains)
}

DNS interface

type Dnspod

type Dnspod struct {
	DNS     config.DNS
	Domains config.Domains
	TTL     string
}

https://cloud.tencent.com/document/api/302/8516 Dnspod 腾讯云dns实现

func (*Dnspod) AddUpdateDomainRecords

func (dnspod *Dnspod) AddUpdateDomainRecords() config.Domains

AddUpdateDomainRecords 添加或更新IPv4/IPv6记录

func (*Dnspod) Init

func (dnspod *Dnspod) Init(dnsConf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache)

Init 初始化

type DnspodRecord

type DnspodRecord struct {
	ID      string
	Name    string
	Type    string
	Value   string
	Enabled string
}

DnspodRecord DnspodRecord

type DnspodRecordListResp

type DnspodRecordListResp struct {
	DnspodStatus
	Records []DnspodRecord
}

DnspodRecordListResp recordListAPI结果

type DnspodStatus

type DnspodStatus struct {
	Status struct {
		Code    string
		Message string
	}
}

DnspodStatus DnspodStatus

type Dynadot added in v6.3.0

type Dynadot struct {
	DNS      config.DNS
	Domains  config.Domains
	TTL      string
	LastIpv4 string
	LastIpv6 string
}

Dynadot Dynadot

func (*Dynadot) AddUpdateDomainRecords added in v6.3.0

func (dynadot *Dynadot) AddUpdateDomainRecords() config.Domains

AddUpdateDomainRecords 添加或更新IPv4/IPv6记录

func (*Dynadot) Init added in v6.3.0

func (dynadot *Dynadot) Init(dnsConf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache)

Init 初始化

type DynadotRecord added in v6.3.0

type DynadotRecord struct {
	DomainName     string
	SubDomainNames []string
	CustomParams   url.Values
	Domains        []*config.Domain
	ContainRoot    bool
}

DynadotRecord record

type DynadotResp added in v6.3.0

type DynadotResp struct {
	Status    string   `json:"status"`
	ErrorCode int      `json:"error_code"`
	Content   []string `json:"content"`
}

DynadotResp 修改/添加返回结果

type GoDaddyDNS

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

func (*GoDaddyDNS) AddUpdateDomainRecords

func (g *GoDaddyDNS) AddUpdateDomainRecords() config.Domains

func (*GoDaddyDNS) Init

func (g *GoDaddyDNS) Init(dnsConf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache)

type GoogleDomain

type GoogleDomain struct {
	DNS     config.DNS
	Domains config.Domains
	// contains filtered or unexported fields
}

https://support.google.com/domains/answer/6147083?hl=zh-Hans#zippy=%2C使用-api-更新您的动态-dns-记录 GoogleDomain Google Domain

func (*GoogleDomain) AddUpdateDomainRecords

func (gd *GoogleDomain) AddUpdateDomainRecords() config.Domains

AddUpdateDomainRecords 添加或更新IPv4/IPv6记录

func (*GoogleDomain) Init

func (gd *GoogleDomain) Init(dnsConf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache)

Init 初始化

type GoogleDomainResp

type GoogleDomainResp struct {
	Status  string
	SetedIP string
}

GoogleDomainResp 修改域名解析结果

type Huaweicloud

type Huaweicloud struct {
	DNS     config.DNS
	Domains config.Domains
	TTL     int
}

https://support.huaweicloud.com/api-dns/dns_api_64001.html Huaweicloud Huaweicloud

func (*Huaweicloud) AddUpdateDomainRecords

func (hw *Huaweicloud) AddUpdateDomainRecords() config.Domains

AddUpdateDomainRecords 添加或更新IPv4/IPv6记录

func (*Huaweicloud) Init

func (hw *Huaweicloud) Init(dnsConf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache)

Init 初始化

type HuaweicloudRecordsResp

type HuaweicloudRecordsResp struct {
	Recordsets []HuaweicloudRecordsets
}

HuaweicloudRecordsResp 记录返回结果

type HuaweicloudRecordsets

type HuaweicloudRecordsets struct {
	ID      string
	Name    string `json:"name"`
	ZoneID  string `json:"zone_id"`
	Status  string
	Type    string   `json:"type"`
	TTL     int      `json:"ttl"`
	Records []string `json:"records"`
}

HuaweicloudRecordsets 记录

type HuaweicloudZonesResp

type HuaweicloudZonesResp struct {
	Zones []struct {
		ID         string
		Name       string
		Recordsets []HuaweicloudRecordsets
	}
}

HuaweicloudZonesResp zones response

type ListExistingRecordsResponse added in v6.3.0

type ListExistingRecordsResponse struct {
	Records []Record `json:"records"`
}

type NameCheap

type NameCheap struct {
	DNS     config.DNS
	Domains config.Domains
	// contains filtered or unexported fields
}

NameCheap Domain

func (*NameCheap) AddUpdateDomainRecords

func (nc *NameCheap) AddUpdateDomainRecords() config.Domains

AddUpdateDomainRecords 添加或更新IPv4/IPv6记录

func (*NameCheap) Init

func (nc *NameCheap) Init(dnsConf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache)

Init 初始化

type NameCheapResp

type NameCheapResp struct {
	Status string
	Errors []string
}

NameCheap 修改域名解析结果

type NameSilo

type NameSilo struct {
	DNS     config.DNS
	Domains config.Domains
	// contains filtered or unexported fields
}

NameSilo Domain

func (*NameSilo) AddUpdateDomainRecords

func (ns *NameSilo) AddUpdateDomainRecords() config.Domains

AddUpdateDomainRecords 添加或更新IPv4/IPv6记录

func (*NameSilo) Init

func (ns *NameSilo) Init(dnsConf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache)

Init 初始化

type NameSiloDNSListRecordResp

type NameSiloDNSListRecordResp struct {
	XMLName xml.Name `xml:"namesilo"`
	Request Request  `xml:"request"`
	Reply   Reply    `xml:"reply"`
}

type NameSiloResp

type NameSiloResp struct {
	XMLName xml.Name      `xml:"namesilo"`
	Request Request       `xml:"request"`
	Reply   ReplyResponse `xml:"reply"`
}

NameSiloResp 修改域名解析结果

type Porkbun

type Porkbun struct {
	DNSConfig config.DNS
	Domains   config.Domains
	TTL       string
}

func (*Porkbun) AddUpdateDomainRecords

func (pb *Porkbun) AddUpdateDomainRecords() config.Domains

AddUpdateDomainRecords 添加或更新IPv4/IPv6记录

func (*Porkbun) Init

func (pb *Porkbun) Init(conf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache)

Init 初始化

type PorkbunApiKey

type PorkbunApiKey struct {
	AccessKey string `json:"apikey"`
	SecretKey string `json:"secretapikey"`
}

type PorkbunDomainCreateOrUpdateVO

type PorkbunDomainCreateOrUpdateVO struct {
	*PorkbunApiKey
	*PorkbunDomainRecord
}

type PorkbunDomainQueryResponse

type PorkbunDomainQueryResponse struct {
	*PorkbunResponse
	Records []PorkbunDomainRecord `json:"records"`
}

type PorkbunDomainRecord

type PorkbunDomainRecord struct {
	Name    *string `json:"name"`    // subdomain
	Type    *string `json:"type"`    // record type, e.g. A AAAA CNAME
	Content *string `json:"content"` // value
	Ttl     *string `json:"ttl"`     // default 300
}

type PorkbunResponse

type PorkbunResponse struct {
	Status string `json:"status"`
}

type Record added in v6.3.0

type Record struct {
	ID        string  `json:"id"` // 记录ID
	Slug      string  `json:"slug"`
	Name      string  `json:"name"`  // 记录名称
	Type      string  `json:"type"`  // 记录类型
	Value     string  `json:"value"` // 记录值
	Creator   string  `json:"creator"`
	Created   int64   `json:"created"`
	Updated   int64   `json:"updated"`
	CreatedAt int64   `json:"createdAt"`
	UpdatedAt int64   `json:"updatedAt"`
	TTL       int64   `json:"ttl"`
	Comment   *string `json:"comment,omitempty"`
}

type Reply

type Reply struct {
	Code          int              `xml:"code"`
	Detail        string           `xml:"detail"`
	ResourceItems []ResourceRecord `xml:"resource_record"`
}

type ReplyResponse

type ReplyResponse struct {
	Code     int    `xml:"code"`
	Detail   string `xml:"detail"`
	RecordID string `xml:"record_id"`
}

type Request

type Request struct {
	Operation string `xml:"operation"`
	IP        string `xml:"ip"`
}

type ResourceRecord

type ResourceRecord struct {
	RecordID string `xml:"record_id"`
	Type     string `xml:"type"`
	Host     string `xml:"host"`
	Value    string `xml:"value"`
	TTL      int    `xml:"ttl"`
	Distance int    `xml:"distance"`
}

type TencentCloud

type TencentCloud struct {
	DNS     config.DNS
	Domains config.Domains
	TTL     int
}

TencentCloud 腾讯云 DNSPod API 3.0 实现 https://cloud.tencent.com/document/api/1427/56193

func (*TencentCloud) AddUpdateDomainRecords

func (tc *TencentCloud) AddUpdateDomainRecords() config.Domains

AddUpdateDomainRecords 添加或更新 IPv4/IPv6 记录

func (*TencentCloud) Init

func (tc *TencentCloud) Init(dnsConf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache)

type TencentCloudRecord

type TencentCloudRecord struct {
	Domain string `json:"Domain"`
	// DescribeRecordList 不需要 SubDomain
	SubDomain string `json:"SubDomain,omitempty"`
	// CreateRecord/ModifyRecord 不需要 Subdomain
	Subdomain  string `json:"Subdomain,omitempty"`
	RecordType string `json:"RecordType"`
	RecordLine string `json:"RecordLine"`
	// DescribeRecordList 不需要 Value
	Value string `json:"Value,omitempty"`
	// CreateRecord/DescribeRecordList 不需要 RecordId
	RecordId int `json:"RecordId,omitempty"`
	// DescribeRecordList 不需要 TTL
	TTL int `json:"TTL,omitempty"`
}

TencentCloudRecord 腾讯云记录

type TencentCloudRecordListsResp

type TencentCloudRecordListsResp struct {
	TencentCloudStatus
	Response struct {
		RecordCountInfo struct {
			TotalCount int `json:"TotalCount"`
		} `json:"RecordCountInfo"`

		RecordList []TencentCloudRecord `json:"RecordList"`
	}
}

TencentCloudRecordListsResp 获取域名的解析记录列表返回结果

type TencentCloudStatus

type TencentCloudStatus struct {
	Response struct {
		Error struct {
			Code    string
			Message string
		}
	}
}

TencentCloudStatus 腾讯云返回状态 https://cloud.tencent.com/document/product/1427/56192

type Vercel added in v6.3.0

type Vercel struct {
	DNS     config.DNS
	Domains config.Domains
	TTL     int
}

func (*Vercel) AddUpdateDomainRecords added in v6.3.0

func (v *Vercel) AddUpdateDomainRecords() (domains config.Domains)

func (*Vercel) Init added in v6.3.0

func (v *Vercel) Init(dnsConf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache)

Jump to

Keyboard shortcuts

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