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
+16
View File
@@ -2,6 +2,9 @@ package service_test
import (
"github.com/go-redis/redis/v8"
"github.com/livekit/livekit-server/pkg/service"
"github.com/stretchr/testify/require"
"testing"
)
func redisClient() *redis.Client {
@@ -9,3 +12,16 @@ func redisClient() *redis.Client {
Addr: "localhost:6379",
})
}
func TestIsValidDomain(t *testing.T) {
list := map[string]bool{
"turn.myhost.com": true,
"turn.google.com": true,
"https://host.com": false,
"turn://host.com": false,
}
for key, result := range list {
service.IsValidDomain(key)
require.Equal(t, service.IsValidDomain(key), result)
}
}