Add TURN permission handler. (#4505)
* Add TURN permission handler. - Turn off permissions to private/link local/multicast and internal IPs - Add a list of CIDRs that can be used for more things to deny permission to. * unused * add config for allowing private IPs, used in testing * add a TTL to user name and use it to auth * allow list for restricted peer CIDRs
This commit is contained in:
@@ -132,14 +132,30 @@ func waitUntilConnected(t *testing.T, clients ...*testclient.RTCClient) {
|
||||
wg := sync.WaitGroup{}
|
||||
for i := range clients {
|
||||
c := clients[i]
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
err := c.WaitUntilConnected()
|
||||
wg.Go(func() {
|
||||
err := c.WaitUntilConnected(5 * time.Second)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}()
|
||||
})
|
||||
}
|
||||
wg.Wait()
|
||||
if t.Failed() {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
func ensureNotConnected(t *testing.T, clients ...*testclient.RTCClient) {
|
||||
logger.Infow("checking if clients connect")
|
||||
wg := sync.WaitGroup{}
|
||||
for i := range clients {
|
||||
c := clients[i]
|
||||
wg.Go(func() {
|
||||
err := c.WaitUntilConnected(5 * time.Second)
|
||||
if err == nil {
|
||||
t.Error(fmt.Errorf("expected client to not connect: %s", c.ID()))
|
||||
}
|
||||
})
|
||||
}
|
||||
wg.Wait()
|
||||
if t.Failed() {
|
||||
|
||||
Reference in New Issue
Block a user