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: https://svn.yakumo.dev/yakumo.izuru/suika/trunk@581 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This commit is contained in:
rafael 2021-09-09 08:06:31 +00:00
parent 188e8ac31c
commit 3a77807ff7

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"