2019-03-11 15:54:35 +00:00
|
|
|
package resolver // import "github.com/xenolf/lego/challenge/resolver"
|
2018-12-06 21:50:17 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/xenolf/lego/acme"
|
|
|
|
"github.com/xenolf/lego/challenge"
|
|
|
|
)
|
|
|
|
|
|
|
|
type preSolverMock struct {
|
|
|
|
preSolve map[string]error
|
|
|
|
solve map[string]error
|
|
|
|
cleanUp map[string]error
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *preSolverMock) PreSolve(authorization acme.Authorization) error {
|
|
|
|
return s.preSolve[authorization.Identifier.Value]
|
|
|
|
}
|
|
|
|
func (s *preSolverMock) Solve(authorization acme.Authorization) error {
|
|
|
|
return s.solve[authorization.Identifier.Value]
|
|
|
|
}
|
|
|
|
func (s *preSolverMock) CleanUp(authorization acme.Authorization) error {
|
|
|
|
return s.cleanUp[authorization.Identifier.Value]
|
|
|
|
}
|
|
|
|
|
|
|
|
func createStubAuthorizationHTTP01(domain, status string) acme.Authorization {
|
|
|
|
return acme.Authorization{
|
|
|
|
Status: status,
|
|
|
|
Expires: time.Now(),
|
|
|
|
Identifier: acme.Identifier{
|
|
|
|
Type: challenge.HTTP01.String(),
|
|
|
|
Value: domain,
|
|
|
|
},
|
|
|
|
Challenges: []acme.Challenge{
|
|
|
|
{
|
|
|
|
Type: challenge.HTTP01.String(),
|
|
|
|
Validated: time.Now(),
|
|
|
|
Error: nil,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|