Browse Source

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

pull/169/head
aler9 5 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
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")

2
main.go

@ -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 {

8
rtsp-simple-server.yml

@ -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]

Loading…
Cancel
Save