Check for TLS config in wss listeners

Previously http.Server.ListenAndServeTLS would return a not very helpful
error about a failed open. This adds a check similar to the one in the
ircs case that should make it clearer to operators what the error is.
This commit is contained in:
Rafael Castillo 2021-09-08 12:55:58 -07:00 committed by Simon Ser
parent c5d5259243
commit d1181b3e7a
1 changed files with 3 additions and 0 deletions

View File

@ -156,6 +156,9 @@ func main() {
}
}()
case "wss":
if tlsCfg == nil {
log.Fatalf("failed to listen on %q: missing TLS configuration", listen)
}
addr := u.Host
if _, _, err := net.SplitHostPort(addr); err != nil {
addr = addr + ":https"