doh support: make no TLS config fatal (#4162)

without TLS you can't have a functioning DoH server as no client will be
able to talk to it. Make this a fatal failure.

Add some extra docs on how to start a DoH capable server.

Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
Miek Gieben 2020-09-30 17:17:24 +02:00 committed by GitHub
parent 0cb0136570
commit 5235b35e3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -38,6 +38,9 @@ func NewServerHTTPS(addr string, group []*Config) (*ServerHTTPS, error) {
// Should we error if some configs *don't* have TLS?
tlsConfig = conf.TLSConfig
}
if tlsConfig == nil {
return nil, fmt.Errorf("DoH requires TLS to be configured, see the tls plugin")
}
srv := &http.Server{
ReadTimeout: 5 * time.Second,