aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-12-23 15:22:43 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-12-23 15:22:43 +0100
commitb5092cfdfb4449fd9888dc58cd809985f2b87f75 (patch)
tree023ddc5cb2723e52f029fd4bf270e7c7a71885eb
parent5fd587332fcc304fa21da782c62409b860f269e6 (diff)
first try
-rw-r--r--challange_http.go4
-rw-r--r--client.go4
2 files changed, 6 insertions, 2 deletions
diff --git a/challange_http.go b/challange_http.go
index 30233bb..ee1708a 100644
--- a/challange_http.go
+++ b/challange_http.go
@@ -17,11 +17,11 @@ type httpChallenge struct {
Addr string
}
-func (c *httpChallenge) ServeHTTP(w http.ResponseWriter, r *http.Request) {
+func (c httpChallenge) ServeHTTP(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, c.KeyAuthorization)
}
-func (c *httpChallenge) Solve() error {
+func (c httpChallenge) Solve() error {
done := make(chan bool)
l, err := net.Listen("tcp", c.Addr)
if err != nil {
diff --git a/client.go b/client.go
index 143b79e..38d9811 100644
--- a/client.go
+++ b/client.go
@@ -225,6 +225,10 @@ func (c *Client) Authorize(a *Account, domain []string) error {
KeyAuthorization: ka,
}
_, err = c.post(ch.URI, a, ans)
+ switch ch.Type {
+ case ChallengeHTTP:
+ httpChallenge{Addr: ":80", Challenge: *ans}.Solve()
+ }
}
}
}