restore API compatibility

This commit is contained in:
aler9
2023-07-31 10:00:40 +02:00
committed by Alessandro Ros
parent 8b8b52e689
commit 8ef42a27e9
6 changed files with 20 additions and 12 deletions

View File

@@ -10,8 +10,8 @@ import (
"github.com/bluenviron/gortsplib/v3/pkg/url"
)
// GenerateNonce generates a nonce that can be used in Validate().
func GenerateNonce() (string, error) {
// GenerateNonce2 generates a nonce that can be used in Validate().
func GenerateNonce2() (string, error) {
byts := make([]byte, 16)
_, err := rand.Read(byts)
if err != nil {
@@ -21,6 +21,17 @@ func GenerateNonce() (string, error) {
return hex.EncodeToString(byts), nil
}
// GenerateNonce generates a nonce that can be used in Validate().
//
// Deprecated: use GenerateNonce2.
func GenerateNonce() string {
v, err := GenerateNonce2()
if err != nil {
panic(err)
}
return v
}
// GenerateWWWAuthenticate generates a WWW-Authenticate header.
func GenerateWWWAuthenticate(methods []headers.AuthMethod, realm string, nonce string) base.HeaderValue {
if methods == nil {