2024-02-26 11:49:28 +08:00
|
|
|
package ddns
|
|
|
|
|
2024-08-24 11:11:06 +08:00
|
|
|
import "golang.org/x/net/publicsuffix"
|
|
|
|
|
2024-02-26 11:49:28 +08:00
|
|
|
type DomainConfig struct {
|
|
|
|
EnableIPv4 bool
|
|
|
|
EnableIpv6 bool
|
|
|
|
FullDomain string
|
|
|
|
Ipv4Addr string
|
|
|
|
Ipv6Addr string
|
|
|
|
}
|
|
|
|
|
|
|
|
type Provider interface {
|
|
|
|
// UpdateDomain Return is updated
|
2024-08-24 11:11:06 +08:00
|
|
|
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
|
2024-02-26 11:49:28 +08:00
|
|
|
}
|