Finish order unit tests and remove unused mocklinker
This commit is contained in:
parent
b6ebc0fd25
commit
1831920363
5 changed files with 436 additions and 134 deletions
|
@ -1,7 +1,6 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"encoding/json"
|
||||
|
@ -71,28 +70,14 @@ func NewHandler(ops HandlerOptions) api.RouterHandler {
|
|||
dialer := &net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
}
|
||||
resolver := &net.Resolver{
|
||||
// The DNS resolver can be configured for testing purposes with something
|
||||
// like this:
|
||||
//
|
||||
// PreferGo: true,
|
||||
// Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
|
||||
// var d net.Dialer
|
||||
// return d.DialContext(ctx, "udp", "127.0.0.1:5333")
|
||||
// },
|
||||
}
|
||||
return &Handler{
|
||||
ca: ops.CA,
|
||||
db: ops.DB,
|
||||
backdate: ops.Backdate,
|
||||
linker: NewLinker(ops.DNS, ops.Prefix),
|
||||
validateChallengeOptions: &acme.ValidateChallengeOptions{
|
||||
HTTPGet: client.Get,
|
||||
LookupTxt: func(name string) ([]string, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
return resolver.LookupTXT(ctx, name)
|
||||
},
|
||||
HTTPGet: client.Get,
|
||||
LookupTxt: net.LookupTXT,
|
||||
TLSDial: func(network, addr string, config *tls.Config) (*tls.Conn, error) {
|
||||
return tls.DialWithDialer(dialer, network, addr, config)
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue