hostingde

package
v0.0.0-...-4f4ac90 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package hostingde implements a DNS provider for solving the DNS-01 challenge using hosting.de.

Index

Constants

View Source
const (
	EnvAPIKey   = envNamespace + "API_KEY"
	EnvZoneName = envNamespace + "ZONE_NAME"

	EnvTTL                = envNamespace + "TTL"
	EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
	EnvPollingInterval    = envNamespace + "POLLING_INTERVAL"
	EnvHTTPTimeout        = envNamespace + "HTTP_TIMEOUT"
)

Environment variables names.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Code          int      `json:"code"`
	ContextObject string   `json:"contextObject"`
	ContextPath   string   `json:"contextPath"`
	Details       []string `json:"details"`
	Text          string   `json:"text"`
	Value         string   `json:"value"`
}

APIError represents an error in an API response. https://www.hosting.de/api/?json#warnings-and-errors

type BaseRequest

type BaseRequest struct {
	AuthToken string `json:"authToken"`
}

BaseRequest Common request struct.

type BaseResponse

type BaseResponse struct {
	Errors   []APIError `json:"errors"`
	Metadata Metadata   `json:"metadata"`
	Warnings []string   `json:"warnings"`
	Status   string     `json:"status"`
}

BaseResponse Common response struct. https://www.hosting.de/api/?json#responses

type Config

type Config struct {
	APIKey             string
	ZoneName           string
	PropagationTimeout time.Duration
	PollingInterval    time.Duration
	TTL                int
	HTTPClient         *http.Client
}

Config is used to configure the creation of the DNSProvider.

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig returns a default configuration for the DNSProvider.

type DNSProvider

type DNSProvider struct {
	// contains filtered or unexported fields
}

DNSProvider implements the challenge.Provider interface.

func NewDNSProvider

func NewDNSProvider() (*DNSProvider, error)

NewDNSProvider returns a DNSProvider instance configured for hosting.de. Credentials must be passed in the environment variables: HOSTINGDE_ZONE_NAME and HOSTINGDE_API_KEY.

func NewDNSProviderConfig

func NewDNSProviderConfig(config *Config) (*DNSProvider, error)

NewDNSProviderConfig return a DNSProvider instance configured for hosting.de.

func (*DNSProvider) CleanUp

func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error

CleanUp removes the TXT record matching the specified parameters.

func (*DNSProvider) Present

func (d *DNSProvider) Present(domain, token, keyAuth string) error

Present creates a TXT record to fulfill the dns-01 challenge.

func (*DNSProvider) Timeout

func (d *DNSProvider) Timeout() (timeout, interval time.Duration)

Timeout returns the timeout and interval to use when checking for DNS propagation. Adjusting here to cope with spikes in propagation times.

type DNSRecord

type DNSRecord struct {
	ID               string `json:"id,omitempty"`
	ZoneID           string `json:"zoneId,omitempty"`
	RecordTemplateID string `json:"recordTemplateId,omitempty"`
	Name             string `json:"name,omitempty"`
	Type             string `json:"type,omitempty"`
	Content          string `json:"content,omitempty"`
	TTL              int    `json:"ttl,omitempty"`
	Priority         int    `json:"priority,omitempty"`
	LastChangeDate   string `json:"lastChangeDate,omitempty"`
}

DNSRecord The DNS Record object is part of a zone. It is used to manage DNS resource records. https://www.hosting.de/api/?json#the-record-object

type Filter

type Filter struct {
	Field string `json:"field"`
	Value string `json:"value"`
}

Filter is used to filter FindRequests to the API. https://www.hosting.de/api/?json#filter-object

type Metadata

type Metadata struct {
	ClientTransactionID string `json:"clientTransactionId"`
	ServerTransactionID string `json:"serverTransactionId"`
}

Metadata represents the metadata in an API response. https://www.hosting.de/api/?json#metadata-object

type SOAValues

type SOAValues struct {
	Refresh     int `json:"refresh"`
	Retry       int `json:"retry"`
	Expire      int `json:"expire"`
	TTL         int `json:"ttl"`
	NegativeTTL int `json:"negativeTtl"`
}

SOAValues The SOA values object contains the time (seconds) used in a zone’s SOA record. https://www.hosting.de/api/?json#the-soa-values-object

type Sort

type Sort struct {
	Field string `json:"zoneName"`
	Order string `json:"order"`
}

Sort is used to sort FindRequests from the API. https://www.hosting.de/api/?json#filtering-and-sorting

type Zone

type Zone struct {
	Records    []DNSRecord `json:"records"`
	ZoneConfig ZoneConfig  `json:"zoneConfig"`
}

Zone The Zone Object. https://www.hosting.de/api/?json#the-zone-object

type ZoneConfig

type ZoneConfig struct {
	ID                    string          `json:"id"`
	AccountID             string          `json:"accountId"`
	Status                string          `json:"status"`
	Name                  string          `json:"name"`
	NameUnicode           string          `json:"nameUnicode"`
	MasterIP              string          `json:"masterIp"`
	Type                  string          `json:"type"`
	EMailAddress          string          `json:"emailAddress"`
	ZoneTransferWhitelist []string        `json:"zoneTransferWhitelist"`
	LastChangeDate        string          `json:"lastChangeDate"`
	DNSServerGroupID      string          `json:"dnsServerGroupId"`
	DNSSecMode            string          `json:"dnsSecMode"`
	SOAValues             *SOAValues      `json:"soaValues,omitempty"`
	TemplateValues        json.RawMessage `json:"templateValues,omitempty"`
}

ZoneConfig The ZoneConfig object defines a zone. https://www.hosting.de/api/?json#the-zoneconfig-object

type ZoneConfigsFindRequest

type ZoneConfigsFindRequest struct {
	BaseRequest
	Filter Filter `json:"filter"`
	Limit  int    `json:"limit"`
	Page   int    `json:"page"`
	Sort   *Sort  `json:"sort,omitempty"`
}

ZoneConfigsFindRequest represents a API ZonesFind request. https://www.hosting.de/api/?json#list-zoneconfigs

type ZoneConfigsFindResponse

type ZoneConfigsFindResponse struct {
	BaseResponse
	Response struct {
		Limit        int          `json:"limit"`
		Page         int          `json:"page"`
		TotalEntries int          `json:"totalEntries"`
		TotalPages   int          `json:"totalPages"`
		Type         string       `json:"type"`
		Data         []ZoneConfig `json:"data"`
	} `json:"response"`
}

ZoneConfigsFindResponse represents the API response for ZoneConfigsFind. https://www.hosting.de/api/?json#list-zoneconfigs

type ZoneUpdateRequest

type ZoneUpdateRequest struct {
	BaseRequest
	ZoneConfig      `json:"zoneConfig"`
	RecordsToAdd    []DNSRecord `json:"recordsToAdd"`
	RecordsToDelete []DNSRecord `json:"recordsToDelete"`
}

ZoneUpdateRequest represents a API ZoneUpdate request. https://www.hosting.de/api/?json#updating-zones

type ZoneUpdateResponse

type ZoneUpdateResponse struct {
	BaseResponse
	Response Zone `json:"response"`
}

ZoneUpdateResponse represents a response from the API. https://www.hosting.de/api/?json#updating-zones

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL