Files
Charon/backend/pkg/dnsprovider/builtin/godaddy.go
GitHub Actions b86aa3921b feat(dns): add custom DNS provider plugin system
- Add plugin interface with lifecycle hooks (Init/Cleanup)
- Implement thread-safe provider registry
- Add plugin loader with SHA-256 signature verification
- Migrate 10 built-in providers to registry pattern
- Add multi-credential support to plugin interface
- Create plugin management UI with enable/disable controls
- Add dynamic credential fields based on provider metadata
- Include PowerDNS example plugin
- Add comprehensive user & developer documentation
- Fix frontend test hang (33min → 1.5min, 22x faster)

Platform: Linux/macOS only (Go plugin limitation)
Security: Signature verification, directory permission checks

Backend coverage: 85.1%
Frontend coverage: 85.31%

Closes: DNS Challenge Future Features - Phase 5
2026-01-07 02:54:01 +00:00

96 lines
2.3 KiB
Go

package builtin
import (
"fmt"
"time"
"github.com/Wikid82/charon/backend/pkg/dnsprovider"
)
// GoDaddyProvider implements the ProviderPlugin interface for GoDaddy DNS.
type GoDaddyProvider struct{}
func (p *GoDaddyProvider) Type() string {
return "godaddy"
}
func (p *GoDaddyProvider) Metadata() dnsprovider.ProviderMetadata {
return dnsprovider.ProviderMetadata{
Type: "godaddy",
Name: "GoDaddy",
Description: "GoDaddy DNS with API key and secret",
DocumentationURL: "https://developer.godaddy.com/doc",
IsBuiltIn: true,
Version: "1.0.0",
}
}
func (p *GoDaddyProvider) Init() error {
return nil
}
func (p *GoDaddyProvider) Cleanup() error {
return nil
}
func (p *GoDaddyProvider) RequiredCredentialFields() []dnsprovider.CredentialFieldSpec {
return []dnsprovider.CredentialFieldSpec{
{
Name: "api_key",
Label: "API Key",
Type: "text",
Placeholder: "Enter your GoDaddy API key",
Hint: "Production API key from GoDaddy developer portal",
},
{
Name: "api_secret",
Label: "API Secret",
Type: "password",
Placeholder: "Enter your GoDaddy API secret",
Hint: "Production API secret (stored encrypted)",
},
}
}
func (p *GoDaddyProvider) OptionalCredentialFields() []dnsprovider.CredentialFieldSpec {
return []dnsprovider.CredentialFieldSpec{}
}
func (p *GoDaddyProvider) ValidateCredentials(creds map[string]string) error {
if creds["api_key"] == "" {
return fmt.Errorf("api_key is required")
}
if creds["api_secret"] == "" {
return fmt.Errorf("api_secret is required")
}
return nil
}
func (p *GoDaddyProvider) TestCredentials(creds map[string]string) error {
return p.ValidateCredentials(creds)
}
func (p *GoDaddyProvider) SupportsMultiCredential() bool {
return false
}
func (p *GoDaddyProvider) BuildCaddyConfig(creds map[string]string) map[string]any {
return map[string]any{
"name": "godaddy",
"api_key": creds["api_key"],
"api_secret": creds["api_secret"],
}
}
func (p *GoDaddyProvider) BuildCaddyConfigForZone(baseDomain string, creds map[string]string) map[string]any {
return p.BuildCaddyConfig(creds)
}
func (p *GoDaddyProvider) PropagationTimeout() time.Duration {
return 180 * time.Second
}
func (p *GoDaddyProvider) PollingInterval() time.Duration {
return 10 * time.Second
}