netcup

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package netcup implements a DNS Provider for solving the DNS-01 challenge using the netcup DNS API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDNSRecordIdx

func GetDNSRecordIdx(records []DNSRecord, record DNSRecord) (int, error)

GetDNSRecordIdx searches a given array of DNSRecords for a given DNSRecord equivalence is determined by Destination and RecortType attributes returns index of given DNSRecord in given array of DNSRecords

Types

type Client

type Client struct {
	HTTPClient *http.Client
	BaseURL    string
	// contains filtered or unexported fields
}

Client netcup DNS client

func NewClient

func NewClient(customerNumber string, apiKey string, apiPassword string) *Client

NewClient creates a netcup DNS client

func (*Client) GetDNSRecords

func (c *Client) GetDNSRecords(hostname, apiSessionID string) ([]DNSRecord, error)

GetDNSRecords retrieves all dns records of an DNS-Zone as specified by the netcup WSDL returns an array of DNSRecords https://ccp.netcup.net/run/webservice/servers/endpoint.php

func (*Client) Login

func (c *Client) Login() (string, error)

Login performs the login as specified by the netcup WSDL returns sessionID needed to perform remaining actions https://ccp.netcup.net/run/webservice/servers/endpoint.php

func (*Client) Logout

func (c *Client) Logout(sessionID string) error

Logout performs the logout with the supplied sessionID as specified by the netcup WSDL https://ccp.netcup.net/run/webservice/servers/endpoint.php

func (*Client) UpdateDNSRecord

func (c *Client) UpdateDNSRecord(sessionID, domainName string, record DNSRecord) error

UpdateDNSRecord performs an update of the DNSRecords as specified by the netcup WSDL https://ccp.netcup.net/run/webservice/servers/endpoint.php

type Config

type Config struct {
	Key                string
	Password           string
	Customer           string
	TTL                int
	PropagationTimeout time.Duration
	PollingInterval    time.Duration
	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 is an implementation of the acme.ChallengeProvider interface

func NewDNSProvider

func NewDNSProvider() (*DNSProvider, error)

NewDNSProvider returns a DNSProvider instance configured for netcup. Credentials must be passed in the environment variables: NETCUP_CUSTOMER_NUMBER, NETCUP_API_KEY, NETCUP_API_PASSWORD

func NewDNSProviderConfig

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

NewDNSProviderConfig return a DNSProvider instance configured for netcup.

func NewDNSProviderCredentials

func NewDNSProviderCredentials(customer, key, password string) (*DNSProvider, error)

NewDNSProviderCredentials uses the supplied credentials to return a DNSProvider instance configured for netcup. Deprecated

func (*DNSProvider) CleanUp

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

CleanUp removes the TXT record matching the specified parameters

func (*DNSProvider) Present

func (d *DNSProvider) Present(domainName, 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           int    `json:"id,string,omitempty"`
	Hostname     string `json:"hostname"`
	RecordType   string `json:"type"`
	Priority     string `json:"priority,omitempty"`
	Destination  string `json:"destination"`
	DeleteRecord bool   `json:"deleterecord,omitempty"`
	State        string `json:"state,omitempty"`
	TTL          int    `json:"ttl,omitempty"`
}

DNSRecord as specified in netcup WSDL https://ccp.netcup.net/run/webservice/servers/endpoint.php#Dnsrecord

func CreateTxtRecord

func CreateTxtRecord(hostname, value string, ttl int) DNSRecord

CreateTxtRecord uses the supplied values to return a DNSRecord of type TXT for the dns-01 challenge

type DNSRecordSet

type DNSRecordSet struct {
	DNSRecords []DNSRecord `json:"dnsrecords"`
}

DNSRecordSet as specified in netcup WSDL needed in UpdateDNSRecordsMsg https://ccp.netcup.net/run/webservice/servers/endpoint.php#Dnsrecordset

type InfoDNSRecordsMsg

type InfoDNSRecordsMsg struct {
	DomainName      string `json:"domainname"`
	CustomerNumber  string `json:"customernumber"`
	APIKey          string `json:"apikey"`
	APISessionID    string `json:"apisessionid"`
	ClientRequestID string `json:"clientrequestid,omitempty"`
}

InfoDNSRecordsMsg as specified in netcup WSDL https://ccp.netcup.net/run/webservice/servers/endpoint.php#infoDnsRecords

type LoginMsg

type LoginMsg struct {
	CustomerNumber  string `json:"customernumber"`
	APIKey          string `json:"apikey"`
	APIPassword     string `json:"apipassword"`
	ClientRequestID string `json:"clientrequestid,omitempty"`
}

LoginMsg as specified in netcup WSDL https://ccp.netcup.net/run/webservice/servers/endpoint.php#login

type LogoutMsg

type LogoutMsg struct {
	CustomerNumber  string `json:"customernumber"`
	APIKey          string `json:"apikey"`
	APISessionID    string `json:"apisessionid"`
	ClientRequestID string `json:"clientrequestid,omitempty"`
}

LogoutMsg as specified in netcup WSDL https://ccp.netcup.net/run/webservice/servers/endpoint.php#logout

type LogoutResponseMsg

type LogoutResponseMsg struct {
	ServerRequestID string `json:"serverrequestid"`
	ClientRequestID string `json:"clientrequestid,omitempty"`
	Action          string `json:"action"`
	Status          string `json:"status"`
	StatusCode      int    `json:"statuscode"`
	ShortMessage    string `json:"shortmessage"`
	LongMessage     string `json:"longmessage"`
	ResponseData    string `json:"responsedata,omitempty"`
}

LogoutResponseMsg similar to ResponseMsg allows empty ResponseData field whilst unmarshaling

type Request

type Request struct {
	Action string      `json:"action"`
	Param  interface{} `json:"param"`
}

Request wrapper as specified in netcup wiki needed for every request to netcup API around *Msg https://www.netcup-wiki.de/wiki/CCP_API#Anmerkungen_zu_JSON-Requests

type ResponseData

type ResponseData struct {
	APISessionID string      `json:"apisessionid"`
	DNSRecords   []DNSRecord `json:"dnsrecords"`
}

ResponseData to enable correct unmarshaling of ResponseMsg

type ResponseMsg

type ResponseMsg struct {
	ServerRequestID string       `json:"serverrequestid"`
	ClientRequestID string       `json:"clientrequestid,omitempty"`
	Action          string       `json:"action"`
	Status          string       `json:"status"`
	StatusCode      int          `json:"statuscode"`
	ShortMessage    string       `json:"shortmessage"`
	LongMessage     string       `json:"longmessage"`
	ResponseData    ResponseData `json:"responsedata,omitempty"`
}

ResponseMsg as specified in netcup WSDL https://ccp.netcup.net/run/webservice/servers/endpoint.php#Responsemessage

type UpdateDNSRecordsMsg

type UpdateDNSRecordsMsg struct {
	DomainName      string       `json:"domainname"`
	CustomerNumber  string       `json:"customernumber"`
	APIKey          string       `json:"apikey"`
	APISessionID    string       `json:"apisessionid"`
	ClientRequestID string       `json:"clientrequestid,omitempty"`
	DNSRecordSet    DNSRecordSet `json:"dnsrecordset"`
}

UpdateDNSRecordsMsg as specified in netcup WSDL https://ccp.netcup.net/run/webservice/servers/endpoint.php#updateDnsRecords

Jump to

Keyboard shortcuts

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