package updateip import ( "errors" "fmt" "net" "strings" "time" log "github.com/sirupsen/logrus" ) const DefaultTTL = 5 * time.Minute type Provider interface { UpdateIP(domain, name string, ip net.IP) error } func NewProvider(config *ProviderConfig) (Provider, error) { if config == nil { return nil, errors.New("provider: config is nil") } if config.Type == "" { config.Type = config.Name } log.WithFields(log.Fields{ "name": config.Name, "type": config.Type, }).Debug("configuring provider") switch strings.ToLower(config.Type) { case "transip": return NewTransIP(config) default: return nil, fmt.Errorf("provider %s: unsupported type %q", config.Name, config.Type) } }