diff options
author | Mike Crute <mike@crute.us> | 2022-01-30 12:24:26 -0800 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2022-01-30 12:24:26 -0800 |
commit | 1c24090da6b95ea304677d36f7cb6458034c08b9 (patch) | |
tree | b375186f692a1e850f2f35ad5a3295e90ab7906c /main.go | |
parent | 74c33667f4c317bed29a014306130b9dd8990538 (diff) | |
download | go_ddns_manager-1c24090da6b95ea304677d36f7cb6458034c08b9.tar.bz2 go_ddns_manager-1c24090da6b95ea304677d36f7cb6458034c08b9.tar.xz go_ddns_manager-1c24090da6b95ea304677d36f7cb6458034c08b9.zip |
Add ACMEv2 endpoints
The ACMEv2 endpoints are easier to use for clients running the Golang
acme.autocert.Manager. They require no tracking of state and also handle
DNS propagation checking so the client can remain simple.
Once the legacy REST client for the v1 endpoints is gone those old
endpoints can be removed.
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -3,6 +3,7 @@ package main | |||
3 | import ( | 3 | import ( |
4 | "encoding/json" | 4 | "encoding/json" |
5 | "io/ioutil" | 5 | "io/ioutil" |
6 | "time" | ||
6 | 7 | ||
7 | "github.com/gin-gonic/gin" | 8 | "github.com/gin-gonic/gin" |
8 | 9 | ||
@@ -21,7 +22,14 @@ func loadConfig(app *frame.WebApp, args []string) (interface{}, error) { | |||
21 | view := app.GetStringArgument("view_name") | 22 | view := app.GetStringArgument("view_name") |
22 | 23 | ||
23 | scfg := &web.ServerConfig{ | 24 | scfg := &web.ServerConfig{ |
24 | DNSClient: &dns.DNSClient{Server: server}, | 25 | DNSClient: &dns.DNSClient{ |
26 | Server: server, | ||
27 | RecursiveResolvers: []string{ | ||
28 | "google-public-dns-a.google.com:53", | ||
29 | "google-public-dns-b.google.com:53", | ||
30 | }, | ||
31 | PollTimeout: 3 * time.Second, | ||
32 | }, | ||
25 | AcmeView: view, | 33 | AcmeView: view, |
26 | DynamicDnsView: view, | 34 | DynamicDnsView: view, |
27 | } | 35 | } |
@@ -64,6 +72,13 @@ func prepareServer(c interface{}, router *gin.Engine) error { | |||
64 | acme.DELETE("/:id", controllers.DeleteAcmeChallenge) | 72 | acme.DELETE("/:id", controllers.DeleteAcmeChallenge) |
65 | } | 73 | } |
66 | 74 | ||
75 | acme2 := router.Group("/acmev2") | ||
76 | acme2.Use(middleware.AcmeAuthMiddleware) | ||
77 | { | ||
78 | acme2.POST("/:domain/:challenge", controllers.CreateAcmeChallengeV2) | ||
79 | acme2.DELETE("/:domain/:challenge", controllers.DeleteAcmeChallengeV2) | ||
80 | } | ||
81 | |||
67 | manage := router.Group("/manage") | 82 | manage := router.Group("/manage") |
68 | manage.Use(middleware.ApiAuthMiddleware) | 83 | manage.Use(middleware.ApiAuthMiddleware) |
69 | { | 84 | { |