mirror of
https://github.com/nezhahq/nezha.git
synced 2025-02-02 09:38:13 -05:00
eb6dd2855e
* refactor ddns * update webhook
23 lines
479 B
Go
23 lines
479 B
Go
package ddns
|
|
|
|
import "golang.org/x/net/publicsuffix"
|
|
|
|
type DomainConfig struct {
|
|
EnableIPv4 bool
|
|
EnableIpv6 bool
|
|
FullDomain string
|
|
Ipv4Addr string
|
|
Ipv6Addr string
|
|
}
|
|
|
|
type Provider interface {
|
|
// UpdateDomain Return is updated
|
|
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
|
|
}
|