acme/autocert: support http-01 challenge type
The Manager now loops through known challenge types, trying to fulfill one at a time until it succeeds or runs out of supported challenges. The provisioning of "http-01" challenges can be done using the new Manager.HTTPHandler method. It requires listening on unencrypted port 80. Fixes golang/go#21890 Change-Id: I55de9501f0069a9f460fedd8b5b0a09b94f9ef05 Reviewed-on: https://go-review.googlesource.com/87201 Run-TryBot: Alex Vaghin <ddos@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
@@ -22,11 +22,12 @@ func ExampleNewListener() {
|
||||
}
|
||||
|
||||
func ExampleManager() {
|
||||
m := autocert.Manager{
|
||||
m := &autocert.Manager{
|
||||
Cache: autocert.DirCache("secret-dir"),
|
||||
Prompt: autocert.AcceptTOS,
|
||||
HostPolicy: autocert.HostWhitelist("example.org"),
|
||||
}
|
||||
go http.ListenAndServe(":http", m.HTTPHandler(nil))
|
||||
s := &http.Server{
|
||||
Addr: ":https",
|
||||
TLSConfig: &tls.Config{GetCertificate: m.GetCertificate},
|
||||
|
||||
Reference in New Issue
Block a user