You've already forked ddns-updater
FEAT: Refactor allowing multiple DNS Providers
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
25
internal/dns_providers/base_provider.go
Normal file
25
internal/dns_providers/base_provider.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package dns_providers
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type DNSProvider interface {
|
||||
UpdateRecord(hostname string, ip string, old_ip string) error
|
||||
}
|
||||
|
||||
type DomainParts struct {
|
||||
Name string
|
||||
Domain string
|
||||
}
|
||||
|
||||
func GetDomainParts(hostname string) *DomainParts {
|
||||
data := arrayToSlice(strings.Split(hostname, "."))
|
||||
|
||||
out := DomainParts{Name: data[0], Domain: strings.Join(data[1:], ".")}
|
||||
return &out
|
||||
}
|
||||
|
||||
func arrayToSlice(array []string) []string {
|
||||
return array[:]
|
||||
}
|
||||
Reference in New Issue
Block a user