provider: add Namecheap

This commit is contained in:
nemunaire 2021-07-06 17:49:36 +02:00
parent 633b61bf7e
commit 41ac6759bd
4 changed files with 68 additions and 0 deletions

1
go.sum
View File

@ -77,6 +77,7 @@ github.com/babolivier/go-doh-client v0.0.0-20201028162107-a76cff4cb8b6/go.mod h1
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bhendo/go-powershell v0.0.0-20190719160123-219e7fb4e41e/go.mod h1:f7vw6ObmmNcyFQLhZX9eUGBJGpnwTJFDvVjqZxIxHWY=
github.com/billputer/go-namecheap v0.0.0-20210108011502-994a912fb7f9 h1:2vQTbEJvFsyd1VefzZ34GUkUD6TkJleYYJh9/25WBE4=
github.com/billputer/go-namecheap v0.0.0-20210108011502-994a912fb7f9/go.mod h1:bqqNsI2akL+lLWyApkYY0cxquWPKwEBU0Wd3chi3TEg=
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/boombuler/barcode v1.0.1 h1:NDBbPmhS+EqABEs5Kg3n/5ZNjy73Pz7SIV+KCeqyXcs=

BIN
providers/NamecheapAPI.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

File diff suppressed because one or more lines are too long

65
providers/namecheap.go Normal file
View File

@ -0,0 +1,65 @@
// Copyright or © or Copr. happyDNS (2021)
//
// contact@happydns.org
//
// This software is a computer program whose purpose is to provide a modern
// interface to interact with DNS systems.
//
// This software is governed by the CeCILL license under French law and abiding
// by the rules of distribution of free software. You can use, modify and/or
// redistribute the software under the terms of the CeCILL license as
// circulated by CEA, CNRS and INRIA at the following URL
// "http://www.cecill.info".
//
// As a counterpart to the access to the provider code and rights to copy, modify
// and redistribute granted by the license, users are provided only with a
// limited warranty and the software's author, the holder of the economic
// rights, and the successive licensors have only limited liability.
//
// In this respect, the user's attention is drawn to the risks associated with
// loading, using, modifying and/or developing or reproducing the software by
// the user in light of its specific status of free software, that may mean
// that it is complicated to manipulate, and that also therefore means that it
// is reserved for developers and experienced professionals having in-depth
// computer knowledge. Users are therefore encouraged to load and test the
// software's suitability as regards their requirements in conditions enabling
// the security of their systems and/or data to be ensured and, more generally,
// to use and operate it in the same conditions as regards security.
//
// The fact that you are presently reading this means that you have had
// knowledge of the CeCILL license and that you accept its terms.
package providers // import "happydns.org/providers"
import (
"github.com/StackExchange/dnscontrol/v3/providers"
_ "github.com/StackExchange/dnscontrol/v3/providers/namecheap"
"git.happydns.org/happydns/model"
)
type NamecheapAPI struct {
APIKey string `json:"apikey,omitempty" happydns:"label=API Key,placeholder=yourApiKeyFromNameCheap,required"`
APIUser string `json:"apiuser,omitempty" happydns:"label=API User,placeholder=yourUsername,required"`
}
func (s *NamecheapAPI) NewDNSServiceProvider() (providers.DNSServiceProvider, error) {
config := map[string]string{
"apikey": s.APIKey,
"apiuser": s.APIUser,
}
return providers.CreateDNSProvider(s.DNSControlName(), config, nil)
}
func (s *NamecheapAPI) DNSControlName() string {
return "NAMECHEAP"
}
func init() {
RegisterProvider(func() happydns.Provider {
return &NamecheapAPI{}
}, ProviderInfos{
Name: "Namecheap",
Description: "American domain name registrar.",
})
}