mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 12:40:07 +00:00
Add DDNS support (#324)
* feat: add ddns updater framework Note: no functionality implemented yet * feat: add webhook ddns provider * feat: update dashboard template * fix: check nil and cron task string * fix: webhook string formated with unexcepted param * fix: webhook header split error * feat: cloudflare ddns provider * refract: move ddns update trigger into ReportSystemInfo * lang: update other languages text * fix: clear codes and logics * fix: move update ddns to goroutine to avoid blocking * fix: clear unused codes * fix: update timestamp to prevent cache
This commit is contained in:
@@ -112,6 +112,19 @@ type Config struct {
|
||||
IgnoredIPNotificationServerIDs map[uint64]bool // [ServerID] -> bool(值为true代表当前ServerID在特定服务器列表内)
|
||||
MaxTCPPingValue int32
|
||||
AvgPingCount int
|
||||
|
||||
// 动态域名解析更新
|
||||
DDNS struct {
|
||||
Enable bool
|
||||
Provider string
|
||||
AccessID string
|
||||
AccessSecret string
|
||||
WebhookURL string
|
||||
WebhookMethod string
|
||||
WebhookRequestBody string
|
||||
WebhookHeaders string
|
||||
MaxRetries uint32
|
||||
}
|
||||
}
|
||||
|
||||
// Read 读取配置文件并应用
|
||||
@@ -152,6 +165,15 @@ func (c *Config) Read(path string) error {
|
||||
if c.AvgPingCount == 0 {
|
||||
c.AvgPingCount = 2
|
||||
}
|
||||
if c.DDNS.Provider == "" {
|
||||
c.DDNS.Provider = "webhook"
|
||||
}
|
||||
if c.DDNS.WebhookMethod == "" {
|
||||
c.DDNS.WebhookMethod = "POST"
|
||||
}
|
||||
if c.DDNS.MaxRetries == 0 {
|
||||
c.DDNS.MaxRetries = 3
|
||||
}
|
||||
|
||||
c.updateIgnoredIPNotificationID()
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user