-
Notifications
You must be signed in to change notification settings - Fork 504
NEW PROVIDER: Tencent Cloud DNS (TENCENTDNS/DNSPOD) provider and registrar #4237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b95e752
new provider: Add Tencent Cloud DNS (tencentdns/dnspod) provider and …
cylonchau 096cec6
TENCENTDNS: add metadata, TTL handling, and split cn and intl site APIs
cylonchau 5c58ba8
TENCENTDNS: clarify ALIAS handling
cylonchau 3a32648
TENCENTDNS: fix staticcheck findings
cylonchau 88253fb
Merge branch 'main' into feat/tencentdns
cylonchau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| ## Configuration | ||
|
|
||
| {% hint style="info" %} | ||
|
cafferata marked this conversation as resolved.
|
||
| This provider is developed for the **Tencent Cloud API 3.0** platform. | ||
| {% endhint %} | ||
|
|
||
| This provider is for [Tencent Cloud DNS](https://cloud.tencent.com/product/dns) (DNSPod). To use this provider, add an entry to `creds.json` with `TYPE` set to `TENCENTDNS` along with your [API secrets](https://console.intl.cloud.tencent.com/cam/capi). | ||
|
|
||
| Example: | ||
|
|
||
| {% code title="creds.json" %} | ||
| ```json | ||
| { | ||
| "tencentdns": { | ||
| "TYPE": "TENCENTDNS", | ||
| "secret_id": "YOUR_SECRET_ID", | ||
| "secret_key": "YOUR_SECRET_KEY", | ||
| "site": "cn | intl" | ||
| } | ||
| } | ||
| ``` | ||
| {% endcode %} | ||
|
|
||
| Optionally, you can specify a `region` (defaults to `"ap-guangzhou"`): | ||
|
|
||
| {% code title="creds.json" %} | ||
| ```json | ||
| { | ||
| "tencentdns": { | ||
| "TYPE": "TENCENTDNS", | ||
| "secret_id": "YOUR_SECRET_ID", | ||
| "secret_key": "YOUR_SECRET_KEY", | ||
| "region": "ap-guangzhou", | ||
| "site": "intl" | ||
| } | ||
| } | ||
| ``` | ||
| {% endcode %} | ||
|
|
||
| Optionally, you can specify a `site` (defaults to `"cn"`). Use `"intl"` for Tencent Cloud International accounts: | ||
|
|
||
| {% code title="creds.json" %} | ||
| ```json | ||
| { | ||
| "tencentdns": { | ||
| "TYPE": "TENCENTDNS", | ||
| "secret_id": "YOUR_SECRET_ID", | ||
| "secret_key": "YOUR_SECRET_KEY", | ||
| "site": "intl" | ||
| } | ||
| } | ||
| ``` | ||
| {% endcode %} | ||
|
|
||
| Valid `site` values are: | ||
|
|
||
| - `cn`: Tencent Cloud mainland China APIs. | ||
| - `intl`: Tencent Cloud International APIs. | ||
|
|
||
| The `site` setting affects both DNSPod DNS management and registrar nameserver updates. | ||
|
|
||
| ## Usage | ||
|
|
||
| An example configuration: | ||
|
|
||
| {% code title="dnsconfig.js" %} | ||
| ```javascript | ||
| var REG_TENCENT = NewRegistrar("tencentdns", "TENCENTDNS"); | ||
| var DSP_TENCENT = NewDnsProvider("tencentdns", "TENCENTDNS"); | ||
|
|
||
| D("example.com", REG_TENCENT, DnsProvider(DSP_TENCENT), | ||
| A("@", "1.2.3.4"), | ||
| CNAME("www", "example.com."), | ||
| MX("@", 10, "mail.example.com."), | ||
| TXT("test", "hello world") | ||
| ); | ||
| ``` | ||
| {% endcode %} | ||
|
|
||
| ### Why use `ALIAS` for DNSPod | ||
|
|
||
| DNSPod does not natively support the `ALIAS` record type. | ||
|
|
||
| In this provider, `ALIAS("@")` is used only as a DNSControl-side representation of CNAME flattening at the zone apex (`@`). It does not mean DNSPod has a real ALIAS record type. | ||
|
|
||
| We use `ALIAS("@")` because DNSControl treats `CNAME("@")` as invalid. In standard DNS, a CNAME record cannot be placed at the zone apex, because the apex already contains required records such as `SOA` and `NS`. | ||
|
|
||
| For DNSPod, the provider maps `ALIAS("@")` to a CNAME record on `@` under the hood. The actual CNAME flattening behavior must still be configured manually in the DNSPod dashboard. | ||
|
|
||
| #### Example: | ||
|
|
||
| **Recommended** | ||
|
|
||
| Use `ALIAS("@")` for apex CNAME flattening: | ||
|
|
||
| ```js | ||
| D("example.com", REG_NONE, DnsProvider(DNSPOD), | ||
| ALIAS("@", "target.example.net.") | ||
| ); | ||
| ``` | ||
| **Not recommended** | ||
|
|
||
| Avoid writing CNAME("@") directly: | ||
|
|
||
| ```js | ||
| D("example.com", REG_NONE, DnsProvider(DNSPOD), | ||
| CNAME("@", "target.example.net.") | ||
| ); | ||
| ``` | ||
|
|
||
| For compatibility, the DNSPod provider automatically converts apex CNAME("@") to ALIAS("@") internally. This allows DNSControl to treat it as an apex-flattening record instead of a standard apex CNAME. | ||
|
|
||
| ### Note | ||
|
|
||
| DNSPod does not natively support the ALIAS record type. In this provider, ALIAS("@") is only a DNSControl-side representation of apex CNAME flattening. | ||
|
|
||
| When pushed to DNSPod, it is stored as a CNAME record on @. | ||
|
|
||
| Reference: https://docs.dnspod.com/dns/faq-dns-resolution/?lang=en | ||
|
|
||
|
|
||
| ## Important Notes | ||
|
|
||
| ### Features | ||
|
|
||
| - **MX Records**: Priority and target are handled automatically. | ||
| - **Registrar Support**: Supports updating authoritative nameservers for domains registered with Tencent Cloud. | ||
| - **Tencent Cloud Site**: Use `site: "intl"` for Tencent Cloud International site, use `site: "cn"` for Tencent Cloud China site. | ||
| - **Line Management**: All records are created on the "默认" (Default) line. | ||
| - **New Domains**: DNSControl will automatically create non-existent domains in your account. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document how to use
ALIAS('@')in the provider docs:CNAMEat@ALIAS('@')todnsconfig.jsALIAS('@'). DNSControl requires this because it considersCNAME('@')invalid.ALIAStoCNAMEALIASat all, all CNAME flattening configurations must be done via the dashboard for now.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I updated the docs to clarify how to use ALIAS with the tencentdns provider.