forked from TrueCloudLab/lego
Add challengeHandler interface
This commit is contained in:
parent
7aab5562c1
commit
a09886b577
3 changed files with 20 additions and 1 deletions
|
@ -35,6 +35,11 @@ type User interface {
|
||||||
GetPrivateKey() *rsa.PrivateKey
|
GetPrivateKey() *rsa.PrivateKey
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type challengeHandler interface {
|
||||||
|
CanSolve() bool
|
||||||
|
Solve()
|
||||||
|
}
|
||||||
|
|
||||||
// Client is the user-friendy way to ACME
|
// Client is the user-friendy way to ACME
|
||||||
type Client struct {
|
type Client struct {
|
||||||
regURL string
|
regURL string
|
||||||
|
@ -146,7 +151,19 @@ func (c *Client) AgreeToTos() error {
|
||||||
// certificate processings at the same time in parallel.
|
// certificate processings at the same time in parallel.
|
||||||
func (c *Client) ObtainCertificates(domains []string) error {
|
func (c *Client) ObtainCertificates(domains []string) error {
|
||||||
|
|
||||||
|
challenges := c.getChallenges(domains)
|
||||||
|
c.doChallenges(challenges)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) doChallenges(challenges []*authorizationResource) {
|
||||||
|
for _, auth := range challenges {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) getChallenges(domains []string) []*authorizationResource {
|
||||||
resc, errc := make(chan *authorizationResource), make(chan error)
|
resc, errc := make(chan *authorizationResource), make(chan error)
|
||||||
|
|
||||||
for _, domain := range domains {
|
for _, domain := range domains {
|
||||||
go func(domain string) {
|
go func(domain string) {
|
||||||
jsonBytes, err := json.Marshal(authorization{Identifier: identifier{Type: "dns", Value: domain}})
|
jsonBytes, err := json.Marshal(authorization{Identifier: identifier{Type: "dns", Value: domain}})
|
||||||
|
@ -196,7 +213,7 @@ func (c *Client) ObtainCertificates(domains []string) error {
|
||||||
close(resc)
|
close(resc)
|
||||||
close(errc)
|
close(errc)
|
||||||
|
|
||||||
return nil
|
return responses
|
||||||
}
|
}
|
||||||
|
|
||||||
func logResponseHeaders(resp *http.Response) {
|
func logResponseHeaders(resp *http.Response) {
|
||||||
|
|
1
acme/dvsni_challenge.go
Normal file
1
acme/dvsni_challenge.go
Normal file
|
@ -0,0 +1 @@
|
||||||
|
package acme
|
1
acme/simple_https_challenge.go
Normal file
1
acme/simple_https_challenge.go
Normal file
|
@ -0,0 +1 @@
|
||||||
|
package acme
|
Loading…
Reference in a new issue