Skip to content

Commit 67230e2

Browse files
authored
cloudxns: provider deprecation (#2324)
1 parent af7e2ed commit 67230e2

File tree

9 files changed

+19
-787
lines changed

9 files changed

+19
-787
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Detailed documentation is available [here](https://go-acme.github.io/lego/dns).
7777
<td><a href="https://go-acme.github.io/lego/dns/cloudflare/">Cloudflare</a></td>
7878
<td><a href="https://go-acme.github.io/lego/dns/cloudns/">ClouDNS</a></td>
7979
</tr><tr>
80-
<td><a href="https://go-acme.github.io/lego/dns/cloudxns/">CloudXNS</a></td>
80+
<td><a href="https://go-acme.github.io/lego/dns/cloudxns/">CloudXNS (Deprecated)</a></td>
8181
<td><a href="https://go-acme.github.io/lego/dns/conoha/">ConoHa</a></td>
8282
<td><a href="https://go-acme.github.io/lego/dns/constellix/">Constellix</a></td>
8383
<td><a href="https://go-acme.github.io/lego/dns/corenetworks/">Core-Networks</a></td>

cmd/zz_gen_cmd_dnshelp.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/content/dns/zz_gen_cloudxns.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
---
2-
title: "CloudXNS"
2+
title: "CloudXNS (Deprecated)"
33
date: 2019-03-03T16:39:46+01:00
44
draft: false
55
slug: cloudxns
66
dnsprovider:
77
since: "v0.5.0"
88
code: "cloudxns"
9-
url: "https://www.cloudxns.net/"
9+
url: "https://github.com/go-acme/lego/issues/2323"
1010
---
1111

1212
<!-- THIS DOCUMENTATION IS AUTO-GENERATED. PLEASE DO NOT EDIT. -->
1313
<!-- providers/dns/cloudxns/cloudxns.toml -->
1414
<!-- THIS DOCUMENTATION IS AUTO-GENERATED. PLEASE DO NOT EDIT. -->
1515

16+
The CloudXNS DNS provider has shut down.
1617

17-
Configuration for [CloudXNS](https://www.cloudxns.net/).
1818

1919

2020
<!--more-->
@@ -23,7 +23,7 @@ Configuration for [CloudXNS](https://www.cloudxns.net/).
2323
- Since: v0.5.0
2424

2525

26-
Here is an example bash command using the CloudXNS provider:
26+
Here is an example bash command using the CloudXNS (Deprecated) provider:
2727

2828
```bash
2929
CLOUDXNS_API_KEY=xxxx \
@@ -60,9 +60,6 @@ More information [here]({{% ref "dns#configuration-and-credentials" %}}).
6060

6161

6262

63-
## More information
64-
65-
- [API documentation](https://www.cloudxns.net/Public/Doc/CloudXNS_api2.0_doc_zh-cn.zip)
6663

6764
<!-- THIS DOCUMENTATION IS AUTO-GENERATED. PLEASE DO NOT EDIT. -->
6865
<!-- providers/dns/cloudxns/cloudxns.toml -->

providers/dns/cloudxns/cloudxns.go

Lines changed: 8 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@
22
package cloudxns
33

44
import (
5-
"context"
65
"errors"
7-
"fmt"
86
"net/http"
97
"time"
108

119
"github.com/go-acme/lego/v4/challenge/dns01"
12-
"github.com/go-acme/lego/v4/platform/config/env"
13-
"github.com/go-acme/lego/v4/providers/dns/cloudxns/internal"
1410
)
1511

1612
// Environment variables names.
@@ -38,101 +34,34 @@ type Config struct {
3834

3935
// NewDefaultConfig returns a default configuration for the DNSProvider.
4036
func NewDefaultConfig() *Config {
41-
return &Config{
42-
PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, dns01.DefaultPropagationTimeout),
43-
PollingInterval: env.GetOrDefaultSecond(EnvPollingInterval, dns01.DefaultPollingInterval),
44-
TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL),
45-
HTTPClient: &http.Client{
46-
Timeout: env.GetOrDefaultSecond(EnvHTTPTimeout, 30*time.Second),
47-
},
48-
}
37+
return &Config{}
4938
}
5039

5140
// DNSProvider implements the challenge.Provider interface.
52-
type DNSProvider struct {
53-
config *Config
54-
client *internal.Client
55-
}
41+
type DNSProvider struct{}
5642

5743
// NewDNSProvider returns a DNSProvider instance configured for CloudXNS.
58-
// Credentials must be passed in the environment variables:
59-
// CLOUDXNS_API_KEY and CLOUDXNS_SECRET_KEY.
6044
func NewDNSProvider() (*DNSProvider, error) {
61-
values, err := env.Get(EnvAPIKey, EnvSecretKey)
62-
if err != nil {
63-
return nil, fmt.Errorf("cloudxns: %w", err)
64-
}
65-
66-
config := NewDefaultConfig()
67-
config.APIKey = values[EnvAPIKey]
68-
config.SecretKey = values[EnvSecretKey]
69-
70-
return NewDNSProviderConfig(config)
45+
return NewDNSProviderConfig(&Config{})
7146
}
7247

7348
// NewDNSProviderConfig return a DNSProvider instance configured for CloudXNS.
74-
func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
75-
if config == nil {
76-
return nil, errors.New("cloudxns: the configuration of the DNS provider is nil")
77-
}
78-
79-
client, err := internal.NewClient(config.APIKey, config.SecretKey)
80-
if err != nil {
81-
return nil, fmt.Errorf("cloudxns: %w", err)
82-
}
83-
84-
if config.HTTPClient != nil {
85-
client.HTTPClient = config.HTTPClient
86-
}
87-
88-
return &DNSProvider{client: client, config: config}, nil
49+
func NewDNSProviderConfig(_ *Config) (*DNSProvider, error) {
50+
return nil, errors.New("cloudxns: provider has shut down")
8951
}
9052

9153
// Present creates a TXT record to fulfill the dns-01 challenge.
92-
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
93-
challengeInfo := dns01.GetChallengeInfo(domain, keyAuth)
94-
95-
ctx := context.Background()
96-
97-
info, err := d.client.GetDomainInformation(ctx, challengeInfo.EffectiveFQDN)
98-
if err != nil {
99-
return fmt.Errorf("cloudxns: %w", err)
100-
}
101-
102-
err = d.client.AddTxtRecord(ctx, info, challengeInfo.EffectiveFQDN, challengeInfo.Value, d.config.TTL)
103-
if err != nil {
104-
return fmt.Errorf("cloudxns: %w", err)
105-
}
106-
54+
func (d *DNSProvider) Present(_, _, _ string) error {
10755
return nil
10856
}
10957

11058
// CleanUp removes the TXT record matching the specified parameters.
111-
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
112-
challengeInfo := dns01.GetChallengeInfo(domain, keyAuth)
113-
114-
ctx := context.Background()
115-
116-
info, err := d.client.GetDomainInformation(ctx, challengeInfo.EffectiveFQDN)
117-
if err != nil {
118-
return fmt.Errorf("cloudxns: %w", err)
119-
}
120-
121-
record, err := d.client.FindTxtRecord(ctx, info.ID, challengeInfo.EffectiveFQDN)
122-
if err != nil {
123-
return fmt.Errorf("cloudxns: %w", err)
124-
}
125-
126-
err = d.client.RemoveTxtRecord(ctx, record.RecordID, info.ID)
127-
if err != nil {
128-
return fmt.Errorf("cloudxns: %w", err)
129-
}
130-
59+
func (d *DNSProvider) CleanUp(_, _, _ string) error {
13160
return nil
13261
}
13362

13463
// Timeout returns the timeout and interval to use when checking for DNS propagation.
13564
// Adjusting here to cope with spikes in propagation times.
13665
func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
137-
return d.config.PropagationTimeout, d.config.PollingInterval
66+
return dns01.DefaultPropagationTimeout, dns01.DefaultPollingInterval
13867
}

providers/dns/cloudxns/cloudxns.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
Name = "CloudXNS"
2-
Description = """"""
3-
URL = "https://www.cloudxns.net/"
1+
Name = "CloudXNS (Deprecated)"
2+
Description = '''
3+
The CloudXNS DNS provider has shut down.
4+
'''
5+
URL = "https://github.com/go-acme/lego/issues/2323"
46
Code = "cloudxns"
57
Since = "v0.5.0"
68

@@ -19,6 +21,3 @@ lego --email [email protected] --dns cloudxns --domains my.example.org run
1921
CLOUDXNS_PROPAGATION_TIMEOUT = "Maximum waiting time for DNS propagation"
2022
CLOUDXNS_TTL = "The TTL of the TXT record used for the DNS challenge"
2123
CLOUDXNS_HTTP_TIMEOUT = "API request timeout"
22-
23-
[Links]
24-
API = "https://www.cloudxns.net/Public/Doc/CloudXNS_api2.0_doc_zh-cn.zip"

providers/dns/cloudxns/cloudxns_test.go

Lines changed: 0 additions & 152 deletions
This file was deleted.

0 commit comments

Comments
 (0)