diff --git a/documentation/provider/index.md b/documentation/provider/index.md index aa2b45901..168423dbc 100644 --- a/documentation/provider/index.md +++ b/documentation/provider/index.md @@ -91,7 +91,7 @@ Jump to a table: | ------------- | -------------------------------------------------------------------- | ---------------------------------------------- | -------------- | --------- | | [`ADGUARDHOME`](adguardhome.md) | ❔ | ❔ | ❌ | ❌ | | [`AKAMAIEDGEDNS`](akamaiedgedns.md) | ❔ | ✅ | ✅ | ✅ | -| [`ALIDNS`](alidns.md) | ❌ | ❌ | ❌ | ❔ | +| [`ALIDNS`](alidns.md) | ✅ | ❌ | ❌ | ❔ | | [`AUTODNS`](autodns.md) | ✅ | ❌ | ❌ | ✅ | | [`AXFRDDNS`](axfrddns.md) | ✅ | ❌ | ❌ | ❌ | | [`AZURE_DNS`](azure_dns.md) | ✅ | ✅ | ✅ | ✅ | diff --git a/providers/alidns/aliDnsProvider.go b/providers/alidns/aliDnsProvider.go index 884fa6dc3..076829dc6 100644 --- a/providers/alidns/aliDnsProvider.go +++ b/providers/alidns/aliDnsProvider.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "strings" + "sync" "github.com/StackExchange/dnscontrol/v4/models" "github.com/StackExchange/dnscontrol/v4/pkg/diff2" @@ -21,7 +22,7 @@ var features = providers.DocumentationNotes{ providers.CanUseSSHFP: providers.Cannot(), providers.CanUseTLSA: providers.Cannot(), providers.CanAutoDNSSEC: providers.Cannot(), - providers.CanConcur: providers.Cannot(), + providers.CanConcur: providers.Can(), providers.DocOfficiallySupported: providers.Cannot(), providers.DocDualHost: providers.Cannot(), providers.DocCreateDomains: providers.Cannot(), @@ -50,6 +51,7 @@ func init() { type aliDnsDsp struct { client *alidns.Client domainVersionCache map[string]*domainVersionInfo + cacheMu sync.Mutex } type domainVersionInfo struct { diff --git a/providers/alidns/api.go b/providers/alidns/api.go index 64905649a..538414a03 100644 --- a/providers/alidns/api.go +++ b/providers/alidns/api.go @@ -10,7 +10,10 @@ import ( func (a *aliDnsDsp) getDomainVersionInfo(domain string) (*domainVersionInfo, error) { // Check cache first - if info, ok := a.domainVersionCache[domain]; ok { + a.cacheMu.Lock() + info, ok := a.domainVersionCache[domain] + a.cacheMu.Unlock() + if ok { return info, nil } @@ -38,12 +41,14 @@ func (a *aliDnsDsp) getDomainVersionInfo(domain string) (*domainVersionInfo, err } } - info := &domainVersionInfo{ + info = &domainVersionInfo{ versionCode: resp.VersionCode, minTTL: minTTL, maxTTL: 86400, } + a.cacheMu.Lock() a.domainVersionCache[domain] = info + a.cacheMu.Unlock() return info, nil }