check turn domain and port range (#90)

* check negative turn port

* check turn domain

* domain check test code
This commit is contained in:
PJC
2021-08-23 10:49:16 -07:00
committed by GitHub
parent bcf6e15e07
commit 9016da1936
3 changed files with 28 additions and 2 deletions
+6
View File
@@ -3,6 +3,7 @@ package service
import (
"context"
"net/http"
"regexp"
"github.com/go-redis/redis/v8"
"github.com/google/wire"
@@ -93,6 +94,11 @@ 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)
}
func permissionFromGrant(claim *auth.VideoGrant) *livekit.ParticipantPermission {
p := &livekit.ParticipantPermission{
CanSubscribe: true,