blob: cf08669ca2b596f5d0c83cae10501d7f4a3c4934 (
plain)
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
|
package acme
import (
"io"
"net/http"
"path"
)
type httpSolver struct {
http.Server
}
func NewHTTPSolver(addr string) Solver {
var s httpSolver
s.Server = http.Server{Addr: addr}
go s.ListenAndServe()
return &s
}
func (s *httpSolver) Solve(token, keyAuth string) error {
p := path.Join(WellKnown, token)
http.HandleFunc(p, func(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, keyAuth)
})
return nil
}
func (s *httpSolver) Solved() error { return nil }
|