aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-01-24 19:32:08 +0100
committerDimitri Sokolyuk <demon@dim13.org>2016-01-24 19:32:08 +0100
commitb0757dcf4d16d78188468f0a1d012be3a1364549 (patch)
tree0303a8ea0f15a0be42f14a1b50c0a1acb9e2a31c
parentce2fd0d7e7e60eef25ffc2f841aff352ce98d95d (diff)
Split a bit
-rw-r--r--provider.go49
1 files changed, 27 insertions, 22 deletions
diff --git a/provider.go b/provider.go
index d97bbad..ecb1bfd 100644
--- a/provider.go
+++ b/provider.go
@@ -194,31 +194,36 @@ func (p *Provider) solve(s Signer, ch Challenge) error {
return ch.Solved()
}
-//func (p *Provider) Authz(s Signer, domain string, sol map[ChallengeType]Solver) error {
-func (p *Provider) Authz(s Signer, d *Desire) error {
- for _, domain := range d.altnames {
- // first step: pocke
- r := &Authorization{
- Resource: ResNewAuthz,
- Identifier: Identifier{
- Type: IdentDNS,
- Value: domain,
- },
- }
- resp, err := p.post(p.NewAuthz, s, r)
- if err != nil {
- return err
- }
- err = parseJson(resp, r)
- if err != nil {
+func (p *Provider) authz(s Signer, domain string, sol map[ChallengeType]Solver) error {
+ // first step: pocke
+ r := &Authorization{
+ Resource: ResNewAuthz,
+ Identifier: Identifier{
+ Type: IdentDNS,
+ Value: domain,
+ },
+ }
+ resp, err := p.post(p.NewAuthz, s, r)
+ if err != nil {
+ return err
+ }
+ err = parseJson(resp, r)
+ if err != nil {
+ return err
+ }
+ // second step: choose and start solver
+ for _, ch := range r.Supported(sol) {
+ if err = p.solve(s, ch); err != nil {
return err
}
+ }
+ return nil
+}
- // second step: choose and start solver
- for _, ch := range r.Supported(d.solver) {
- if err = p.solve(s, ch); err != nil {
- return err
- }
+func (p *Provider) Authz(s Signer, d *Desire) error {
+ for _, domain := range d.altnames {
+ if err := p.authz(s, domain, d.solver); err != nil {
+ return err
}
}
return nil