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.

git-svn-id: file:///srv/svn/repo/suika/trunk@581 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This commit is contained in:
rafael 2021-09-09 08:06:31 +00:00
parent 364c9ca695
commit 597a59c86b

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"