mirror of
https://github.com/go-acme/lego
synced 2026-03-14 14:35:48 +01:00
Add DNS provider for EuroDNS (#2898)
This commit is contained in:
parent
847c763504
commit
a56697ed1c
18 changed files with 1553 additions and 34 deletions
66
README.md
66
README.md
|
|
@ -138,168 +138,168 @@ If your DNS provider is not supported, please open an [issue](https://github.com
|
|||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/efficientip/">Efficient IP</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/epik/">Epik</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/eurodns/">EuroDNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/exoscale/">Exoscale</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/exec/">External program</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/exec/">External program</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/f5xc/">F5 XC</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/freemyip/">freemyip.com</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/namesurfer/">FusionLayer NameSurfer</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/gcore/">G-Core</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/gcore/">G-Core</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/gandi/">Gandi</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/gandiv5/">Gandi Live DNS (v5)</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/gigahostno/">Gigahost.no</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/glesys/">Glesys</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/glesys/">Glesys</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/godaddy/">Go Daddy</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/gcloud/">Google Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/googledomains/">Google Domains</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/gravity/">Gravity</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/gravity/">Gravity</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/hetzner/">Hetzner</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/hostingde/">Hosting.de</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/hostingnl/">Hosting.nl</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/hostinger/">Hostinger</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/hostinger/">Hostinger</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/hosttech/">Hosttech</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/httpreq/">HTTP request</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/httpnet/">http.net</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/huaweicloud/">Huawei Cloud</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/huaweicloud/">Huawei Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/hurricane/">Hurricane Electric DNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/hyperone/">HyperOne</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ibmcloud/">IBM Cloud (SoftLayer)</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/iijdpf/">IIJ DNS Platform Service</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/iijdpf/">IIJ DNS Platform Service</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/infoblox/">Infoblox</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/infomaniak/">Infomaniak</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/iij/">Internet Initiative Japan</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/internetbs/">Internet.bs</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/internetbs/">Internet.bs</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/inwx/">INWX</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ionos/">Ionos</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ionoscloud/">Ionos Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ipv64/">IPv64</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ipv64/">IPv64</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ispconfig/">ISPConfig 3</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ispconfigddns/">ISPConfig 3 - Dynamic DNS (DDNS) Module</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/iwantmyname/">iwantmyname (Deprecated)</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/jdcloud/">JD Cloud</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/jdcloud/">JD Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/joker/">Joker</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/acme-dns/">Joohoi's ACME-DNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/keyhelp/">KeyHelp</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/leaseweb/">Leaseweb</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/leaseweb/">Leaseweb</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/liara/">Liara</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/limacity/">Lima-City</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/linode/">Linode (v4)</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/liquidweb/">Liquid Web</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/liquidweb/">Liquid Web</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/loopia/">Loopia</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/luadns/">LuaDNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/mailinabox/">Mail-in-a-Box</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/manageengine/">ManageEngine CloudDNS</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/manageengine/">ManageEngine CloudDNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/manual/">Manual</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/metaname/">Metaname</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/metaregistrar/">Metaregistrar</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/mijnhost/">mijn.host</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/mijnhost/">mijn.host</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/mittwald/">Mittwald</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/myaddr/">myaddr.{tools,dev,io}</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/mydnsjp/">MyDNS.jp</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/mythicbeasts/">MythicBeasts</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/mythicbeasts/">MythicBeasts</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/namedotcom/">Name.com</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/namecheap/">Namecheap</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/namesilo/">Namesilo</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/nearlyfreespeech/">NearlyFreeSpeech.NET</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/nearlyfreespeech/">NearlyFreeSpeech.NET</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/neodigit/">Neodigit</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/netcup/">Netcup</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/netlify/">Netlify</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/nicmanager/">Nicmanager</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/nicmanager/">Nicmanager</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/nifcloud/">NIFCloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/njalla/">Njalla</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/nodion/">Nodion</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ns1/">NS1</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ns1/">NS1</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/octenium/">Octenium</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/otc/">Open Telekom Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/oraclecloud/">Oracle Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ovh/">OVH</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ovh/">OVH</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/plesk/">plesk.com</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/porkbun/">Porkbun</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/pdns/">PowerDNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/rackspace/">Rackspace</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/rackspace/">Rackspace</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/rainyun/">Rain Yun/雨云</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/rcodezero/">RcodeZero</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/regru/">reg.ru</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/regfish/">Regfish</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/regfish/">Regfish</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/rfc2136/">RFC2136</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/rimuhosting/">RimuHosting</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/nicru/">RU CENTER</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/sakuracloud/">Sakura Cloud</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/sakuracloud/">Sakura Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/scaleway/">Scaleway</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/selectel/">Selectel</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/selectelv2/">Selectel v2</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/selfhostde/">SelfHost.(de|eu)</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/selfhostde/">SelfHost.(de|eu)</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/servercow/">Servercow</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/shellrent/">Shellrent</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/simply/">Simply.com</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/sonic/">Sonic</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/sonic/">Sonic</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/spaceship/">Spaceship</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/stackpath/">Stackpath</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/syse/">Syse</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/technitium/">Technitium</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/technitium/">Technitium</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/tencentcloud/">Tencent Cloud DNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/edgeone/">Tencent EdgeOne</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/timewebcloud/">Timeweb Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/todaynic/">TodayNIC/时代互联</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/todaynic/">TodayNIC/时代互联</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/transip/">TransIP</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/safedns/">UKFast SafeDNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ultradns/">Ultradns</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/uniteddomains/">United-Domains</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/uniteddomains/">United-Domains</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/variomedia/">Variomedia</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/vegadns/">VegaDNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/vercel/">Vercel</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/versio/">Versio.[nl|eu|uk]</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/versio/">Versio.[nl|eu|uk]</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/vinyldns/">VinylDNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/virtualname/">Virtualname</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/vkcloud/">VK Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/volcengine/">Volcano Engine/火山引擎</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/volcengine/">Volcano Engine/火山引擎</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/vscale/">Vscale</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/vultr/">Vultr</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/webnamesca/">webnames.ca</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/webnames/">webnames.ru</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/webnames/">webnames.ru</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/websupport/">Websupport</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/wedos/">WEDOS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/westcn/">West.cn/西部数码</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/yandex360/">Yandex 360</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/yandex360/">Yandex 360</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/yandexcloud/">Yandex Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/yandex/">Yandex PDD</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/zoneee/">Zone.ee</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/zoneedit/">ZoneEdit</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/zoneedit/">ZoneEdit</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/zonomi/">Zonomi</a></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr></table>
|
||||
|
||||
<!-- END DNS PROVIDERS LIST -->
|
||||
|
|
|
|||
22
cmd/zz_gen_cmd_dnshelp.go
generated
22
cmd/zz_gen_cmd_dnshelp.go
generated
|
|
@ -74,6 +74,7 @@ func allDNSCodes() string {
|
|||
"edgeone",
|
||||
"efficientip",
|
||||
"epik",
|
||||
"eurodns",
|
||||
"exec",
|
||||
"exoscale",
|
||||
"f5xc",
|
||||
|
|
@ -1562,6 +1563,27 @@ func displayDNSHelp(w io.Writer, name string) error {
|
|||
ew.writeln()
|
||||
ew.writeln(`More information: https://go-acme.github.io/lego/dns/epik`)
|
||||
|
||||
case "eurodns":
|
||||
// generated from: providers/dns/eurodns/eurodns.toml
|
||||
ew.writeln(`Configuration for EuroDNS.`)
|
||||
ew.writeln(`Code: 'eurodns'`)
|
||||
ew.writeln(`Since: 'v4.33.0'`)
|
||||
ew.writeln()
|
||||
|
||||
ew.writeln(`Credentials:`)
|
||||
ew.writeln(` - "EURODNS_API_KEY": API key`)
|
||||
ew.writeln(` - "EURODNS_APP_ID": Application ID`)
|
||||
ew.writeln()
|
||||
|
||||
ew.writeln(`Additional Configuration:`)
|
||||
ew.writeln(` - "EURODNS_HTTP_TIMEOUT": API request timeout in seconds (Default: 30)`)
|
||||
ew.writeln(` - "EURODNS_POLLING_INTERVAL": Time between DNS propagation check in seconds (Default: 2)`)
|
||||
ew.writeln(` - "EURODNS_PROPAGATION_TIMEOUT": Maximum waiting time for DNS propagation in seconds (Default: 60)`)
|
||||
ew.writeln(` - "EURODNS_TTL": The TTL of the TXT record used for the DNS challenge in seconds (Default: 600)`)
|
||||
|
||||
ew.writeln()
|
||||
ew.writeln(`More information: https://go-acme.github.io/lego/dns/eurodns`)
|
||||
|
||||
case "exec":
|
||||
// generated from: providers/dns/exec/exec.toml
|
||||
ew.writeln(`Configuration for External program.`)
|
||||
|
|
|
|||
69
docs/content/dns/zz_gen_eurodns.md
generated
Normal file
69
docs/content/dns/zz_gen_eurodns.md
generated
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
---
|
||||
title: "EuroDNS"
|
||||
date: 2019-03-03T16:39:46+01:00
|
||||
draft: false
|
||||
slug: eurodns
|
||||
dnsprovider:
|
||||
since: "v4.33.0"
|
||||
code: "eurodns"
|
||||
url: "https://www.eurodns.com/"
|
||||
---
|
||||
|
||||
<!-- THIS DOCUMENTATION IS AUTO-GENERATED. PLEASE DO NOT EDIT. -->
|
||||
<!-- providers/dns/eurodns/eurodns.toml -->
|
||||
<!-- THIS DOCUMENTATION IS AUTO-GENERATED. PLEASE DO NOT EDIT. -->
|
||||
|
||||
|
||||
Configuration for [EuroDNS](https://www.eurodns.com/).
|
||||
|
||||
|
||||
<!--more-->
|
||||
|
||||
- Code: `eurodns`
|
||||
- Since: v4.33.0
|
||||
|
||||
|
||||
Here is an example bash command using the EuroDNS provider:
|
||||
|
||||
```bash
|
||||
EURODNS_APP_ID="xxx" \
|
||||
EURODNS_API_KEY="yyy" \
|
||||
lego --dns eurodns -d '*.example.com' -d example.com run
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
## Credentials
|
||||
|
||||
| Environment Variable Name | Description |
|
||||
|-----------------------|-------------|
|
||||
| `EURODNS_API_KEY` | API key |
|
||||
| `EURODNS_APP_ID` | Application ID |
|
||||
|
||||
The environment variable names can be suffixed by `_FILE` to reference a file instead of a value.
|
||||
More information [here]({{% ref "dns#configuration-and-credentials" %}}).
|
||||
|
||||
|
||||
## Additional Configuration
|
||||
|
||||
| Environment Variable Name | Description |
|
||||
|--------------------------------|-------------|
|
||||
| `EURODNS_HTTP_TIMEOUT` | API request timeout in seconds (Default: 30) |
|
||||
| `EURODNS_POLLING_INTERVAL` | Time between DNS propagation check in seconds (Default: 2) |
|
||||
| `EURODNS_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation in seconds (Default: 60) |
|
||||
| `EURODNS_TTL` | The TTL of the TXT record used for the DNS challenge in seconds (Default: 600) |
|
||||
|
||||
The environment variable names can be suffixed by `_FILE` to reference a file instead of a value.
|
||||
More information [here]({{% ref "dns#configuration-and-credentials" %}}).
|
||||
|
||||
|
||||
|
||||
|
||||
## More information
|
||||
|
||||
- [API documentation](https://docapi.eurodns.com/)
|
||||
|
||||
<!-- THIS DOCUMENTATION IS AUTO-GENERATED. PLEASE DO NOT EDIT. -->
|
||||
<!-- providers/dns/eurodns/eurodns.toml -->
|
||||
<!-- THIS DOCUMENTATION IS AUTO-GENERATED. PLEASE DO NOT EDIT. -->
|
||||
2
docs/data/zz_cli_help.toml
generated
2
docs/data/zz_cli_help.toml
generated
|
|
@ -152,7 +152,7 @@ To display the documentation for a specific DNS provider, run:
|
|||
$ lego dnshelp -c code
|
||||
|
||||
Supported DNS providers:
|
||||
acme-dns, active24, alidns, aliesa, allinkl, alwaysdata, anexia, artfiles, arvancloud, auroradns, autodns, axelname, azion, azure, azuredns, baiducloud, beget, binarylane, bindman, bluecat, bluecatv2, bookmyname, brandit, bunny, checkdomain, civo, clouddns, cloudflare, cloudns, cloudru, cloudxns, com35, conoha, conohav3, constellix, corenetworks, cpanel, czechia, ddnss, derak, desec, designate, digitalocean, directadmin, dnsexit, dnshomede, dnsimple, dnsmadeeasy, dnspod, dode, domeneshop, dreamhost, duckdns, dyn, dyndnsfree, dynu, easydns, edgecenter, edgedns, edgeone, efficientip, epik, exec, exoscale, f5xc, freemyip, gandi, gandiv5, gcloud, gcore, gigahostno, glesys, godaddy, googledomains, gravity, hetzner, hostingde, hostinger, hostingnl, hosttech, httpnet, httpreq, huaweicloud, hurricane, hyperone, ibmcloud, iij, iijdpf, infoblox, infomaniak, internetbs, inwx, ionos, ionoscloud, ipv64, ispconfig, ispconfigddns, iwantmyname, jdcloud, joker, keyhelp, leaseweb, liara, lightsail, limacity, linode, liquidweb, loopia, luadns, mailinabox, manageengine, manual, metaname, metaregistrar, mijnhost, mittwald, myaddr, mydnsjp, mythicbeasts, namecheap, namedotcom, namesilo, namesurfer, nearlyfreespeech, neodigit, netcup, netlify, nicmanager, nicru, nifcloud, njalla, nodion, ns1, octenium, oraclecloud, otc, ovh, pdns, plesk, porkbun, rackspace, rainyun, rcodezero, regfish, regru, rfc2136, rimuhosting, route53, safedns, sakuracloud, scaleway, selectel, selectelv2, selfhostde, servercow, shellrent, simply, sonic, spaceship, stackpath, syse, technitium, tencentcloud, timewebcloud, todaynic, transip, ultradns, uniteddomains, variomedia, vegadns, vercel, versio, vinyldns, virtualname, vkcloud, volcengine, vscale, vultr, webnames, webnamesca, websupport, wedos, westcn, yandex, yandex360, yandexcloud, zoneedit, zoneee, zonomi
|
||||
acme-dns, active24, alidns, aliesa, allinkl, alwaysdata, anexia, artfiles, arvancloud, auroradns, autodns, axelname, azion, azure, azuredns, baiducloud, beget, binarylane, bindman, bluecat, bluecatv2, bookmyname, brandit, bunny, checkdomain, civo, clouddns, cloudflare, cloudns, cloudru, cloudxns, com35, conoha, conohav3, constellix, corenetworks, cpanel, czechia, ddnss, derak, desec, designate, digitalocean, directadmin, dnsexit, dnshomede, dnsimple, dnsmadeeasy, dnspod, dode, domeneshop, dreamhost, duckdns, dyn, dyndnsfree, dynu, easydns, edgecenter, edgedns, edgeone, efficientip, epik, eurodns, exec, exoscale, f5xc, freemyip, gandi, gandiv5, gcloud, gcore, gigahostno, glesys, godaddy, googledomains, gravity, hetzner, hostingde, hostinger, hostingnl, hosttech, httpnet, httpreq, huaweicloud, hurricane, hyperone, ibmcloud, iij, iijdpf, infoblox, infomaniak, internetbs, inwx, ionos, ionoscloud, ipv64, ispconfig, ispconfigddns, iwantmyname, jdcloud, joker, keyhelp, leaseweb, liara, lightsail, limacity, linode, liquidweb, loopia, luadns, mailinabox, manageengine, manual, metaname, metaregistrar, mijnhost, mittwald, myaddr, mydnsjp, mythicbeasts, namecheap, namedotcom, namesilo, namesurfer, nearlyfreespeech, neodigit, netcup, netlify, nicmanager, nicru, nifcloud, njalla, nodion, ns1, octenium, oraclecloud, otc, ovh, pdns, plesk, porkbun, rackspace, rainyun, rcodezero, regfish, regru, rfc2136, rimuhosting, route53, safedns, sakuracloud, scaleway, selectel, selectelv2, selfhostde, servercow, shellrent, simply, sonic, spaceship, stackpath, syse, technitium, tencentcloud, timewebcloud, todaynic, transip, ultradns, uniteddomains, variomedia, vegadns, vercel, versio, vinyldns, virtualname, vkcloud, volcengine, vscale, vultr, webnames, webnamesca, websupport, wedos, westcn, yandex, yandex360, yandexcloud, zoneedit, zoneee, zonomi
|
||||
|
||||
More information: https://go-acme.github.io/lego/dns
|
||||
"""
|
||||
|
|
|
|||
197
providers/dns/eurodns/eurodns.go
Normal file
197
providers/dns/eurodns/eurodns.go
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
// Package eurodns implements a DNS provider for solving the DNS-01 challenge using EuroDNS.
|
||||
package eurodns
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-acme/lego/v4/challenge/dns01"
|
||||
"github.com/go-acme/lego/v4/platform/config/env"
|
||||
"github.com/go-acme/lego/v4/providers/dns/eurodns/internal"
|
||||
"github.com/go-acme/lego/v4/providers/dns/internal/clientdebug"
|
||||
)
|
||||
|
||||
// Environment variables names.
|
||||
const (
|
||||
envNamespace = "EURODNS_"
|
||||
|
||||
EnvApplicationID = envNamespace + "APP_ID"
|
||||
EnvAPIKey = envNamespace + "API_KEY"
|
||||
|
||||
EnvTTL = envNamespace + "TTL"
|
||||
EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
|
||||
EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
|
||||
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
|
||||
)
|
||||
|
||||
// Config is used to configure the creation of the DNSProvider.
|
||||
type Config struct {
|
||||
ApplicationID string
|
||||
APIKey string
|
||||
|
||||
PropagationTimeout time.Duration
|
||||
PollingInterval time.Duration
|
||||
TTL int
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// NewDefaultConfig returns a default configuration for the DNSProvider.
|
||||
func NewDefaultConfig() *Config {
|
||||
return &Config{
|
||||
TTL: env.GetOrDefaultInt(EnvTTL, internal.DefaultTTL),
|
||||
PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, dns01.DefaultPropagationTimeout),
|
||||
PollingInterval: env.GetOrDefaultSecond(EnvPollingInterval, dns01.DefaultPollingInterval),
|
||||
HTTPClient: &http.Client{
|
||||
Timeout: env.GetOrDefaultSecond(EnvHTTPTimeout, 30*time.Second),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// DNSProvider implements the challenge.Provider interface.
|
||||
type DNSProvider struct {
|
||||
config *Config
|
||||
client *internal.Client
|
||||
}
|
||||
|
||||
// NewDNSProvider returns a DNSProvider instance configured for EuroDNS.
|
||||
func NewDNSProvider() (*DNSProvider, error) {
|
||||
values, err := env.Get(EnvApplicationID, EnvAPIKey)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("eurodns: %w", err)
|
||||
}
|
||||
|
||||
config := NewDefaultConfig()
|
||||
config.ApplicationID = values[EnvApplicationID]
|
||||
config.APIKey = values[EnvAPIKey]
|
||||
|
||||
return NewDNSProviderConfig(config)
|
||||
}
|
||||
|
||||
// NewDNSProviderConfig return a DNSProvider instance configured for EuroDNS.
|
||||
func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
|
||||
if config == nil {
|
||||
return nil, errors.New("eurodns: the configuration of the DNS provider is nil")
|
||||
}
|
||||
|
||||
client, err := internal.NewClient(config.ApplicationID, config.APIKey)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("eurodns: %w", err)
|
||||
}
|
||||
|
||||
if config.HTTPClient != nil {
|
||||
client.HTTPClient = config.HTTPClient
|
||||
}
|
||||
|
||||
client.HTTPClient = clientdebug.Wrap(client.HTTPClient)
|
||||
|
||||
return &DNSProvider{
|
||||
config: config,
|
||||
client: client,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Present creates a TXT record using the specified parameters.
|
||||
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
||||
ctx := context.Background()
|
||||
info := dns01.GetChallengeInfo(domain, keyAuth)
|
||||
|
||||
authZone, err := dns01.FindZoneByFqdn(info.EffectiveFQDN)
|
||||
if err != nil {
|
||||
return fmt.Errorf("eurodns: could not find zone for domain %q: %w", domain, err)
|
||||
}
|
||||
|
||||
subDomain, err := dns01.ExtractSubDomain(info.EffectiveFQDN, authZone)
|
||||
if err != nil {
|
||||
return fmt.Errorf("eurodns: %w", err)
|
||||
}
|
||||
|
||||
authZone = dns01.UnFqdn(authZone)
|
||||
|
||||
zone, err := d.client.GetZone(ctx, authZone)
|
||||
if err != nil {
|
||||
return fmt.Errorf("eurodns: get zone: %w", err)
|
||||
}
|
||||
|
||||
zone.Records = append(zone.Records, internal.Record{
|
||||
Type: "TXT",
|
||||
Host: subDomain,
|
||||
TTL: internal.TTLRounder(d.config.TTL),
|
||||
RData: info.Value,
|
||||
})
|
||||
|
||||
validation, err := d.client.ValidateZone(ctx, authZone, zone)
|
||||
if err != nil {
|
||||
return fmt.Errorf("eurodns: validate zone: %w", err)
|
||||
}
|
||||
|
||||
if validation.Report != nil && !validation.Report.IsValid {
|
||||
return fmt.Errorf("eurodns: validation report: %w", validation.Report)
|
||||
}
|
||||
|
||||
err = d.client.SaveZone(ctx, authZone, zone)
|
||||
if err != nil {
|
||||
return fmt.Errorf("eurodns: save zone: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// CleanUp removes the TXT record matching the specified parameters.
|
||||
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
||||
ctx := context.Background()
|
||||
info := dns01.GetChallengeInfo(domain, keyAuth)
|
||||
|
||||
authZone, err := dns01.FindZoneByFqdn(info.EffectiveFQDN)
|
||||
if err != nil {
|
||||
return fmt.Errorf("eurodns: could not find zone for domain %q: %w", domain, err)
|
||||
}
|
||||
|
||||
subDomain, err := dns01.ExtractSubDomain(info.EffectiveFQDN, authZone)
|
||||
if err != nil {
|
||||
return fmt.Errorf("eurodns: %w", err)
|
||||
}
|
||||
|
||||
authZone = dns01.UnFqdn(authZone)
|
||||
|
||||
zone, err := d.client.GetZone(ctx, authZone)
|
||||
if err != nil {
|
||||
return fmt.Errorf("eurodns: get zone: %w", err)
|
||||
}
|
||||
|
||||
var recordsToKeep []internal.Record
|
||||
|
||||
for _, record := range zone.Records {
|
||||
if record.Type == "TXT" && record.Host == subDomain && record.RData == info.Value {
|
||||
continue
|
||||
}
|
||||
|
||||
recordsToKeep = append(recordsToKeep, record)
|
||||
}
|
||||
|
||||
zone.Records = recordsToKeep
|
||||
|
||||
validation, err := d.client.ValidateZone(ctx, authZone, zone)
|
||||
if err != nil {
|
||||
return fmt.Errorf("eurodns: validate zone: %w", err)
|
||||
}
|
||||
|
||||
if validation.Report != nil && !validation.Report.IsValid {
|
||||
return fmt.Errorf("eurodns: validation report: %w", validation.Report)
|
||||
}
|
||||
|
||||
err = d.client.SaveZone(ctx, authZone, zone)
|
||||
if err != nil {
|
||||
return fmt.Errorf("eurodns: save zone: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Timeout returns the timeout and interval to use when checking for DNS propagation.
|
||||
// Adjusting here to cope with spikes in propagation times.
|
||||
func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
|
||||
return d.config.PropagationTimeout, d.config.PollingInterval
|
||||
}
|
||||
24
providers/dns/eurodns/eurodns.toml
Normal file
24
providers/dns/eurodns/eurodns.toml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
Name = "EuroDNS"
|
||||
Description = ''''''
|
||||
URL = "https://www.eurodns.com/"
|
||||
Code = "eurodns"
|
||||
Since = "v4.33.0"
|
||||
|
||||
Example = '''
|
||||
EURODNS_APP_ID="xxx" \
|
||||
EURODNS_API_KEY="yyy" \
|
||||
lego --dns eurodns -d '*.example.com' -d example.com run
|
||||
'''
|
||||
|
||||
[Configuration]
|
||||
[Configuration.Credentials]
|
||||
EURODNS_APP_ID = "Application ID"
|
||||
EURODNS_API_KEY = "API key"
|
||||
[Configuration.Additional]
|
||||
EURODNS_POLLING_INTERVAL = "Time between DNS propagation check in seconds (Default: 2)"
|
||||
EURODNS_PROPAGATION_TIMEOUT = "Maximum waiting time for DNS propagation in seconds (Default: 60)"
|
||||
EURODNS_TTL = "The TTL of the TXT record used for the DNS challenge in seconds (Default: 600)"
|
||||
EURODNS_HTTP_TIMEOUT = "API request timeout in seconds (Default: 30)"
|
||||
|
||||
[Links]
|
||||
API = "https://docapi.eurodns.com/"
|
||||
215
providers/dns/eurodns/eurodns_test.go
Normal file
215
providers/dns/eurodns/eurodns_test.go
Normal file
|
|
@ -0,0 +1,215 @@
|
|||
package eurodns
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"github.com/go-acme/lego/v4/platform/tester"
|
||||
"github.com/go-acme/lego/v4/platform/tester/servermock"
|
||||
"github.com/go-acme/lego/v4/providers/dns/eurodns/internal"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const envDomain = envNamespace + "DOMAIN"
|
||||
|
||||
var envTest = tester.NewEnvTest(EnvApplicationID, EnvAPIKey).WithDomain(envDomain)
|
||||
|
||||
func TestNewDNSProvider(t *testing.T) {
|
||||
testCases := []struct {
|
||||
desc string
|
||||
envVars map[string]string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
desc: "success",
|
||||
envVars: map[string]string{
|
||||
EnvApplicationID: "abc",
|
||||
EnvAPIKey: "secret",
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "missing application ID",
|
||||
envVars: map[string]string{
|
||||
EnvApplicationID: "",
|
||||
EnvAPIKey: "secret",
|
||||
},
|
||||
expected: "eurodns: some credentials information are missing: EURODNS_APP_ID",
|
||||
},
|
||||
{
|
||||
desc: "missing API secret",
|
||||
envVars: map[string]string{
|
||||
EnvApplicationID: "",
|
||||
EnvAPIKey: "secret",
|
||||
},
|
||||
expected: "eurodns: some credentials information are missing: EURODNS_APP_ID",
|
||||
},
|
||||
{
|
||||
desc: "missing credentials",
|
||||
envVars: map[string]string{},
|
||||
expected: "eurodns: some credentials information are missing: EURODNS_APP_ID,EURODNS_API_KEY",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
defer envTest.RestoreEnv()
|
||||
|
||||
envTest.ClearEnv()
|
||||
|
||||
envTest.Apply(test.envVars)
|
||||
|
||||
p, err := NewDNSProvider()
|
||||
|
||||
if test.expected == "" {
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, p)
|
||||
require.NotNil(t, p.config)
|
||||
require.NotNil(t, p.client)
|
||||
} else {
|
||||
require.EqualError(t, err, test.expected)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewDNSProviderConfig(t *testing.T) {
|
||||
testCases := []struct {
|
||||
desc string
|
||||
appID string
|
||||
apiKey string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
desc: "success",
|
||||
appID: "abc",
|
||||
apiKey: "secret",
|
||||
},
|
||||
{
|
||||
desc: "missing application ID",
|
||||
expected: "eurodns: credentials missing",
|
||||
apiKey: "secret",
|
||||
},
|
||||
{
|
||||
desc: "missing API secret",
|
||||
expected: "eurodns: credentials missing",
|
||||
appID: "abc",
|
||||
},
|
||||
{
|
||||
desc: "missing credentials",
|
||||
expected: "eurodns: credentials missing",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
config := NewDefaultConfig()
|
||||
config.ApplicationID = test.appID
|
||||
config.APIKey = test.apiKey
|
||||
|
||||
p, err := NewDNSProviderConfig(config)
|
||||
|
||||
if test.expected == "" {
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, p)
|
||||
require.NotNil(t, p.config)
|
||||
require.NotNil(t, p.client)
|
||||
} else {
|
||||
require.EqualError(t, err, test.expected)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestLivePresent(t *testing.T) {
|
||||
if !envTest.IsLiveTest() {
|
||||
t.Skip("skipping live test")
|
||||
}
|
||||
|
||||
envTest.RestoreEnv()
|
||||
|
||||
provider, err := NewDNSProvider()
|
||||
require.NoError(t, err)
|
||||
|
||||
err = provider.Present(envTest.GetDomain(), "", "123d==")
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestLiveCleanUp(t *testing.T) {
|
||||
if !envTest.IsLiveTest() {
|
||||
t.Skip("skipping live test")
|
||||
}
|
||||
|
||||
envTest.RestoreEnv()
|
||||
|
||||
provider, err := NewDNSProvider()
|
||||
require.NoError(t, err)
|
||||
|
||||
err = provider.CleanUp(envTest.GetDomain(), "", "123d==")
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func mockBuilder() *servermock.Builder[*DNSProvider] {
|
||||
return servermock.NewBuilder(
|
||||
func(server *httptest.Server) (*DNSProvider, error) {
|
||||
config := NewDefaultConfig()
|
||||
config.APIKey = "secret"
|
||||
config.ApplicationID = "abc"
|
||||
config.HTTPClient = server.Client()
|
||||
|
||||
provider, err := NewDNSProviderConfig(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
provider.client.BaseURL, _ = url.Parse(server.URL)
|
||||
|
||||
return provider, nil
|
||||
},
|
||||
servermock.CheckHeader().
|
||||
WithJSONHeaders().
|
||||
With(internal.HeaderAppID, "abc").
|
||||
With(internal.HeaderAPIKey, "secret"),
|
||||
)
|
||||
}
|
||||
|
||||
func TestDNSProvider_Present(t *testing.T) {
|
||||
provider := mockBuilder().
|
||||
Route("GET /example.com",
|
||||
servermock.ResponseFromInternal("zone_get.json"),
|
||||
).
|
||||
Route("POST /example.com/check",
|
||||
servermock.ResponseFromInternal("zone_add_validate_ok.json"),
|
||||
servermock.CheckRequestJSONBodyFromInternal("zone_add.json"),
|
||||
).
|
||||
Route("PUT /example.com",
|
||||
servermock.Noop().
|
||||
WithStatusCode(http.StatusNoContent),
|
||||
servermock.CheckRequestJSONBodyFromInternal("zone_add.json"),
|
||||
).
|
||||
Build(t)
|
||||
|
||||
err := provider.Present("example.com", "abc", "123d==")
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestDNSProvider_CleanUp(t *testing.T) {
|
||||
provider := mockBuilder().
|
||||
Route("GET /example.com",
|
||||
servermock.ResponseFromInternal("zone_add.json"),
|
||||
).
|
||||
Route("POST /example.com/check",
|
||||
servermock.ResponseFromInternal("zone_remove.json"),
|
||||
servermock.CheckRequestJSONBodyFromInternal("zone_remove.json"),
|
||||
).
|
||||
Route("PUT /example.com",
|
||||
servermock.Noop().
|
||||
WithStatusCode(http.StatusNoContent),
|
||||
servermock.CheckRequestJSONBodyFromInternal("zone_remove.json"),
|
||||
).
|
||||
Build(t)
|
||||
|
||||
err := provider.CleanUp("example.com", "abc", "123d==")
|
||||
require.NoError(t, err)
|
||||
}
|
||||
199
providers/dns/eurodns/internal/client.go
Normal file
199
providers/dns/eurodns/internal/client.go
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
package internal
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/go-acme/lego/v4/providers/dns/internal/errutils"
|
||||
)
|
||||
|
||||
const defaultBaseURL = "https://rest-api.eurodns.com/dns-zones/"
|
||||
|
||||
const (
|
||||
HeaderAppID = "X-APP-ID"
|
||||
HeaderAPIKey = "X-API-KEY"
|
||||
)
|
||||
|
||||
// Client the EuroDNS API client.
|
||||
type Client struct {
|
||||
appID string
|
||||
apiKey string
|
||||
|
||||
BaseURL *url.URL
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// NewClient creates a new Client.
|
||||
func NewClient(appID, apiKey string) (*Client, error) {
|
||||
if appID == "" || apiKey == "" {
|
||||
return nil, errors.New("credentials missing")
|
||||
}
|
||||
|
||||
baseURL, _ := url.Parse(defaultBaseURL)
|
||||
|
||||
return &Client{
|
||||
appID: appID,
|
||||
apiKey: apiKey,
|
||||
BaseURL: baseURL,
|
||||
HTTPClient: &http.Client{Timeout: 10 * time.Second},
|
||||
}, nil
|
||||
}
|
||||
|
||||
// GetZone gets a DNS Zone.
|
||||
// https://docapi.eurodns.com/#/dnsprovider/getdnszone
|
||||
func (c *Client) GetZone(ctx context.Context, domain string) (*Zone, error) {
|
||||
endpoint := c.BaseURL.JoinPath(domain)
|
||||
|
||||
req, err := newJSONRequest(ctx, http.MethodGet, endpoint, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := &Zone{}
|
||||
|
||||
err = c.do(req, result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// SaveZone saves a DNS Zone.
|
||||
// https://docapi.eurodns.com/#/dnsprovider/savednszone
|
||||
func (c *Client) SaveZone(ctx context.Context, domain string, zone *Zone) error {
|
||||
endpoint := c.BaseURL.JoinPath(domain)
|
||||
|
||||
if len(zone.URLForwards) == 0 {
|
||||
zone.URLForwards = make([]URLForward, 0)
|
||||
}
|
||||
|
||||
if len(zone.MailForwards) == 0 {
|
||||
zone.MailForwards = make([]MailForward, 0)
|
||||
}
|
||||
|
||||
req, err := newJSONRequest(ctx, http.MethodPut, endpoint, zone)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return c.do(req, nil)
|
||||
}
|
||||
|
||||
// ValidateZone validates DNS Zone.
|
||||
// https://docapi.eurodns.com/#/dnsprovider/checkdnszone
|
||||
func (c *Client) ValidateZone(ctx context.Context, domain string, zone *Zone) (*Zone, error) {
|
||||
endpoint := c.BaseURL.JoinPath(domain, "check")
|
||||
|
||||
if len(zone.URLForwards) == 0 {
|
||||
zone.URLForwards = make([]URLForward, 0)
|
||||
}
|
||||
|
||||
if len(zone.MailForwards) == 0 {
|
||||
zone.MailForwards = make([]MailForward, 0)
|
||||
}
|
||||
|
||||
req, err := newJSONRequest(ctx, http.MethodPost, endpoint, zone)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := &Zone{}
|
||||
|
||||
err = c.do(req, result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (c *Client) do(req *http.Request, result any) error {
|
||||
req.Header.Set(HeaderAppID, c.appID)
|
||||
req.Header.Set(HeaderAPIKey, c.apiKey)
|
||||
|
||||
resp, err := c.HTTPClient.Do(req)
|
||||
if err != nil {
|
||||
return errutils.NewHTTPDoError(req, err)
|
||||
}
|
||||
|
||||
defer func() { _ = resp.Body.Close() }()
|
||||
|
||||
if resp.StatusCode/100 != 2 {
|
||||
return parseError(req, resp)
|
||||
}
|
||||
|
||||
if result == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
raw, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return errutils.NewReadResponseError(req, resp.StatusCode, err)
|
||||
}
|
||||
|
||||
err = json.Unmarshal(raw, result)
|
||||
if err != nil {
|
||||
return errutils.NewUnmarshalError(req, resp.StatusCode, raw, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func newJSONRequest(ctx context.Context, method string, endpoint *url.URL, payload any) (*http.Request, error) {
|
||||
buf := new(bytes.Buffer)
|
||||
|
||||
if payload != nil {
|
||||
err := json.NewEncoder(buf).Encode(payload)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create request JSON body: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, method, endpoint.String(), buf)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to create request: %w", err)
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", "application/json")
|
||||
|
||||
if payload != nil {
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
}
|
||||
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func parseError(req *http.Request, resp *http.Response) error {
|
||||
raw, _ := io.ReadAll(resp.Body)
|
||||
|
||||
var errAPI APIError
|
||||
|
||||
err := json.Unmarshal(raw, &errAPI)
|
||||
if err != nil {
|
||||
return errutils.NewUnexpectedStatusCodeError(req, resp.StatusCode, raw)
|
||||
}
|
||||
|
||||
return fmt.Errorf("%d: %w", resp.StatusCode, &errAPI)
|
||||
}
|
||||
|
||||
const DefaultTTL = 600
|
||||
|
||||
// TTLRounder rounds the given TTL in seconds to the next accepted value.
|
||||
// Accepted TTL values are: 600, 900, 1800,3600, 7200, 14400, 21600, 43200, 86400, 172800, 432000, 604800.
|
||||
func TTLRounder(ttl int) int {
|
||||
for _, validTTL := range []int{DefaultTTL, 900, 1800, 3600, 7200, 14400, 21600, 43200, 86400, 172800, 432000, 604800} {
|
||||
if ttl <= validTTL {
|
||||
return validTTL
|
||||
}
|
||||
}
|
||||
|
||||
return DefaultTTL
|
||||
}
|
||||
310
providers/dns/eurodns/internal/client_test.go
Normal file
310
providers/dns/eurodns/internal/client_test.go
Normal file
|
|
@ -0,0 +1,310 @@
|
|||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"slices"
|
||||
"testing"
|
||||
|
||||
"github.com/go-acme/lego/v4/platform/tester/servermock"
|
||||
"github.com/go-acme/lego/v4/providers/dns/internal/ptr"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func mockBuilder() *servermock.Builder[*Client] {
|
||||
return servermock.NewBuilder[*Client](
|
||||
func(server *httptest.Server) (*Client, error) {
|
||||
client, err := NewClient("abc", "secret")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
client.HTTPClient = server.Client()
|
||||
client.BaseURL, _ = url.Parse(server.URL)
|
||||
|
||||
return client, nil
|
||||
},
|
||||
servermock.CheckHeader().
|
||||
WithJSONHeaders().
|
||||
With(HeaderAppID, "abc").
|
||||
With(HeaderAPIKey, "secret"),
|
||||
)
|
||||
}
|
||||
|
||||
func TestClient_GetZone(t *testing.T) {
|
||||
client := mockBuilder().
|
||||
Route("GET /example.com",
|
||||
servermock.ResponseFromFixture("zone_get.json"),
|
||||
).
|
||||
Build(t)
|
||||
|
||||
zone, err := client.GetZone(context.Background(), "example.com")
|
||||
require.NoError(t, err)
|
||||
|
||||
expected := &Zone{
|
||||
Name: "example.com",
|
||||
DomainConnect: true,
|
||||
Records: slices.Concat([]Record{fakeARecord()}),
|
||||
URLForwards: []URLForward{fakeURLForward()},
|
||||
MailForwards: []MailForward{fakeMailForward()},
|
||||
}
|
||||
|
||||
assert.Equal(t, expected, zone)
|
||||
}
|
||||
|
||||
func TestClient_GetZone_error(t *testing.T) {
|
||||
client := mockBuilder().
|
||||
Route("GET /example.com",
|
||||
servermock.ResponseFromFixture("error.json").
|
||||
WithStatusCode(http.StatusUnauthorized),
|
||||
).
|
||||
Build(t)
|
||||
|
||||
_, err := client.GetZone(context.Background(), "example.com")
|
||||
require.Error(t, err)
|
||||
|
||||
require.EqualError(t, err, "401: INVALID_API_KEY: Invalid API Key")
|
||||
}
|
||||
|
||||
func TestClient_SaveZone(t *testing.T) {
|
||||
client := mockBuilder().
|
||||
Route("PUT /example.com",
|
||||
servermock.Noop().
|
||||
WithStatusCode(http.StatusNoContent),
|
||||
servermock.CheckRequestJSONBodyFromFixture("zone_add.json"),
|
||||
).
|
||||
Build(t)
|
||||
|
||||
record := Record{
|
||||
Type: "TXT",
|
||||
Host: "_acme-challenge",
|
||||
RData: "ADw2sEd82DUgXcQ9hNBZThJs7zVJkR5v9JeSbAb9mZY",
|
||||
TTL: 600,
|
||||
}
|
||||
|
||||
zone := &Zone{
|
||||
Name: "example.com",
|
||||
DomainConnect: true,
|
||||
Records: []Record{fakeARecord(), record},
|
||||
URLForwards: []URLForward{fakeURLForward()},
|
||||
MailForwards: []MailForward{fakeMailForward()},
|
||||
}
|
||||
|
||||
err := client.SaveZone(context.Background(), "example.com", zone)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestClient_SaveZone_emptyForwards(t *testing.T) {
|
||||
client := mockBuilder().
|
||||
Route("PUT /example.com",
|
||||
servermock.Noop().
|
||||
WithStatusCode(http.StatusNoContent),
|
||||
servermock.CheckRequestJSONBodyFromFixture("zone_add_empty_forwards.json"),
|
||||
).
|
||||
Build(t)
|
||||
|
||||
record := Record{
|
||||
Type: "TXT",
|
||||
Host: "_acme-challenge",
|
||||
RData: "ADw2sEd82DUgXcQ9hNBZThJs7zVJkR5v9JeSbAb9mZY",
|
||||
TTL: 600,
|
||||
}
|
||||
|
||||
zone := &Zone{
|
||||
Name: "example.com",
|
||||
DomainConnect: true,
|
||||
Records: slices.Concat([]Record{fakeARecord(), record}),
|
||||
}
|
||||
|
||||
err := client.SaveZone(context.Background(), "example.com", zone)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestClient_SaveZone_error(t *testing.T) {
|
||||
client := mockBuilder().
|
||||
Route("PUT /example.com",
|
||||
servermock.ResponseFromFixture("error.json").
|
||||
WithStatusCode(http.StatusUnauthorized),
|
||||
).
|
||||
Build(t)
|
||||
|
||||
zone := &Zone{
|
||||
Name: "example.com",
|
||||
DomainConnect: true,
|
||||
Records: []Record{fakeARecord()},
|
||||
URLForwards: []URLForward{fakeURLForward()},
|
||||
MailForwards: []MailForward{fakeMailForward()},
|
||||
}
|
||||
|
||||
err := client.SaveZone(context.Background(), "example.com", zone)
|
||||
require.Error(t, err)
|
||||
|
||||
require.EqualError(t, err, "401: INVALID_API_KEY: Invalid API Key")
|
||||
}
|
||||
|
||||
func TestClient_ValidateZone(t *testing.T) {
|
||||
client := mockBuilder().
|
||||
Route("POST /example.com/check",
|
||||
servermock.ResponseFromFixture("zone_add_validate_ok.json"),
|
||||
servermock.CheckRequestJSONBodyFromFixture("zone_add.json"),
|
||||
).
|
||||
Build(t)
|
||||
|
||||
record := Record{
|
||||
Type: "TXT",
|
||||
Host: "_acme-challenge",
|
||||
RData: "ADw2sEd82DUgXcQ9hNBZThJs7zVJkR5v9JeSbAb9mZY",
|
||||
TTL: 600,
|
||||
}
|
||||
|
||||
zone := &Zone{
|
||||
Name: "example.com",
|
||||
DomainConnect: true,
|
||||
Records: []Record{fakeARecord(), record},
|
||||
URLForwards: []URLForward{fakeURLForward()},
|
||||
MailForwards: []MailForward{fakeMailForward()},
|
||||
}
|
||||
|
||||
zone, err := client.ValidateZone(context.Background(), "example.com", zone)
|
||||
require.NoError(t, err)
|
||||
|
||||
expected := &Zone{
|
||||
Name: "example.com",
|
||||
DomainConnect: true,
|
||||
Records: []Record{fakeARecord(), record},
|
||||
URLForwards: []URLForward{fakeURLForward()},
|
||||
MailForwards: []MailForward{fakeMailForward()},
|
||||
Report: &Report{IsValid: true},
|
||||
}
|
||||
|
||||
assert.Equal(t, expected, zone)
|
||||
}
|
||||
|
||||
func TestClient_ValidateZone_report(t *testing.T) {
|
||||
client := mockBuilder().
|
||||
Route("POST /example.com/check",
|
||||
servermock.ResponseFromFixture("zone_add_validate_ko.json"),
|
||||
servermock.CheckRequestJSONBodyFromFixture("zone_add.json"),
|
||||
).
|
||||
Build(t)
|
||||
|
||||
record := Record{
|
||||
Type: "TXT",
|
||||
Host: "_acme-challenge",
|
||||
RData: "ADw2sEd82DUgXcQ9hNBZThJs7zVJkR5v9JeSbAb9mZY",
|
||||
TTL: 600,
|
||||
}
|
||||
|
||||
zone := &Zone{
|
||||
Name: "example.com",
|
||||
DomainConnect: true,
|
||||
Records: []Record{fakeARecord(), record},
|
||||
URLForwards: []URLForward{fakeURLForward()},
|
||||
MailForwards: []MailForward{fakeMailForward()},
|
||||
}
|
||||
|
||||
zone, err := client.ValidateZone(context.Background(), "example.com", zone)
|
||||
require.NoError(t, err)
|
||||
|
||||
expected := &Zone{
|
||||
Name: "example.com",
|
||||
DomainConnect: true,
|
||||
Records: []Record{fakeARecord(), record},
|
||||
URLForwards: []URLForward{fakeURLForward()},
|
||||
MailForwards: []MailForward{fakeMailForward()},
|
||||
Report: fakeReport(),
|
||||
}
|
||||
|
||||
assert.EqualError(t, zone.Report, `record error (ERROR): "120" is not a valid TTL, URL forward error (ERROR): string, mail forward error (ERROR): string, zone error (ERROR): string`)
|
||||
|
||||
assert.Equal(t, expected, zone)
|
||||
}
|
||||
|
||||
func TestClient_ValidateZone_error(t *testing.T) {
|
||||
client := mockBuilder().
|
||||
Route("POST /example.com/check",
|
||||
servermock.ResponseFromFixture("error.json").
|
||||
WithStatusCode(http.StatusUnauthorized),
|
||||
).
|
||||
Build(t)
|
||||
|
||||
zone := &Zone{
|
||||
Name: "example.com",
|
||||
DomainConnect: true,
|
||||
Records: []Record{fakeARecord()},
|
||||
URLForwards: []URLForward{fakeURLForward()},
|
||||
MailForwards: []MailForward{fakeMailForward()},
|
||||
}
|
||||
|
||||
_, err := client.ValidateZone(context.Background(), "example.com", zone)
|
||||
require.Error(t, err)
|
||||
|
||||
require.EqualError(t, err, "401: INVALID_API_KEY: Invalid API Key")
|
||||
}
|
||||
|
||||
func fakeARecord() Record {
|
||||
return Record{
|
||||
ID: 1000,
|
||||
Type: "A",
|
||||
Host: "@",
|
||||
TTL: 600,
|
||||
RData: "string",
|
||||
Updated: ptr.Pointer(true),
|
||||
Locked: ptr.Pointer(true),
|
||||
IsDynDNS: ptr.Pointer(true),
|
||||
Proxy: "ON",
|
||||
}
|
||||
}
|
||||
|
||||
func fakeURLForward() URLForward {
|
||||
return URLForward{
|
||||
ID: 2000,
|
||||
ForwardType: "FRAME",
|
||||
Host: "string",
|
||||
URL: "string",
|
||||
Title: "string",
|
||||
Keywords: "string",
|
||||
Description: "string",
|
||||
Updated: ptr.Pointer(true),
|
||||
}
|
||||
}
|
||||
|
||||
func fakeMailForward() MailForward {
|
||||
return MailForward{
|
||||
ID: 3000,
|
||||
Source: "string",
|
||||
Destination: "string",
|
||||
Updated: ptr.Pointer(true),
|
||||
}
|
||||
}
|
||||
|
||||
func fakeReport() *Report {
|
||||
return &Report{
|
||||
IsValid: false,
|
||||
RecordErrors: []RecordError{{
|
||||
Messages: []string{`"120" is not a valid TTL`},
|
||||
Severity: "ERROR",
|
||||
Record: fakeARecord(),
|
||||
}},
|
||||
URLForwardErrors: []URLForwardError{{
|
||||
Messages: []string{"string"},
|
||||
Severity: "ERROR",
|
||||
URLForward: fakeURLForward(),
|
||||
}},
|
||||
MailForwardErrors: []MailForwardError{{
|
||||
Messages: []string{"string"},
|
||||
MailForward: fakeMailForward(),
|
||||
Severity: "ERROR",
|
||||
}},
|
||||
ZoneErrors: []ZoneError{{
|
||||
Message: "string",
|
||||
Severity: "ERROR",
|
||||
Records: []Record{fakeARecord()},
|
||||
URLForwards: []URLForward{fakeURLForward()},
|
||||
MailForwards: []MailForward{fakeMailForward()},
|
||||
}},
|
||||
}
|
||||
}
|
||||
8
providers/dns/eurodns/internal/fixtures/error.json
Normal file
8
providers/dns/eurodns/internal/fixtures/error.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_API_KEY",
|
||||
"title": "Invalid API Key"
|
||||
}
|
||||
]
|
||||
}
|
||||
46
providers/dns/eurodns/internal/fixtures/zone_add.json
Normal file
46
providers/dns/eurodns/internal/fixtures/zone_add.json
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"name": "example.com",
|
||||
"domainConnect": true,
|
||||
"records": [
|
||||
{
|
||||
"id": 1000,
|
||||
"type": "A",
|
||||
"host": "@",
|
||||
"ttl": 600,
|
||||
"rdata": "string",
|
||||
"updated": true,
|
||||
"locked": true,
|
||||
"isDynDns": true,
|
||||
"proxy": "ON"
|
||||
},
|
||||
{
|
||||
"type": "TXT",
|
||||
"host": "_acme-challenge",
|
||||
"ttl": 600,
|
||||
"rdata": "ADw2sEd82DUgXcQ9hNBZThJs7zVJkR5v9JeSbAb9mZY",
|
||||
"updated": null,
|
||||
"locked": null,
|
||||
"isDynDns": null
|
||||
}
|
||||
],
|
||||
"urlForwards": [
|
||||
{
|
||||
"id": 2000,
|
||||
"forwardType": "FRAME",
|
||||
"host": "string",
|
||||
"url": "string",
|
||||
"title": "string",
|
||||
"keywords": "string",
|
||||
"description": "string",
|
||||
"updated": true
|
||||
}
|
||||
],
|
||||
"mailForwards": [
|
||||
{
|
||||
"id": 3000,
|
||||
"source": "string",
|
||||
"destination": "string",
|
||||
"updated": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "example.com",
|
||||
"domainConnect": true,
|
||||
"records": [
|
||||
{
|
||||
"id": 1000,
|
||||
"type": "A",
|
||||
"host": "@",
|
||||
"ttl": 600,
|
||||
"rdata": "string",
|
||||
"updated": true,
|
||||
"locked": true,
|
||||
"isDynDns": true,
|
||||
"proxy": "ON"
|
||||
},
|
||||
{
|
||||
"type": "TXT",
|
||||
"host": "_acme-challenge",
|
||||
"ttl": 600,
|
||||
"rdata": "ADw2sEd82DUgXcQ9hNBZThJs7zVJkR5v9JeSbAb9mZY",
|
||||
"updated": null,
|
||||
"locked": null,
|
||||
"isDynDns": null
|
||||
}
|
||||
],
|
||||
"urlForwards": [],
|
||||
"mailForwards": []
|
||||
}
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
{
|
||||
"name": "example.com",
|
||||
"domainConnect": true,
|
||||
"records": [
|
||||
{
|
||||
"id": 1000,
|
||||
"type": "A",
|
||||
"host": "@",
|
||||
"ttl": 600,
|
||||
"rdata": "string",
|
||||
"updated": true,
|
||||
"locked": true,
|
||||
"isDynDns": true,
|
||||
"proxy": "ON"
|
||||
},
|
||||
{
|
||||
"type": "TXT",
|
||||
"host": "_acme-challenge",
|
||||
"ttl": 600,
|
||||
"rdata": "ADw2sEd82DUgXcQ9hNBZThJs7zVJkR5v9JeSbAb9mZY",
|
||||
"updated": null,
|
||||
"locked": null,
|
||||
"isDynDns": null
|
||||
}
|
||||
],
|
||||
"urlForwards": [
|
||||
{
|
||||
"id": 2000,
|
||||
"forwardType": "FRAME",
|
||||
"host": "string",
|
||||
"url": "string",
|
||||
"title": "string",
|
||||
"keywords": "string",
|
||||
"description": "string",
|
||||
"updated": true
|
||||
}
|
||||
],
|
||||
"mailForwards": [
|
||||
{
|
||||
"id": 3000,
|
||||
"source": "string",
|
||||
"destination": "string",
|
||||
"updated": true
|
||||
}
|
||||
],
|
||||
"report": {
|
||||
"isValid": false,
|
||||
"recordErrors": [
|
||||
{
|
||||
"messages": [
|
||||
"\"120\" is not a valid TTL"
|
||||
],
|
||||
"record": {
|
||||
"id": 1000,
|
||||
"type": "A",
|
||||
"host": "@",
|
||||
"ttl": 600,
|
||||
"rdata": "string",
|
||||
"updated": true,
|
||||
"locked": true,
|
||||
"isDynDns": true,
|
||||
"proxy": "ON"
|
||||
},
|
||||
"severity": "ERROR"
|
||||
}
|
||||
],
|
||||
"urlForwardErrors": [
|
||||
{
|
||||
"messages": [
|
||||
"string"
|
||||
],
|
||||
"urlForward": {
|
||||
"id": 2000,
|
||||
"forwardType": "FRAME",
|
||||
"host": "string",
|
||||
"url": "string",
|
||||
"title": "string",
|
||||
"keywords": "string",
|
||||
"description": "string",
|
||||
"updated": true
|
||||
},
|
||||
"severity": "ERROR"
|
||||
}
|
||||
],
|
||||
"mailForwardErrors": [
|
||||
{
|
||||
"messages": [
|
||||
"string"
|
||||
],
|
||||
"mailForward": {
|
||||
"id": 3000,
|
||||
"source": "string",
|
||||
"destination": "string",
|
||||
"updated": true
|
||||
},
|
||||
"severity": "ERROR"
|
||||
}
|
||||
],
|
||||
"zoneErrors": [
|
||||
{
|
||||
"message": "string",
|
||||
"records": [
|
||||
{
|
||||
"id": 1000,
|
||||
"type": "A",
|
||||
"host": "@",
|
||||
"ttl": 600,
|
||||
"rdata": "string",
|
||||
"updated": true,
|
||||
"locked": true,
|
||||
"isDynDns": true,
|
||||
"proxy": "ON"
|
||||
}
|
||||
],
|
||||
"urlForwards": [
|
||||
{
|
||||
"id": 2000,
|
||||
"forwardType": "FRAME",
|
||||
"host": "string",
|
||||
"url": "string",
|
||||
"title": "string",
|
||||
"keywords": "string",
|
||||
"description": "string",
|
||||
"updated": true
|
||||
}
|
||||
],
|
||||
"mailForwards": [
|
||||
{
|
||||
"id": 3000,
|
||||
"source": "string",
|
||||
"destination": "string",
|
||||
"updated": true
|
||||
}
|
||||
],
|
||||
"severity": "ERROR"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"name": "example.com",
|
||||
"domainConnect": true,
|
||||
"records": [
|
||||
{
|
||||
"id": 1000,
|
||||
"type": "A",
|
||||
"host": "@",
|
||||
"ttl": 600,
|
||||
"rdata": "string",
|
||||
"updated": true,
|
||||
"locked": true,
|
||||
"isDynDns": true,
|
||||
"proxy": "ON"
|
||||
},
|
||||
{
|
||||
"type": "TXT",
|
||||
"host": "_acme-challenge",
|
||||
"ttl": 600,
|
||||
"rdata": "ADw2sEd82DUgXcQ9hNBZThJs7zVJkR5v9JeSbAb9mZY",
|
||||
"updated": null,
|
||||
"locked": null,
|
||||
"isDynDns": null
|
||||
}
|
||||
],
|
||||
"urlForwards": [
|
||||
{
|
||||
"id": 2000,
|
||||
"forwardType": "FRAME",
|
||||
"host": "string",
|
||||
"url": "string",
|
||||
"title": "string",
|
||||
"keywords": "string",
|
||||
"description": "string",
|
||||
"updated": true
|
||||
}
|
||||
],
|
||||
"mailForwards": [
|
||||
{
|
||||
"id": 3000,
|
||||
"source": "string",
|
||||
"destination": "string",
|
||||
"updated": true
|
||||
}
|
||||
],
|
||||
"report": {
|
||||
"isValid": true
|
||||
}
|
||||
}
|
||||
37
providers/dns/eurodns/internal/fixtures/zone_get.json
Normal file
37
providers/dns/eurodns/internal/fixtures/zone_get.json
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"name": "example.com",
|
||||
"domainConnect": true,
|
||||
"records": [
|
||||
{
|
||||
"id": 1000,
|
||||
"type": "A",
|
||||
"host": "@",
|
||||
"ttl": 600,
|
||||
"rdata": "string",
|
||||
"updated": true,
|
||||
"locked": true,
|
||||
"isDynDns": true,
|
||||
"proxy": "ON"
|
||||
}
|
||||
],
|
||||
"urlForwards": [
|
||||
{
|
||||
"id": 2000,
|
||||
"forwardType": "FRAME",
|
||||
"host": "string",
|
||||
"url": "string",
|
||||
"title": "string",
|
||||
"keywords": "string",
|
||||
"description": "string",
|
||||
"updated": true
|
||||
}
|
||||
],
|
||||
"mailForwards": [
|
||||
{
|
||||
"id": 3000,
|
||||
"source": "string",
|
||||
"destination": "string",
|
||||
"updated": true
|
||||
}
|
||||
]
|
||||
}
|
||||
37
providers/dns/eurodns/internal/fixtures/zone_remove.json
Normal file
37
providers/dns/eurodns/internal/fixtures/zone_remove.json
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"name": "example.com",
|
||||
"domainConnect": true,
|
||||
"records": [
|
||||
{
|
||||
"id": 1000,
|
||||
"type": "A",
|
||||
"host": "@",
|
||||
"ttl": 600,
|
||||
"rdata": "string",
|
||||
"updated": true,
|
||||
"locked": true,
|
||||
"isDynDns": true,
|
||||
"proxy": "ON"
|
||||
}
|
||||
],
|
||||
"urlForwards": [
|
||||
{
|
||||
"id": 2000,
|
||||
"forwardType": "FRAME",
|
||||
"host": "string",
|
||||
"url": "string",
|
||||
"title": "string",
|
||||
"keywords": "string",
|
||||
"description": "string",
|
||||
"updated": true
|
||||
}
|
||||
],
|
||||
"mailForwards": [
|
||||
{
|
||||
"id": 3000,
|
||||
"source": "string",
|
||||
"destination": "string",
|
||||
"updated": true
|
||||
}
|
||||
]
|
||||
}
|
||||
136
providers/dns/eurodns/internal/types.go
Normal file
136
providers/dns/eurodns/internal/types.go
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
package internal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type APIError struct {
|
||||
Errors []Error `json:"errors"`
|
||||
}
|
||||
|
||||
func (a *APIError) Error() string {
|
||||
var msg []string
|
||||
|
||||
for _, e := range a.Errors {
|
||||
msg = append(msg, fmt.Sprintf("%s: %s", e.Code, e.Title))
|
||||
}
|
||||
|
||||
return strings.Join(msg, ", ")
|
||||
}
|
||||
|
||||
type Error struct {
|
||||
Code string `json:"code"`
|
||||
Title string `json:"title"`
|
||||
}
|
||||
|
||||
type Zone struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
DomainConnect bool `json:"domainConnect,omitempty"`
|
||||
Records []Record `json:"records"`
|
||||
URLForwards []URLForward `json:"urlForwards"`
|
||||
MailForwards []MailForward `json:"mailForwards"`
|
||||
Report *Report `json:"report,omitempty"`
|
||||
}
|
||||
|
||||
type Record struct {
|
||||
ID int `json:"id,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Host string `json:"host,omitempty"`
|
||||
TTL int `json:"ttl,omitempty"`
|
||||
RData string `json:"rdata,omitempty"`
|
||||
Updated *bool `json:"updated"`
|
||||
Locked *bool `json:"locked"`
|
||||
IsDynDNS *bool `json:"isDynDns"`
|
||||
Proxy string `json:"proxy,omitempty"`
|
||||
}
|
||||
|
||||
type URLForward struct {
|
||||
ID int `json:"id,omitempty"`
|
||||
ForwardType string `json:"forwardType,omitempty"`
|
||||
Host string `json:"host,omitempty"`
|
||||
URL string `json:"url,omitempty"`
|
||||
Title string `json:"title,omitempty"`
|
||||
Keywords string `json:"keywords,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Updated *bool `json:"updated,omitempty"`
|
||||
}
|
||||
|
||||
type MailForward struct {
|
||||
ID int `json:"id,omitempty"`
|
||||
Source string `json:"source,omitempty"`
|
||||
Destination string `json:"destination,omitempty"`
|
||||
Updated *bool `json:"updated,omitempty"`
|
||||
}
|
||||
|
||||
type Report struct {
|
||||
IsValid bool `json:"isValid,omitempty"`
|
||||
RecordErrors []RecordError `json:"recordErrors,omitempty"`
|
||||
URLForwardErrors []URLForwardError `json:"urlForwardErrors,omitempty"`
|
||||
MailForwardErrors []MailForwardError `json:"mailForwardErrors,omitempty"`
|
||||
ZoneErrors []ZoneError `json:"zoneErrors,omitempty"`
|
||||
}
|
||||
|
||||
func (r *Report) Error() string {
|
||||
var msg []string
|
||||
|
||||
for _, e := range r.RecordErrors {
|
||||
msg = append(msg, e.Error())
|
||||
}
|
||||
|
||||
for _, e := range r.URLForwardErrors {
|
||||
msg = append(msg, e.Error())
|
||||
}
|
||||
|
||||
for _, e := range r.MailForwardErrors {
|
||||
msg = append(msg, e.Error())
|
||||
}
|
||||
|
||||
for _, e := range r.ZoneErrors {
|
||||
msg = append(msg, e.Error())
|
||||
}
|
||||
|
||||
return strings.Join(msg, ", ")
|
||||
}
|
||||
|
||||
type RecordError struct {
|
||||
Messages []string `json:"messages,omitempty"`
|
||||
Record Record `json:"record"`
|
||||
Severity string `json:"severity,omitempty"`
|
||||
}
|
||||
|
||||
func (e *RecordError) Error() string {
|
||||
return fmt.Sprintf("record error (%s): %s", e.Severity, strings.Join(e.Messages, ", "))
|
||||
}
|
||||
|
||||
type URLForwardError struct {
|
||||
Messages []string `json:"messages,omitempty"`
|
||||
URLForward URLForward `json:"urlForward"`
|
||||
Severity string `json:"severity,omitempty"`
|
||||
}
|
||||
|
||||
func (e *URLForwardError) Error() string {
|
||||
return fmt.Sprintf("URL forward error (%s): %s", e.Severity, strings.Join(e.Messages, ", "))
|
||||
}
|
||||
|
||||
type MailForwardError struct {
|
||||
Messages []string `json:"messages,omitempty"`
|
||||
MailForward MailForward `json:"mailForward"`
|
||||
Severity string `json:"severity,omitempty"`
|
||||
}
|
||||
|
||||
func (e *MailForwardError) Error() string {
|
||||
return fmt.Sprintf("mail forward error (%s): %s", e.Severity, strings.Join(e.Messages, ", "))
|
||||
}
|
||||
|
||||
type ZoneError struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
Records []Record `json:"records,omitempty"`
|
||||
URLForwards []URLForward `json:"urlForwards,omitempty"`
|
||||
MailForwards []MailForward `json:"mailForwards,omitempty"`
|
||||
Severity string `json:"severity,omitempty"`
|
||||
}
|
||||
|
||||
func (e *ZoneError) Error() string {
|
||||
return fmt.Sprintf("zone error (%s): %s", e.Severity, e.Message)
|
||||
}
|
||||
3
providers/dns/zz_gen_dns_providers.go
generated
3
providers/dns/zz_gen_dns_providers.go
generated
|
|
@ -68,6 +68,7 @@ import (
|
|||
"github.com/go-acme/lego/v4/providers/dns/edgeone"
|
||||
"github.com/go-acme/lego/v4/providers/dns/efficientip"
|
||||
"github.com/go-acme/lego/v4/providers/dns/epik"
|
||||
"github.com/go-acme/lego/v4/providers/dns/eurodns"
|
||||
"github.com/go-acme/lego/v4/providers/dns/exec"
|
||||
"github.com/go-acme/lego/v4/providers/dns/exoscale"
|
||||
"github.com/go-acme/lego/v4/providers/dns/f5xc"
|
||||
|
|
@ -324,6 +325,8 @@ func NewDNSChallengeProviderByName(name string) (challenge.Provider, error) {
|
|||
return efficientip.NewDNSProvider()
|
||||
case "epik":
|
||||
return epik.NewDNSProvider()
|
||||
case "eurodns":
|
||||
return eurodns.NewDNSProvider()
|
||||
case "exec":
|
||||
return exec.NewDNSProvider()
|
||||
case "exoscale":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue