You've already forked ddns-updater
Refactor: Moved all under internal.
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
FEAT: Directadmin provider is now working
This commit is contained in:
@@ -5,7 +5,8 @@ import (
|
||||
)
|
||||
|
||||
type DNSProvider interface {
|
||||
UpdateRecord(hostname string, ip string, old_ip string) error
|
||||
UpdateRecord(hostname string, ip string) error
|
||||
FetchRecord(hostname string) (string, error)
|
||||
}
|
||||
|
||||
type DomainParts struct {
|
||||
@@ -16,8 +17,15 @@ type DomainParts struct {
|
||||
func GetDomainParts(hostname string) *DomainParts {
|
||||
data := arrayToSlice(strings.Split(hostname, "."))
|
||||
|
||||
out := DomainParts{Name: data[0], Domain: strings.Join(data[1:], ".")}
|
||||
return &out
|
||||
if len(data) <= 2 {
|
||||
// This might be the actual root domain
|
||||
out := DomainParts{Name: strings.Join(data[0:], "."), Domain: strings.Join(data[0:], ".")}
|
||||
return &out
|
||||
} else {
|
||||
// This is a subdomain
|
||||
out := DomainParts{Name: data[0], Domain: strings.Join(data[1:], ".")}
|
||||
return &out
|
||||
}
|
||||
}
|
||||
|
||||
func arrayToSlice(array []string) []string {
|
||||
|
||||
Reference in New Issue
Block a user