Browse Source

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

pull/169/head
aler9 4 years ago
parent
commit
ad195a6bd0
  1. 6
      internal/conf/conf.go
  2. 2
      main.go
  3. 8
      rtsp-simple-server.yml

6
internal/conf/conf.go

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

2
main.go

@ -207,7 +207,7 @@ func (p *program) createResources(initial bool) error { @@ -207,7 +207,7 @@ func (p *program) createResources(initial bool) error {
}
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.conf.WriteTimeout, p.conf.ServerKey, p.conf.ServerCert, p)
if err != nil {

8
rtsp-simple-server.yml

@ -13,19 +13,19 @@ logFile: rtsp-simple-server.log @@ -13,19 +13,19 @@ logFile: rtsp-simple-server.log
# The handshake is always performed with TCP.
protocols: [udp, tcp]
# encrypt handshake and TCP streams with TLS (RTSPS).
# available values are "no", "yes", "optional".
# available values are "no", "strict", "optional".
encryption: no
# port of the TCP/RTSP listener. This is used only if encryption is "no" or "optional".
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
# port of the UDP/RTP listener. This is used only if "udp" is in protocols.
rtpPort: 8000
# port of the UDP/RTCP listener. This is used only if "udp" is in protocols.
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
# 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
# authentication methods.
authMethods: [basic, digest]

Loading…
Cancel
Save