refactor: ddns (#414)

* refactor ddns

* update webhook
This commit is contained in:
UUBulb
2024-08-24 11:11:06 +08:00
committed by GitHub
parent 64da3c7438
commit eb6dd2855e
17 changed files with 523 additions and 352 deletions

View File

@@ -1,5 +1,7 @@
package ddns
import "golang.org/x/net/publicsuffix"
type DomainConfig struct {
EnableIPv4 bool
EnableIpv6 bool
@@ -10,5 +12,11 @@ type DomainConfig struct {
type Provider interface {
// UpdateDomain Return is updated
UpdateDomain(domainConfig *DomainConfig) bool
UpdateDomain(*DomainConfig) error
}
func splitDomain(domain string) (prefix string, realDomain string) {
realDomain, _ = publicsuffix.EffectiveTLDPlusOne(domain)
prefix = domain[:len(domain)-len(realDomain)-1]
return prefix, realDomain
}