This commit is contained in:
aler9
2020-10-16 10:52:19 +02:00
parent 4bcdc863e4
commit 447c748a5f
2 changed files with 6 additions and 7 deletions

View File

@@ -10,8 +10,7 @@ import (
"github.com/aler9/gortsplib/headers"
)
// Client is an object that helps a client to send its credentials to a
// server.
// Client is an object that allows a client to authenticate against a server.
type Client struct {
user string
pass string
@@ -20,7 +19,7 @@ type Client struct {
nonce string
}
// NewClient allocates an Client.
// NewClient allocates a Client.
// header is the WWW-Authenticate header provided by the server.
func NewClient(v base.HeaderValue, user string, pass string) (*Client, error) {
// prefer digest

View File

@@ -12,8 +12,7 @@ import (
"github.com/aler9/gortsplib/headers"
)
// Server is an object that helps a server to validate the credentials of
// a client.
// Server is an object that helps a server to authenticate a client.
type Server struct {
user string
pass string
@@ -22,7 +21,7 @@ type Server struct {
nonce string
}
// NewServer allocates an Server.
// NewServer allocates a Server.
// If methods is nil, the Basic and Digest methods are used.
func NewServer(user string, pass string, methods []headers.AuthMethod) *Server {
if methods == nil {
@@ -42,7 +41,8 @@ func NewServer(user string, pass string, methods []headers.AuthMethod) *Server {
}
}
// GenerateHeader generates the WWW-Authenticate header needed by a client to log in.
// GenerateHeader generates the WWW-Authenticate header needed by a client to
// authenticate.
func (as *Server) GenerateHeader() base.HeaderValue {
var ret base.HeaderValue
for _, m := range as.methods {