check turn domain and port range (#90)
* check negative turn port * check turn domain * domain check test code
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user