When clients connect with some protocols (SRT, RTMP), they are unable to provide credentials even if they are asked to. In this case, it's useless to wait for credentials, and it's better to immediately log authentication errors and apply the anti-brute force algorithm.
36 lines
936 B
Go
36 lines
936 B
Go
package auth
|
|
|
|
import (
|
|
"net"
|
|
|
|
"github.com/bluenviron/mediamtx/internal/conf"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// Protocol is a protocol.
|
|
type Protocol string
|
|
|
|
// protocols.
|
|
const (
|
|
ProtocolRTSP Protocol = "rtsp"
|
|
ProtocolRTMP Protocol = "rtmp"
|
|
ProtocolHLS Protocol = "hls"
|
|
ProtocolWebRTC Protocol = "webrtc"
|
|
ProtocolSRT Protocol = "srt"
|
|
ProtocolMoQ Protocol = "moq"
|
|
)
|
|
|
|
// Request is an authentication request.
|
|
type Request struct {
|
|
Action conf.AuthAction
|
|
Path string // only for ActionPublish, ActionRead, ActionPlayback
|
|
Query string
|
|
Protocol Protocol // only for ActionPublish, ActionRead
|
|
ID *uuid.UUID // only for ActionPublish, ActionRead
|
|
UserAgent string
|
|
Credentials *Credentials
|
|
IP net.IP
|
|
CustomVerifyFunc func(expectedUser string, expectedPass string) bool
|
|
EnableAskCredentials bool
|
|
}
|