Update lego

This commit is contained in:
Daniel Becker
2019-08-05 18:08:04 +02:00
committed by Traefiker Bot
parent 0a89cccdc0
commit 73e0561610
782 changed files with 113827 additions and 17222 deletions

View File

@@ -117,15 +117,19 @@ func GetIsLocked(c gotransip.Client, domainName string) (bool, error) {
return v, err
}
// Register registers a domain name and will automatically create and sign a proposition for it
func Register(c gotransip.Client, domain Domain) error {
// Register registers a domain name and will automatically create and sign a
// proposition for it. It returns the TransIP proposition number or an error
// when registering the domain fails
func Register(c gotransip.Client, domain Domain) (string, error) {
sr := gotransip.SoapRequest{
Service: serviceName,
Method: "register",
}
sr.AddArgument("domain", domain)
return c.Call(sr, nil)
var v string
err := c.Call(sr, &v)
return v, err
}
// Cancel cancels a domain name, will automatically create and sign a cancellation document
@@ -140,8 +144,9 @@ func Cancel(c gotransip.Client, domainName string, endTime gotransip.Cancellatio
return c.Call(sr, nil)
}
// TransferWithOwnerChange transfers a domain with changing the owner
func TransferWithOwnerChange(c gotransip.Client, domain, authCode string) error {
// TransferWithOwnerChange transfers a domain with changing the owner. It returns
// the TransIP proposition number or an error when transferring the domain fails
func TransferWithOwnerChange(c gotransip.Client, domain, authCode string) (string, error) {
sr := gotransip.SoapRequest{
Service: serviceName,
Method: "transferWithOwnerChange",
@@ -149,11 +154,15 @@ func TransferWithOwnerChange(c gotransip.Client, domain, authCode string) error
sr.AddArgument("domain", domain)
sr.AddArgument("authCode", authCode)
return c.Call(sr, nil)
var v string
err := c.Call(sr, &v)
return v, err
}
// TransferWithoutOwnerChange transfers a domain without changing the owner
func TransferWithoutOwnerChange(c gotransip.Client, domain, authCode string) error {
// TransferWithoutOwnerChange transfers a domain without changing the owner. It
// returns the TransIP proposition number or an error when transferring the domain
// fails
func TransferWithoutOwnerChange(c gotransip.Client, domain, authCode string) (string, error) {
sr := gotransip.SoapRequest{
Service: serviceName,
Method: "transferWithoutOwnerChange",
@@ -161,7 +170,9 @@ func TransferWithoutOwnerChange(c gotransip.Client, domain, authCode string) err
sr.AddArgument("domain", domain)
sr.AddArgument("authCode", authCode)
return c.Call(sr, nil)
var v string
err := c.Call(sr, &v)
return v, err
}
// SetNameservers starts a nameserver change for this domain, will replace all
@@ -203,7 +214,7 @@ func UnsetLock(c gotransip.Client, domainName string) error {
// dns entries with the new entries
func SetDNSEntries(c gotransip.Client, domainName string, dnsEntries DNSEntries) error {
sr := gotransip.SoapRequest{
Service: serviceName,
Service: dnsServiceName,
Method: "setDnsEntries",
}
sr.AddArgument("domainName", domainName)
@@ -312,3 +323,81 @@ func CancelDomainAction(c gotransip.Client, domain string) error {
return c.Call(sr, nil)
}
// RequestAuthCode requests the authcode at the registry
func RequestAuthCode(c gotransip.Client, domainName string) (string, error) {
sr := gotransip.SoapRequest{
Service: serviceName,
Method: "requestAuthCode",
}
sr.AddArgument("domain", domainName)
var v string
err := c.Call(sr, &v)
return v, err
}
// Handover a Domain to another TransIP User. Please be aware that this will NOT
// change the owner contact information at the registry. If you want to change
// the domain owner at the registry, then you should execute a 'SetOwner'.
func Handover(c gotransip.Client, domainName, targetAccountName string) error {
sr := gotransip.SoapRequest{
Service: serviceName,
Method: "handover",
}
sr.AddArgument("domainName", domainName)
sr.AddArgument("targetAccountname", targetAccountName)
return c.Call(sr, nil)
}
// CanEditDNSSec checks if the DNSSec entries of a domain can be updated.
func CanEditDNSSec(c gotransip.Client, domainName string) (bool, error) {
sr := gotransip.SoapRequest{
Service: dnsServiceName,
Method: "canEditDnsSec",
}
sr.AddArgument("domainName", domainName)
var v bool
err := c.Call(sr, &v)
return v, err
}
// GetDNSSecEntries returns DNSSec entries for given domain name
func GetDNSSecEntries(c gotransip.Client, domainName string) (DNSSecEntries, error) {
sr := gotransip.SoapRequest{
Service: dnsServiceName,
Method: "getDnsSecEntries",
}
sr.AddArgument("domainName", domainName)
var v struct {
V DNSSecEntries `xml:"item"`
}
err := c.Call(sr, &v)
return v.V, err
}
// SetDNSSecEntries sets new DNSSec entries for a domain, replacing the current ones.
func SetDNSSecEntries(c gotransip.Client, domainName string, dnssecKeyEntrySet DNSSecEntries) error {
sr := gotransip.SoapRequest{
Service: dnsServiceName,
Method: "setDnsSecEntries",
}
sr.AddArgument("domainName", domainName)
sr.AddArgument("dnssecKeyEntrySet", dnssecKeyEntrySet)
return c.Call(sr, nil)
}
// RemoveAllDNSSecEntries removes all the DNSSec entries from a domain.
func RemoveAllDNSSecEntries(c gotransip.Client, domainName string) error {
sr := gotransip.SoapRequest{
Service: dnsServiceName,
Method: "removeAllDnsSecEntries",
}
sr.AddArgument("domainName", domainName)
return c.Call(sr, nil)
}

View File

@@ -9,7 +9,8 @@ import (
)
const (
serviceName string = "DomainService"
serviceName string = "DomainService"
dnsServiceName string = "DnsService"
)
// Domain represents a Transip_Domain object
@@ -240,6 +241,98 @@ func (d DNSEntries) EncodeArgs(key string) string {
return fmt.Sprintf("%s</%s>", output, key)
}
// DNSSecAlgorithm represents the possible types of DNSSec algorithms
type DNSSecAlgorithm int
const (
// DNSSecAlgorithmDSA represents DSA
DNSSecAlgorithmDSA DNSSecAlgorithm = iota + 3
_
// DNSSecAlgorithmRSASHA1 represents RSASHA1
DNSSecAlgorithmRSASHA1
// DNSSecAlgorithmDSANSEC3SHA1 represents DSANSEC3SHA1
DNSSecAlgorithmDSANSEC3SHA1
// DNSSecAlgorithmRSASHA1NSEC3SHA1 represents RSASHA1NSEC3SHA1
DNSSecAlgorithmRSASHA1NSEC3SHA1
// DNSSecAlgorithmRSASHA256 represents RSASHA256
DNSSecAlgorithmRSASHA256
// DNSSecAlgorithmRSASHA512 represents RSASHA512
DNSSecAlgorithmRSASHA512 DNSSecAlgorithm = iota + 4
_
// DNSSecAlgorithmECCGOST represents ECCGOST
DNSSecAlgorithmECCGOST
// DNSSecAlgorithmECDSAP256SHA256 represents ECDSAP256SHA256
DNSSecAlgorithmECDSAP256SHA256
// DNSSecAlgorithmECDSAP384SHA384 represents ECDSAP384SHA384
DNSSecAlgorithmECDSAP384SHA384
// DNSSecAlgorithmED25519 represents ED25519
DNSSecAlgorithmED25519
// DNSSecAlgorithmED448 represents ED448
DNSSecAlgorithmED448
)
// DNSSecFlag represents the possible types of DNSSec flags
type DNSSecFlag int
const (
// DNSSecFlagNone means no flag is set
DNSSecFlagNone DNSSecFlag = 0
// DNSSecFlagZSK means this is a Zone Signing Key
DNSSecFlagZSK DNSSecFlag = 256
// DNSSecFlagKSK means this is a Key Signing Key
DNSSecFlagKSK DNSSecFlag = 257
)
// DNSSecEntry represents a Transip_DnsSecEntry object as described at
// https://api.transip.nl/docs/transip.nl/class-Transip_DnsSecEntry.html
type DNSSecEntry struct {
KeyTag int `xml:"keyTag"`
Flags DNSSecFlag `xml:"flags"`
Algorithm DNSSecAlgorithm `xml:"algorithm"`
PublicKey string `xml:"publicKey"`
}
// DNSSecEntries is just an array of DNSSecEntry
// basically only here so it can implement paramsEncoder
type DNSSecEntries []DNSSecEntry
// EncodeParams returns DNSSecEntries parameters ready to be used for constructing
// a signature
// the order of parameters added here has to match the order in the WSDL as
// described at http://api.transip.nl/wsdl/?service=DnsService
func (d DNSSecEntries) EncodeParams(prm gotransip.ParamsContainer, prefix string) {
if len(d) == 0 {
prm.Add("anything", nil)
return
}
if len(prefix) == 0 {
prefix = fmt.Sprintf("%d", prm.Len())
}
for i, e := range d {
prm.Add(fmt.Sprintf("%s[%d][keyTag]", prefix, i), fmt.Sprintf("%d", e.KeyTag))
prm.Add(fmt.Sprintf("%s[%d][flags]", prefix, i), fmt.Sprintf("%d", e.Flags))
prm.Add(fmt.Sprintf("%s[%d][algorithm]", prefix, i), fmt.Sprintf("%d", e.Algorithm))
prm.Add(fmt.Sprintf("%s[%d][publicKey]", prefix, i), e.PublicKey)
}
}
// EncodeArgs returns Entries XML body ready to be passed in the SOAP call
func (d DNSSecEntries) EncodeArgs(key string) string {
output := fmt.Sprintf(`<%s SOAP-ENC:arrayType="ns1:DnsSecEntry[%d]" xsi:type="ns1:ArrayOfDnsSecEntry">`, key, len(d)) + "\n"
for _, e := range d {
output += fmt.Sprintf(` <item xsi:type="ns1:DnsSecEntry">
<keyTag xsi:type="xsd:int">%d</keyTag>
<flags xsi:type="xsd:int">%d</flags>
<algorithm xsi:type="xsd:int">%d</algorithm>
<publicKey xsi:type="xsd:string">%s</publicKey>
</item>`, e.KeyTag, e.Flags, e.Algorithm, e.PublicKey) + "\n"
}
return fmt.Sprintf("%s</%s>", output, key)
}
// Status reflects the current status of a domain in a check result
type Status string
@@ -298,14 +391,14 @@ func (b Branding) EncodeParams(prm gotransip.ParamsContainer, prefix string) {
// EncodeArgs returns Branding XML body ready to be passed in the SOAP call
func (b Branding) EncodeArgs(key string) string {
return fmt.Sprintf(`<branding xsi:type="ns1:DomainBranding">
<companyName xsi:type="xsd:string">%s</companyName>
<supportEmail xsi:type="xsd:string">%s</supportEmail>
<companyUrl xsi:type="xsd:string">%s</companyUrl>
<termsOfUsageUrl xsi:type="xsd:string">%s</termsOfUsageUrl>
<bannerLine1 xsi:type="xsd:string">%s</bannerLine1>
<bannerLine2 xsi:type="xsd:string">%s</bannerLine2>
<bannerLine3 xsi:type="xsd:string">%s</bannerLine3>
</branding>`, b.CompanyName, b.SupportEmail, b.CompanyURL, b.TermsOfUsageURL, b.BannerLine1, b.BannerLine2, b.BannerLine3)
<companyName xsi:type="xsd:string">%s</companyName>
<supportEmail xsi:type="xsd:string">%s</supportEmail>
<companyUrl xsi:type="xsd:string">%s</companyUrl>
<termsOfUsageUrl xsi:type="xsd:string">%s</termsOfUsageUrl>
<bannerLine1 xsi:type="xsd:string">%s</bannerLine1>
<bannerLine2 xsi:type="xsd:string">%s</bannerLine2>
<bannerLine3 xsi:type="xsd:string">%s</bannerLine3>
</branding>`, b.CompanyName, b.SupportEmail, b.CompanyURL, b.TermsOfUsageURL, b.BannerLine1, b.BannerLine2, b.BannerLine3)
}
// Action reflects the available actions to perform on a domain