Files
livekit/pkg/service/utils.go
David Zhao 5920672802 feat: unpublish tracks after publish permissions are revoked. (#545)
* feat: unpublish tracks after publish permissions are revoked.

Uses protocol 7 to indicate client support, otherwise it attempts to
mute the tracks.

Also sends back permissions objects of all participants, and cleaned up
our handling of various permissions attributes.

* fix static check
2022-03-21 00:20:48 -07:00

25 lines
565 B
Go

package service
import (
"net/http"
"regexp"
"github.com/livekit/protocol/logger"
)
func handleError(w http.ResponseWriter, status int, msg string) {
// GetLogger already with extra depth 1
logger.GetLogger().V(1).Info("error handling request", "error", msg, "status", status)
w.WriteHeader(status)
_, _ = w.Write([]byte(msg))
}
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)
}