diff --git a/challtestsrv/challenge-servers.go b/challtestsrv/challenge-servers.go index 85bb38fa..78ad533b 100644 --- a/challtestsrv/challenge-servers.go +++ b/challtestsrv/challenge-servers.go @@ -3,7 +3,7 @@ package challtestsrv import ( - "fmt" + "errors" "log" "net/http" "os" @@ -118,7 +118,7 @@ func (c *Config) validate() error { len(c.HTTPSOneAddrs) < 1 && len(c.DNSOneAddrs) < 1 && len(c.TLSALPNOneAddrs) < 1 { - return fmt.Errorf( + return errors.New( "config must specify at least one HTTPOneAddrs entry, one HTTPSOneAddr " + "entry, one DOHAddrs, one DNSOneAddrs entry, or one TLSALPNOneAddrs entry") } @@ -177,10 +177,7 @@ func New(config Config) (*ChallSrv, error) { for _, address := range config.DOHAddrs { challSrv.log.Printf("Creating DoH server on %s\n", address) - s, err := dohServer(address, config.DOHCert, config.DOHCertKey, http.HandlerFunc(challSrv.dohHandler)) - if err != nil { - return nil, err - } + s := dohServer(address, config.DOHCert, config.DOHCertKey, http.HandlerFunc(challSrv.dohHandler)) challSrv.servers = append(challSrv.servers, s) } diff --git a/challtestsrv/dnsone.go b/challtestsrv/dnsone.go index 5dd61b33..a336cbac 100644 --- a/challtestsrv/dnsone.go +++ b/challtestsrv/dnsone.go @@ -72,7 +72,7 @@ func (s *doh) ListenAndServe() error { } // dohServer creates a DoH server. -func dohServer(address string, tlsCert, tlsCertKey string, handler http.Handler) (*doh, error) { +func dohServer(address string, tlsCert, tlsCertKey string, handler http.Handler) *doh { return &doh{ &http.Server{ Handler: handler, @@ -82,5 +82,5 @@ func dohServer(address string, tlsCert, tlsCertKey string, handler http.Handler) }, tlsCert, tlsCertKey, - }, nil + } }