Add deadline handler for SRTP server

This commit is contained in:
Alexey Khit
2023-07-23 17:09:09 +03:00
parent 6e9574a1bd
commit 3defbd60db
2 changed files with 25 additions and 13 deletions
+9 -3
View File
@@ -1,12 +1,18 @@
package core
import (
cryptorand "crypto/rand"
"github.com/rs/zerolog/log"
"crypto/rand"
"runtime"
"strconv"
"strings"
"time"
"github.com/rs/zerolog/log"
)
const (
ConnDialTimeout = time.Second * 3
ConnDeadline = time.Second * 3
)
// Now90000 - timestamp for Video (clock rate = 90000 samples per second)
@@ -19,7 +25,7 @@ const symbols = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-
// RandString base10 - numbers, base16 - hex, base36 - digits+letters, base64 - URL safe symbols
func RandString(size, base byte) string {
b := make([]byte, size)
if _, err := cryptorand.Read(b); err != nil {
if _, err := rand.Read(b); err != nil {
panic(err)
}
for i := byte(0); i < size; i++ {