mirror of
https://github.com/livekit/livekit.git
synced 2026-03-30 17:45:40 +00:00
When the instance handling the signal request did not respond to the initial connection, we will fail the connection attempt instead of having it hang forever.
25 lines
593 B
Go
25 lines
593 B
Go
package service
|
|
|
|
import (
|
|
"net/http"
|
|
"regexp"
|
|
|
|
"github.com/livekit/protocol/logger"
|
|
)
|
|
|
|
func handleError(w http.ResponseWriter, status int, err error, keysAndValues ...interface{}) {
|
|
keysAndValues = append(keysAndValues, "status", status)
|
|
logger.Warnw("error handling request", err, keysAndValues...)
|
|
w.WriteHeader(status)
|
|
_, _ = w.Write([]byte(err.Error()))
|
|
}
|
|
|
|
func boolValue(s string) bool {
|
|
return s == "1" || s == "true"
|
|
}
|
|
|
|
func IsValidDomain(domain string) bool {
|
|
domainRegexp := regexp.MustCompile(`^(?i)[a-z0-9-]+(\.[a-z0-9-]+)+\.?$`)
|
|
return domainRegexp.MatchString(domain)
|
|
}
|