Skip to content

Commit 9c08d6c

Browse files
committed
Fill in request & response types
1 parent 4ba7380 commit 9c08d6c

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

handler.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,12 @@ const (
147147

148148
func (h *Handler) handleDNSRequest(
149149
mode handlerMode,
150-
) func(*http.Request, any) (int, optionals.Optional[any], error) {
150+
) func(*http.Request, RequestBody) (int, optionals.Optional[ResponseBody], error) {
151151
return func(
152152
req *http.Request,
153-
reqBody any,
154-
) (httpStatus int, respBody optionals.Optional[any], err error) {
153+
reqBody RequestBody,
154+
) (httpStatus int, respBody optionals.Optional[ResponseBody], err error) {
155155
// TODO
156-
return http.StatusInternalServerError, optionals.None[any](), nil
156+
return http.StatusInternalServerError, optionals.None[ResponseBody](), nil
157157
}
158158
}

schema.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package caddydns01proxy
2+
3+
// See https://github.com/libdns/acmeproxy/blob/f8e0a6620dddf349d1c9ba58b755aa7a25e5613f/provider.go#L20-L23.
4+
type RequestBody struct {
5+
// The challenge domain at which the DNS-01 response should be written.
6+
ChallengeFQDN string `json:"fqdn"`
7+
8+
// The value of the DNS-01 response.
9+
Value string `json:"value"`
10+
}
11+
12+
func (r RequestBody) IsValid() bool {
13+
return r.ChallengeFQDN != "" && r.Value != ""
14+
}
15+
16+
type ResponseBody = RequestBody

0 commit comments

Comments
 (0)