mirror of
https://github.com/go-acme/lego
synced 2026-03-14 14:35:48 +01:00
Add DNS provider for Binary Lane (#2624)
This commit is contained in:
parent
8a11af149f
commit
50a24ced37
14 changed files with 737 additions and 38 deletions
74
README.md
74
README.md
|
|
@ -70,188 +70,188 @@ Detailed documentation is available [here](https://go-acme.github.io/lego/dns).
|
|||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/azuredns/">Azure DNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/baiducloud/">Baidu Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/binarylane/">Binary Lane</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/bindman/">Bindman</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/bluecat/">Bluecat</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/bluecat/">Bluecat</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/bookmyname/">BookMyName</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/brandit/">Brandit (deprecated)</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/bunny/">Bunny</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/checkdomain/">Checkdomain</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/checkdomain/">Checkdomain</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/civo/">Civo</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/cloudru/">Cloud.ru</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/clouddns/">CloudDNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/cloudflare/">Cloudflare</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/cloudflare/">Cloudflare</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/cloudns/">ClouDNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/cloudxns/">CloudXNS (Deprecated)</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/conoha/">ConoHa v2</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/conohav3/">ConoHa v3</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/conohav3/">ConoHa v3</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/constellix/">Constellix</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/corenetworks/">Core-Networks</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/cpanel/">CPanel/WHM</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/derak/">Derak Cloud</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/derak/">Derak Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/desec/">deSEC.io</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/designate/">Designate DNSaaS for Openstack</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/digitalocean/">Digital Ocean</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/directadmin/">DirectAdmin</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/directadmin/">DirectAdmin</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/dnsmadeeasy/">DNS Made Easy</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/dnshomede/">dnsHome.de</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/dnsimple/">DNSimple</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/dnspod/">DNSPod (deprecated)</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/dnspod/">DNSPod (deprecated)</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/dode/">Domain Offensive (do.de)</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/domeneshop/">Domeneshop</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/dreamhost/">DreamHost</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/duckdns/">Duck DNS</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/duckdns/">Duck DNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/dyn/">Dyn</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/dyndnsfree/">DynDnsFree.de</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/dynu/">Dynu</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/easydns/">EasyDNS</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/easydns/">EasyDNS</a></td>
|
||||
<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/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/gcore/">G-Core</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/gandi/">Gandi</a></td>
|
||||
</tr><tr>
|
||||
<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/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>
|
||||
</tr><tr>
|
||||
<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/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/hosttech/">Hosttech</a></td>
|
||||
</tr><tr>
|
||||
<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>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/hurricane/">Hurricane Electric DNS</a></td>
|
||||
</tr><tr>
|
||||
<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>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/infoblox/">Infoblox</a></td>
|
||||
</tr><tr>
|
||||
<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>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/inwx/">INWX</a></td>
|
||||
</tr><tr>
|
||||
<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/ipv64/">IPv64</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/iwantmyname/">iwantmyname</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/joker/">Joker</a></td>
|
||||
</tr><tr>
|
||||
<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/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>
|
||||
</tr><tr>
|
||||
<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>
|
||||
<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>
|
||||
</tr><tr>
|
||||
<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>
|
||||
<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>
|
||||
</tr><tr>
|
||||
<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>
|
||||
<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>
|
||||
</tr><tr>
|
||||
<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>
|
||||
<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>
|
||||
</tr><tr>
|
||||
<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>
|
||||
<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/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>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/plesk/">plesk.com</a></td>
|
||||
</tr><tr>
|
||||
<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>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/rainyun/">Rain Yun/雨云</a></td>
|
||||
</tr><tr>
|
||||
<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>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/rfc2136/">RFC2136</a></td>
|
||||
</tr><tr>
|
||||
<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>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/scaleway/">Scaleway</a></td>
|
||||
</tr><tr>
|
||||
<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>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/servercow/">Servercow</a></td>
|
||||
</tr><tr>
|
||||
<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>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/spaceship/">Spaceship</a></td>
|
||||
</tr><tr>
|
||||
<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/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>
|
||||
</tr><tr>
|
||||
<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/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>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ultradns/">Ultradns</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/vkcloud/">VK Cloud</a></td>
|
||||
<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>
|
||||
</tr><tr>
|
||||
<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/webnames/">Webnames</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>
|
||||
</tr><tr>
|
||||
<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>
|
||||
<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>
|
||||
</tr><tr>
|
||||
<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>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/zonomi/">Zonomi</a></td>
|
||||
<td></td>
|
||||
</tr></table>
|
||||
|
||||
<!-- END DNS PROVIDERS LIST -->
|
||||
|
|
|
|||
21
cmd/zz_gen_cmd_dnshelp.go
generated
21
cmd/zz_gen_cmd_dnshelp.go
generated
|
|
@ -25,6 +25,7 @@ func allDNSCodes() string {
|
|||
"azure",
|
||||
"azuredns",
|
||||
"baiducloud",
|
||||
"binarylane",
|
||||
"bindman",
|
||||
"bluecat",
|
||||
"bookmyname",
|
||||
|
|
@ -448,6 +449,26 @@ func displayDNSHelp(w io.Writer, name string) error {
|
|||
ew.writeln()
|
||||
ew.writeln(`More information: https://go-acme.github.io/lego/dns/baiducloud`)
|
||||
|
||||
case "binarylane":
|
||||
// generated from: providers/dns/binarylane/binarylane.toml
|
||||
ew.writeln(`Configuration for Binary Lane.`)
|
||||
ew.writeln(`Code: 'binarylane'`)
|
||||
ew.writeln(`Since: 'v4.26.0'`)
|
||||
ew.writeln()
|
||||
|
||||
ew.writeln(`Credentials:`)
|
||||
ew.writeln(` - "BINARYLANE_API_TOKEN": API token`)
|
||||
ew.writeln()
|
||||
|
||||
ew.writeln(`Additional Configuration:`)
|
||||
ew.writeln(` - "BINARYLANE_HTTP_TIMEOUT": API request timeout in seconds (Default: 30)`)
|
||||
ew.writeln(` - "BINARYLANE_POLLING_INTERVAL": Time between DNS propagation check in seconds (Default: 2)`)
|
||||
ew.writeln(` - "BINARYLANE_PROPAGATION_TIMEOUT": Maximum waiting time for DNS propagation in seconds (Default: 60)`)
|
||||
ew.writeln(` - "BINARYLANE_TTL": The TTL of the TXT record used for the DNS challenge in seconds (Default: 120)`)
|
||||
|
||||
ew.writeln()
|
||||
ew.writeln(`More information: https://go-acme.github.io/lego/dns/binarylane`)
|
||||
|
||||
case "bindman":
|
||||
// generated from: providers/dns/bindman/bindman.toml
|
||||
ew.writeln(`Configuration for Bindman.`)
|
||||
|
|
|
|||
67
docs/content/dns/zz_gen_binarylane.md
generated
Normal file
67
docs/content/dns/zz_gen_binarylane.md
generated
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
---
|
||||
title: "Binary Lane"
|
||||
date: 2019-03-03T16:39:46+01:00
|
||||
draft: false
|
||||
slug: binarylane
|
||||
dnsprovider:
|
||||
since: "v4.26.0"
|
||||
code: "binarylane"
|
||||
url: "https://www.binarylane.com.au/"
|
||||
---
|
||||
|
||||
<!-- THIS DOCUMENTATION IS AUTO-GENERATED. PLEASE DO NOT EDIT. -->
|
||||
<!-- providers/dns/binarylane/binarylane.toml -->
|
||||
<!-- THIS DOCUMENTATION IS AUTO-GENERATED. PLEASE DO NOT EDIT. -->
|
||||
|
||||
|
||||
Configuration for [Binary Lane](https://www.binarylane.com.au/).
|
||||
|
||||
|
||||
<!--more-->
|
||||
|
||||
- Code: `binarylane`
|
||||
- Since: v4.26.0
|
||||
|
||||
|
||||
Here is an example bash command using the Binary Lane provider:
|
||||
|
||||
```bash
|
||||
BINARYLANE_API_TOKEN="xxxxxxxxxxxxxxxxxxxxx" \
|
||||
lego --email you@example.com --dns binarylane -d '*.example.com' -d example.com run
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
## Credentials
|
||||
|
||||
| Environment Variable Name | Description |
|
||||
|-----------------------|-------------|
|
||||
| `BINARYLANE_API_TOKEN` | API token |
|
||||
|
||||
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 |
|
||||
|--------------------------------|-------------|
|
||||
| `BINARYLANE_HTTP_TIMEOUT` | API request timeout in seconds (Default: 30) |
|
||||
| `BINARYLANE_POLLING_INTERVAL` | Time between DNS propagation check in seconds (Default: 2) |
|
||||
| `BINARYLANE_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation in seconds (Default: 60) |
|
||||
| `BINARYLANE_TTL` | The TTL of the TXT record used for the DNS challenge in seconds (Default: 120) |
|
||||
|
||||
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://api.binarylane.com.au/reference/#tag/Domains)
|
||||
|
||||
<!-- THIS DOCUMENTATION IS AUTO-GENERATED. PLEASE DO NOT EDIT. -->
|
||||
<!-- providers/dns/binarylane/binarylane.toml -->
|
||||
<!-- THIS DOCUMENTATION IS AUTO-GENERATED. PLEASE DO NOT EDIT. -->
|
||||
|
|
@ -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, allinkl, arvancloud, auroradns, autodns, axelname, azion, azure, azuredns, baiducloud, bindman, bluecat, bookmyname, brandit, bunny, checkdomain, civo, clouddns, cloudflare, cloudns, cloudru, cloudxns, conoha, conohav3, constellix, corenetworks, cpanel, derak, desec, designate, digitalocean, directadmin, dnshomede, dnsimple, dnsmadeeasy, dnspod, dode, domeneshop, dreamhost, duckdns, dyn, dyndnsfree, dynu, easydns, edgedns, edgeone, efficientip, epik, exec, exoscale, f5xc, freemyip, gandi, gandiv5, gcloud, gcore, glesys, godaddy, googledomains, hetzner, hostingde, hosttech, httpnet, httpreq, huaweicloud, hurricane, hyperone, ibmcloud, iij, iijdpf, infoblox, infomaniak, internetbs, inwx, ionos, ipv64, iwantmyname, joker, liara, lightsail, limacity, linode, liquidweb, loopia, luadns, mailinabox, manageengine, manual, metaname, metaregistrar, mijnhost, mittwald, myaddr, mydnsjp, mythicbeasts, namecheap, namedotcom, namesilo, nearlyfreespeech, netcup, netlify, nicmanager, nicru, nifcloud, njalla, nodion, ns1, 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, technitium, tencentcloud, timewebcloud, transip, ultradns, variomedia, vegadns, vercel, versio, vinyldns, vkcloud, volcengine, vscale, vultr, webnames, websupport, wedos, westcn, yandex, yandex360, yandexcloud, zoneedit, zoneee, zonomi
|
||||
acme-dns, active24, alidns, allinkl, arvancloud, auroradns, autodns, axelname, azion, azure, azuredns, baiducloud, binarylane, bindman, bluecat, bookmyname, brandit, bunny, checkdomain, civo, clouddns, cloudflare, cloudns, cloudru, cloudxns, conoha, conohav3, constellix, corenetworks, cpanel, derak, desec, designate, digitalocean, directadmin, dnshomede, dnsimple, dnsmadeeasy, dnspod, dode, domeneshop, dreamhost, duckdns, dyn, dyndnsfree, dynu, easydns, edgedns, edgeone, efficientip, epik, exec, exoscale, f5xc, freemyip, gandi, gandiv5, gcloud, gcore, glesys, godaddy, googledomains, hetzner, hostingde, hosttech, httpnet, httpreq, huaweicloud, hurricane, hyperone, ibmcloud, iij, iijdpf, infoblox, infomaniak, internetbs, inwx, ionos, ipv64, iwantmyname, joker, liara, lightsail, limacity, linode, liquidweb, loopia, luadns, mailinabox, manageengine, manual, metaname, metaregistrar, mijnhost, mittwald, myaddr, mydnsjp, mythicbeasts, namecheap, namedotcom, namesilo, nearlyfreespeech, netcup, netlify, nicmanager, nicru, nifcloud, njalla, nodion, ns1, 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, technitium, tencentcloud, timewebcloud, transip, ultradns, variomedia, vegadns, vercel, versio, vinyldns, vkcloud, volcengine, vscale, vultr, webnames, websupport, wedos, westcn, yandex, yandex360, yandexcloud, zoneedit, zoneee, zonomi
|
||||
|
||||
More information: https://go-acme.github.io/lego/dns
|
||||
"""
|
||||
|
|
|
|||
157
providers/dns/binarylane/binarylane.go
Normal file
157
providers/dns/binarylane/binarylane.go
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
// Package binarylane implements a DNS provider for solving the DNS-01 challenge using Binary Lane.
|
||||
package binarylane
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"sync"
|
||||
"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/binarylane/internal"
|
||||
)
|
||||
|
||||
// Environment variables names.
|
||||
const (
|
||||
envNamespace = "BINARYLANE_"
|
||||
|
||||
EnvAPIToken = envNamespace + "API_TOKEN"
|
||||
|
||||
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 {
|
||||
APIToken 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, 3600),
|
||||
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
|
||||
|
||||
recordIDs map[string]int64
|
||||
recordIDsMu sync.Mutex
|
||||
}
|
||||
|
||||
// NewDNSProvider returns a DNSProvider instance configured for Binary Lane.
|
||||
func NewDNSProvider() (*DNSProvider, error) {
|
||||
values, err := env.Get(EnvAPIToken)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("binarylane: %w", err)
|
||||
}
|
||||
|
||||
config := NewDefaultConfig()
|
||||
config.APIToken = values[EnvAPIToken]
|
||||
|
||||
return NewDNSProviderConfig(config)
|
||||
}
|
||||
|
||||
// NewDNSProviderConfig return a DNSProvider instance configured for Binary Lane.
|
||||
func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
|
||||
if config == nil {
|
||||
return nil, errors.New("binarylane: the configuration of the DNS provider is nil")
|
||||
}
|
||||
|
||||
client, err := internal.NewClient(config.APIToken)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("binarylane: %w", err)
|
||||
}
|
||||
|
||||
if config.HTTPClient != nil {
|
||||
client.HTTPClient = config.HTTPClient
|
||||
}
|
||||
|
||||
return &DNSProvider{
|
||||
config: config,
|
||||
client: client,
|
||||
recordIDs: make(map[string]int64),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Present creates a TXT record using the specified parameters.
|
||||
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
||||
info := dns01.GetChallengeInfo(domain, keyAuth)
|
||||
|
||||
authZone, err := dns01.FindZoneByFqdn(info.EffectiveFQDN)
|
||||
if err != nil {
|
||||
return fmt.Errorf("binarylane: could not find zone for domain %q: %w", domain, err)
|
||||
}
|
||||
|
||||
subDomain, err := dns01.ExtractSubDomain(info.EffectiveFQDN, authZone)
|
||||
if err != nil {
|
||||
return fmt.Errorf("binarylane: %w", err)
|
||||
}
|
||||
|
||||
record := internal.Record{
|
||||
Type: "TXT",
|
||||
Name: subDomain,
|
||||
Data: info.Value,
|
||||
TTL: d.config.TTL,
|
||||
}
|
||||
|
||||
response, err := d.client.CreateRecord(context.Background(), dns01.UnFqdn(authZone), record)
|
||||
if err != nil {
|
||||
return fmt.Errorf("binarylane: create record: %w", err)
|
||||
}
|
||||
|
||||
d.recordIDsMu.Lock()
|
||||
d.recordIDs[token] = response.ID
|
||||
d.recordIDsMu.Unlock()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// CleanUp removes the TXT record matching the specified parameters.
|
||||
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
||||
info := dns01.GetChallengeInfo(domain, keyAuth)
|
||||
|
||||
authZone, err := dns01.FindZoneByFqdn(info.EffectiveFQDN)
|
||||
if err != nil {
|
||||
return fmt.Errorf("binarylane: could not find zone for domain %q: %w", domain, err)
|
||||
}
|
||||
|
||||
// get the record's unique ID from when we created it
|
||||
d.recordIDsMu.Lock()
|
||||
recordID, ok := d.recordIDs[token]
|
||||
d.recordIDsMu.Unlock()
|
||||
if !ok {
|
||||
return fmt.Errorf("binarylane: unknown record ID for '%s'", info.EffectiveFQDN)
|
||||
}
|
||||
|
||||
err = d.client.DeleteRecord(context.Background(), dns01.UnFqdn(authZone), recordID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("binarylane: delete record: %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
|
||||
}
|
||||
22
providers/dns/binarylane/binarylane.toml
Normal file
22
providers/dns/binarylane/binarylane.toml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Name = "Binary Lane"
|
||||
Description = ''''''
|
||||
URL = "https://www.binarylane.com.au/"
|
||||
Code = "binarylane"
|
||||
Since = "v4.26.0"
|
||||
|
||||
Example = '''
|
||||
BINARYLANE_API_TOKEN="xxxxxxxxxxxxxxxxxxxxx" \
|
||||
lego --email you@example.com --dns binarylane -d '*.example.com' -d example.com run
|
||||
'''
|
||||
|
||||
[Configuration]
|
||||
[Configuration.Credentials]
|
||||
BINARYLANE_API_TOKEN = "API token"
|
||||
[Configuration.Additional]
|
||||
BINARYLANE_POLLING_INTERVAL = "Time between DNS propagation check in seconds (Default: 2)"
|
||||
BINARYLANE_PROPAGATION_TIMEOUT = "Maximum waiting time for DNS propagation in seconds (Default: 60)"
|
||||
BINARYLANE_TTL = "The TTL of the TXT record used for the DNS challenge in seconds (Default: 120)"
|
||||
BINARYLANE_HTTP_TIMEOUT = "API request timeout in seconds (Default: 30)"
|
||||
|
||||
[Links]
|
||||
API = "https://api.binarylane.com.au/reference/#tag/Domains"
|
||||
115
providers/dns/binarylane/binarylane_test.go
Normal file
115
providers/dns/binarylane/binarylane_test.go
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
package binarylane
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/go-acme/lego/v4/platform/tester"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const envDomain = envNamespace + "DOMAIN"
|
||||
|
||||
var envTest = tester.NewEnvTest(EnvAPIToken).WithDomain(envDomain)
|
||||
|
||||
func TestNewDNSProvider(t *testing.T) {
|
||||
testCases := []struct {
|
||||
desc string
|
||||
envVars map[string]string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
desc: "success",
|
||||
envVars: map[string]string{
|
||||
EnvAPIToken: "secret",
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "missing API token",
|
||||
envVars: map[string]string{
|
||||
EnvAPIToken: "",
|
||||
},
|
||||
expected: "binarylane: some credentials information are missing: BINARYLANE_API_TOKEN",
|
||||
},
|
||||
}
|
||||
|
||||
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
|
||||
apiToken string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
desc: "success",
|
||||
apiToken: "secret",
|
||||
},
|
||||
{
|
||||
desc: "missing API token",
|
||||
expected: "binarylane: credentials missing",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
config := NewDefaultConfig()
|
||||
config.APIToken = test.apiToken
|
||||
|
||||
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)
|
||||
}
|
||||
146
providers/dns/binarylane/internal/client.go
Normal file
146
providers/dns/binarylane/internal/client.go
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
package internal
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/go-acme/lego/v4/providers/dns/internal/errutils"
|
||||
)
|
||||
|
||||
const defaultBaseURL = "https://api.binarylane.com.au/v2/"
|
||||
|
||||
const authorizationHeader = "Authorization"
|
||||
|
||||
// Client the Binary Lane API client.
|
||||
type Client struct {
|
||||
apiToken string
|
||||
|
||||
baseURL *url.URL
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// NewClient creates a new Client.
|
||||
func NewClient(apiToken string) (*Client, error) {
|
||||
if apiToken == "" {
|
||||
return nil, errors.New("credentials missing")
|
||||
}
|
||||
|
||||
baseURL, _ := url.Parse(defaultBaseURL)
|
||||
|
||||
return &Client{
|
||||
apiToken: apiToken,
|
||||
baseURL: baseURL,
|
||||
HTTPClient: &http.Client{Timeout: 10 * time.Second},
|
||||
}, nil
|
||||
}
|
||||
|
||||
// CreateRecord Creates a new domain record.
|
||||
// https://api.binarylane.com.au/reference/#tag/Domains/paths/~1v2~1domains~1%7Bdomain_name%7D~1records/post
|
||||
func (c *Client) CreateRecord(ctx context.Context, domain string, record Record) (*Record, error) {
|
||||
endpoint := c.baseURL.JoinPath("domains", domain, "records")
|
||||
|
||||
if record.Name == "" {
|
||||
record.Name = "@"
|
||||
}
|
||||
|
||||
req, err := newJSONRequest(ctx, http.MethodPost, endpoint, record)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var result APIResponse
|
||||
err = c.do(req, &result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result.DomainRecord, nil
|
||||
}
|
||||
|
||||
// DeleteRecord Deletes an existing domain record.
|
||||
// https://api.binarylane.com.au/reference/#tag/Domains/paths/~1v2~1domains~1%7Bdomain_name%7D~1records~1%7Brecord_id%7D/delete
|
||||
func (c *Client) DeleteRecord(ctx context.Context, domainName string, recordID int64) error {
|
||||
endpoint := c.baseURL.JoinPath("domains", domainName, "records", strconv.FormatInt(recordID, 10))
|
||||
|
||||
req, err := newJSONRequest(ctx, http.MethodDelete, endpoint, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return c.do(req, nil)
|
||||
}
|
||||
|
||||
func (c *Client) do(req *http.Request, result any) error {
|
||||
req.Header.Set(authorizationHeader, "Bearer "+c.apiToken)
|
||||
|
||||
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 &errAPI
|
||||
}
|
||||
97
providers/dns/binarylane/internal/client_test.go
Normal file
97
providers/dns/binarylane/internal/client_test.go
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
package internal
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"github.com/go-acme/lego/v4/platform/tester/servermock"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func mockBuilder() *servermock.Builder[*Client] {
|
||||
return servermock.NewBuilder(
|
||||
func(server *httptest.Server) (*Client, error) {
|
||||
client, err := NewClient("secret")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
client.baseURL, _ = url.Parse(server.URL)
|
||||
client.HTTPClient = server.Client()
|
||||
|
||||
return client, nil
|
||||
},
|
||||
servermock.CheckHeader().WithJSONHeaders().
|
||||
WithAuthorization("Bearer secret"),
|
||||
)
|
||||
}
|
||||
|
||||
func TestClient_CreateRecord(t *testing.T) {
|
||||
client := mockBuilder().
|
||||
Route("POST /domains/example.com/records",
|
||||
servermock.ResponseFromFixture("create_record.json"),
|
||||
servermock.CheckRequestJSONBodyFromFixture("create_record-request.json")).
|
||||
Build(t)
|
||||
|
||||
record := Record{
|
||||
Type: "TXT",
|
||||
Name: "foo",
|
||||
Data: "txtTXTtxt",
|
||||
TTL: 300,
|
||||
}
|
||||
|
||||
rec, err := client.CreateRecord(t.Context(), "example.com", record)
|
||||
require.NoError(t, err)
|
||||
|
||||
expected := &Record{
|
||||
ID: 123,
|
||||
Type: "TXT",
|
||||
Name: "foo",
|
||||
Data: "txtTXTtxt",
|
||||
TTL: 300,
|
||||
}
|
||||
|
||||
require.Equal(t, expected, rec)
|
||||
}
|
||||
|
||||
func TestClient_CreateRecord_error(t *testing.T) {
|
||||
client := mockBuilder().
|
||||
Route("POST /domains/example.com/records",
|
||||
servermock.ResponseFromFixture("error.json").
|
||||
WithStatusCode(http.StatusBadRequest)).
|
||||
Build(t)
|
||||
|
||||
record := Record{
|
||||
Type: "TXT",
|
||||
Name: "foo",
|
||||
Data: "txtTXTtxt",
|
||||
TTL: 300,
|
||||
}
|
||||
|
||||
_, err := client.CreateRecord(t.Context(), "example.com", record)
|
||||
require.EqualError(t, err, "400: type: title: detail: instance: property1: a")
|
||||
}
|
||||
|
||||
func TestClient_DeleteRecord(t *testing.T) {
|
||||
client := mockBuilder().
|
||||
Route("DELETE /domains/example.com/records/123",
|
||||
servermock.Noop().
|
||||
WithStatusCode(http.StatusNoContent)).
|
||||
Build(t)
|
||||
|
||||
err := client.DeleteRecord(t.Context(), "example.com", 123)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestClient_DeleteRecord_error(t *testing.T) {
|
||||
client := mockBuilder().
|
||||
Route("DELETE /domains/example.com/records/123",
|
||||
servermock.ResponseFromFixture("error.json").
|
||||
WithStatusCode(http.StatusBadRequest)).
|
||||
Build(t)
|
||||
|
||||
err := client.DeleteRecord(t.Context(), "example.com", 123)
|
||||
require.EqualError(t, err, "400: type: title: detail: instance: property1: a")
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"type": "TXT",
|
||||
"name": "foo",
|
||||
"data": "txtTXTtxt",
|
||||
"ttl": 300
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"domain_record": {
|
||||
"id": 123,
|
||||
"type": "TXT",
|
||||
"name": "foo",
|
||||
"data": "txtTXTtxt",
|
||||
"ttl": 300
|
||||
}
|
||||
}
|
||||
14
providers/dns/binarylane/internal/fixtures/error.json
Normal file
14
providers/dns/binarylane/internal/fixtures/error.json
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"type": "type",
|
||||
"title": "title",
|
||||
"status": 400,
|
||||
"detail": "detail",
|
||||
"instance": "instance",
|
||||
"errors": {
|
||||
"property1": [
|
||||
"a"
|
||||
]
|
||||
},
|
||||
"property1": null,
|
||||
"property2": null
|
||||
}
|
||||
42
providers/dns/binarylane/internal/types.go
Normal file
42
providers/dns/binarylane/internal/types.go
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
package internal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type APIError struct {
|
||||
Type string `json:"type"`
|
||||
Title string `json:"title"`
|
||||
Status int `json:"status"`
|
||||
Detail string `json:"detail"`
|
||||
Instance string `json:"instance"`
|
||||
Errors map[string][]string `json:"errors"`
|
||||
}
|
||||
|
||||
func (a *APIError) Error() string {
|
||||
msg := fmt.Sprintf("%d: %s: %s: %s: %s", a.Status, a.Type, a.Title, a.Detail, a.Instance)
|
||||
|
||||
for s, values := range a.Errors {
|
||||
msg += fmt.Sprintf(": %s: %s", s, strings.Join(values, ", "))
|
||||
}
|
||||
|
||||
return msg
|
||||
}
|
||||
|
||||
type Record struct {
|
||||
ID int64 `json:"id,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Data string `json:"data,omitempty"`
|
||||
Priority int `json:"priority,omitempty"`
|
||||
Port int `json:"port,omitempty"`
|
||||
TTL int `json:"ttl,omitempty"`
|
||||
Weight int `json:"weight,omitempty"`
|
||||
Flags int `json:"flags,omitempty"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
}
|
||||
|
||||
type APIResponse struct {
|
||||
DomainRecord *Record `json:"domain_record"`
|
||||
}
|
||||
3
providers/dns/zz_gen_dns_providers.go
generated
3
providers/dns/zz_gen_dns_providers.go
generated
|
|
@ -19,6 +19,7 @@ import (
|
|||
"github.com/go-acme/lego/v4/providers/dns/azure"
|
||||
"github.com/go-acme/lego/v4/providers/dns/azuredns"
|
||||
"github.com/go-acme/lego/v4/providers/dns/baiducloud"
|
||||
"github.com/go-acme/lego/v4/providers/dns/binarylane"
|
||||
"github.com/go-acme/lego/v4/providers/dns/bindman"
|
||||
"github.com/go-acme/lego/v4/providers/dns/bluecat"
|
||||
"github.com/go-acme/lego/v4/providers/dns/bookmyname"
|
||||
|
|
@ -196,6 +197,8 @@ func NewDNSChallengeProviderByName(name string) (challenge.Provider, error) {
|
|||
return azuredns.NewDNSProvider()
|
||||
case "baiducloud":
|
||||
return baiducloud.NewDNSProvider()
|
||||
case "binarylane":
|
||||
return binarylane.NewDNSProvider()
|
||||
case "bindman":
|
||||
return bindman.NewDNSProvider()
|
||||
case "bluecat":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue