-
Notifications
You must be signed in to change notification settings - Fork 0
/
dsupdate.go
51 lines (42 loc) · 1.28 KB
/
dsupdate.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package dsupdate
import (
"net/http"
)
// BaseURL is the endpoint of the DS Update service.
type BaseURL string
// DK Hostmasters environments are predefined as constants.
const (
// Production environment of DK Hostmasters DSU service.
Production BaseURL = "https://dsu.dk-hostmaster.dk/1.0"
// Sandbox environment of DK Hostmasters DSU service.
Sandbox BaseURL = "https://dsu-sandbox.dk-hostmaster.dk/1.0"
)
// String gives you the endpoint as a string. If the BaseURL is not
// set (the zero value) it will give you the Production environment.
func (baseURL BaseURL) String() string {
if baseURL == "" {
return string(Production)
}
return string(baseURL)
}
// DsRecord is a DS record.
type DsRecord struct {
KeyTag uint16
Algorithm uint8
DigestType uint8
Digest string
}
// Client for doing updates and deletions.
type Client struct {
Domain string // .dk domain name, i.e eksempel.dk
UserID string // DK Hostmaster user ID, i.e. ABCD1234-DK
Password string // DK Hostmater password
BaseURL BaseURL // DS Update service base URL. You can use constants dsupdate.Production (default) or dsupdate.Sandbox
HTTPClient *http.Client
}
func (c *Client) httpClient() *http.Client {
if c.HTTPClient == nil {
return http.DefaultClient
}
return c.HTTPClient
}