aboutsummaryrefslogtreecommitdiff
path: root/messages.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-12-13 16:02:15 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-12-13 16:02:15 +0100
commitf6536039db9f5db4ff8f0cd2e1148bbddf387f66 (patch)
tree5ac440c682d01fdff31a115e70941f65cc4268e9 /messages.go
parent1db342aa4b01994cc46f5414e919dba714b1abd3 (diff)
Add stringer
Diffstat (limited to 'messages.go')
-rw-r--r--messages.go19
1 files changed, 16 insertions, 3 deletions
diff --git a/messages.go b/messages.go
index 859061a..65b0904 100644
--- a/messages.go
+++ b/messages.go
@@ -67,6 +67,7 @@ type Challenge struct {
URI string `json:"uri,omitempty"`
Validated *time.Time `json:"validated,omitempty"` // 2006-01-02T15:04Z
KeyAuthorization string `json:"keyAuthorization,omitempty"`
+ N int `json:"n,omitempty"`
}
// Problem description
@@ -135,9 +136,13 @@ var resources = map[Resource]string{
ResCert: "cert",
}
+func (r Resource) String() string {
+ return resources[r]
+}
+
// MarshalText implements text encoding marshaller
func (r Resource) MarshalText() ([]byte, error) {
- return []byte(resources[r]), nil
+ return []byte(r.String()), nil
}
type IdentType int
@@ -148,8 +153,12 @@ var identTypes = map[IdentType]string{
IdentDNS: "dns",
}
+func (i IdentType) String() string {
+ return identTypes[i]
+}
+
func (i IdentType) MarshalText() ([]byte, error) {
- return []byte(identTypes[i]), nil
+ return []byte(i.String()), nil
}
func (i *IdentType) UnmarshalText(b []byte) error {
@@ -178,8 +187,12 @@ var challenges = map[ChallengeType]string{
ChallengeDNS: "dns-01",
}
+func (c ChallengeType) String() string {
+ return challenges[c]
+}
+
func (c ChallengeType) MarshalText() ([]byte, error) {
- return []byte(challenges[c]), nil
+ return []byte(c.String()), nil
}
func (c *ChallengeType) UnmarshalText(b []byte) error {