use 'strict' instead of 'yes' in the 'encryption' parameter

This commit is contained in:
aler9 2020-12-20 12:51:04 +01:00
parent 939dda01d0
commit ad195a6bd0
3 changed files with 8 additions and 8 deletions

View File

@ -20,7 +20,7 @@ type Encryption int
const ( const (
EncryptionNo Encryption = iota EncryptionNo Encryption = iota
EncryptionOptional EncryptionOptional
EncryptionYes EncryptionStrict
) )
// Conf is the main program configuration. // Conf is the main program configuration.
@ -123,8 +123,8 @@ func (conf *Conf) fillAndCheck() error {
case "optional": case "optional":
conf.EncryptionParsed = EncryptionOptional conf.EncryptionParsed = EncryptionOptional
case "yes", "true": case "strict", "yes", "true":
conf.EncryptionParsed = EncryptionYes conf.EncryptionParsed = EncryptionStrict
if _, ok := conf.ProtocolsParsed[gortsplib.StreamProtocolUDP]; ok { if _, ok := conf.ProtocolsParsed[gortsplib.StreamProtocolUDP]; ok {
return fmt.Errorf("encryption can't be used with the UDP stream protocol") return fmt.Errorf("encryption can't be used with the UDP stream protocol")

View File

@ -207,7 +207,7 @@ func (p *program) createResources(initial bool) error {
} }
if p.serverTLS == nil { if p.serverTLS == nil {
if p.conf.EncryptionParsed == conf.EncryptionYes || p.conf.EncryptionParsed == conf.EncryptionOptional { if p.conf.EncryptionParsed == conf.EncryptionStrict || p.conf.EncryptionParsed == conf.EncryptionOptional {
p.serverTLS, err = servertls.New(p.conf.RtspsPort, p.conf.ReadTimeout, p.serverTLS, err = servertls.New(p.conf.RtspsPort, p.conf.ReadTimeout,
p.conf.WriteTimeout, p.conf.ServerKey, p.conf.ServerCert, p) p.conf.WriteTimeout, p.conf.ServerKey, p.conf.ServerCert, p)
if err != nil { if err != nil {

View File

@ -13,19 +13,19 @@ logFile: rtsp-simple-server.log
# The handshake is always performed with TCP. # The handshake is always performed with TCP.
protocols: [udp, tcp] protocols: [udp, tcp]
# encrypt handshake and TCP streams with TLS (RTSPS). # encrypt handshake and TCP streams with TLS (RTSPS).
# available values are "no", "yes", "optional". # available values are "no", "strict", "optional".
encryption: no encryption: no
# port of the TCP/RTSP listener. This is used only if encryption is "no" or "optional". # port of the TCP/RTSP listener. This is used only if encryption is "no" or "optional".
rtspPort: 8554 rtspPort: 8554
# port of the TCP/TLS/RTSPS listener. This is used only if encryption is "yes" or "optional". # port of the TCP/TLS/RTSPS listener. This is used only if encryption is "strict" or "optional".
rtspsPort: 8555 rtspsPort: 8555
# port of the UDP/RTP listener. This is used only if "udp" is in protocols. # port of the UDP/RTP listener. This is used only if "udp" is in protocols.
rtpPort: 8000 rtpPort: 8000
# port of the UDP/RTCP listener. This is used only if "udp" is in protocols. # port of the UDP/RTCP listener. This is used only if "udp" is in protocols.
rtcpPort: 8001 rtcpPort: 8001
# path to the server key. This is used only if encryption is "yes" or "optional". # path to the server key. This is used only if encryption is "strict" or "optional".
serverKey: server.key serverKey: server.key
# path to the server certificate. This is used only if encryption is "yes" or "optional". # path to the server certificate. This is used only if encryption is "strict" or "optional".
serverCert: server.crt serverCert: server.crt
# authentication methods. # authentication methods.
authMethods: [basic, digest] authMethods: [basic, digest]