ddnscore

package
v1.10.8 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UpdatedNothing 未改变
	UpdatedNothing string = "域名IP和公网IP一致"
	// UpdatedFailed 更新失败
	UpdatedFailed = "失败"
	// UpdatedSuccess 更新成功
	UpdatedSuccess = "成功"
	// UpdateStop 暂停
	UpdateStop = "停止同步"
	//UpdatePause 暂停 获取IP失败时暂停
	UpdatePause = "暂停同步"
	// UpdateWaiting
	UpdateWaiting = "等待更新"
)

Variables

This section is empty.

Functions

func DDNSTaskInfoMapDelete

func DDNSTaskInfoMapDelete(key string)

func DDNSTaskInfoMapUpdate

func DDNSTaskInfoMapUpdate(task *DDNSTaskInfo) bool

func DDNSTaskInfoMapUpdateDomainInfo

func DDNSTaskInfoMapUpdateDomainInfo(task *DDNSTaskInfo)

func DDNSTaskInfoMapUpdateIPInfo

func DDNSTaskInfoMapUpdateIPInfo(task *DDNSTaskInfo)

即时更新IP相关数据信息

func DeleteAnyListlice

func DeleteAnyListlice(a []any, deleteIndex int) []any

func EnableDDNSTaskByKey

func EnableDDNSTaskByKey(key string, enable bool) error

func FLushWebLastAccessDDNSTaskListLastTime

func FLushWebLastAccessDDNSTaskListLastTime()

记录最后的前端请求DDNS任务列表时间

func UpdateDomainsStateByTaskKey

func UpdateDomainsStateByTaskKey(key, status, message string)

func WebhookTest

func WebhookTest(d *DDNSTaskInfo, url, method, WebhookRequestBody, proxy, addr, user, passwd string, headerList, successContentListraw []string) (string, error)

Types

type DDNSTaskInfo

type DDNSTaskInfo struct {
	ddnsconf.DDNSTask
	TaskState DDNSTaskState `json:"TaskState"`
}

func GetDDNSTaskInfoByKey

func GetDDNSTaskInfoByKey(key string) *DDNSTaskInfo

func GetDDNSTaskInfoList

func GetDDNSTaskInfoList() []*DDNSTaskInfo

func GetDDNSTaskState

func GetDDNSTaskState(task *ddnsconf.DDNSTask) *DDNSTaskInfo

func (*DDNSTaskInfo) CheckIPChange

func (d *DDNSTaskInfo) CheckIPChange() (ipAddr string, change bool)

CheckIPChange 检测公网IP是否改变

func (*DDNSTaskInfo) ExecWebhook

func (d *DDNSTaskInfo) ExecWebhook(state *DDNSTaskState)

ExecWebhook 添加或更新IPv4/IPv6记录

func (*DDNSTaskInfo) SyncDomains

func (d *DDNSTaskInfo) SyncDomains()

type DDNSTaskState

type DDNSTaskState struct {
	IpAddr  string
	Domains []Domain

	WebhookCallTime     string    `json:"WebhookCallTime"`     //最后触发时间
	WebhookCallResult   bool      `json:"WebhookCallResult"`   //触发结果
	WebhookCallErrorMsg string    `json:"WebhookCallErrorMsg"` //触发错误信息
	LastSyncTime        time.Time `json:"-"`                   //记录最新一次同步操作时间
	LastWorkTime        time.Time `json:"-"`

	IPAddrHistory      []any `json:"IPAddrHistory"`
	WebhookCallHistroy []any `json:"WebhookCallHistroy"`
	ModifyTime         int64
	// contains filtered or unexported fields
}

Domains Ipv4/Ipv6 DDNSTaskState

func (*DDNSTaskState) IPChanged

func (d *DDNSTaskState) IPChanged(newAddr string) bool

Check 检测IP是否有改变

func (*DDNSTaskState) Init

func (d *DDNSTaskState) Init(domains []string, mt int64)

func (*DDNSTaskState) SetDomainUpdateStatus

func (d *DDNSTaskState) SetDomainUpdateStatus(status string, message string)

func (*DDNSTaskState) SetIPAddr

func (d *DDNSTaskState) SetIPAddr(ipaddr string)

func (*DDNSTaskState) SetWebhookResult

func (d *DDNSTaskState) SetWebhookResult(result bool, errMsg string)

type Domain

type Domain struct {
	RawStr       string
	DomainName   string
	SubDomain    string
	CustomParams string

	UpdateStatus         string // 更新状态
	LastUpdateStatusTime string //最后更新状态的时间
	Message              string
	UpdateHistroy        []any
}

Domain 域名实体

func (*Domain) GetCustomParams

func (d *Domain) GetCustomParams() url.Values

GetCustomParams not be nil

func (*Domain) GetFullDomain

func (d *Domain) GetFullDomain() string

GetFullDomain 返回完整子域名

func (*Domain) GetSubDomain

func (d *Domain) GetSubDomain() string

GetSubDomain 获得子域名,为空返回@ 阿里云,dnspod需要

func (*Domain) SetDomainUpdateStatus

func (d *Domain) SetDomainUpdateStatus(status string, message string)

func (*Domain) String

func (d *Domain) String() string

type IPAddrHistoryItem

type IPAddrHistoryItem struct {
	IPaddr     string
	RecordTime string
}

type UpdateHistroyItem

type UpdateHistroyItem struct {
	UpdateStatus string
	UpdateTime   string
}

type WebhookCallHistroyItem

type WebhookCallHistroyItem struct {
	CallTime   string
	CallResult string
}

Jump to

Keyboard shortcuts

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