Skip to content

Commit

Permalink
rename publishSRTPassphrase into srtPublishPassphrase, readSRTPassphr…
Browse files Browse the repository at this point in the history
…ase into srtReadPassphrase
  • Loading branch information
aler9 committed Sep 23, 2023
1 parent 02ffdc8 commit 79c49c2
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions apidocs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ components:
type: boolean
fallback:
type: string
publishSRTPassphrase:
srtPublishPassphrase:
type: string
readSRTPassphrase:
srtReadPassphrase:
type: string

# RTSP
Expand Down
6 changes: 3 additions & 3 deletions internal/conf/conf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,14 @@ func TestConfErrors(t *testing.T) {
"invalid srt publish passphrase",
"paths:\n" +
" mypath:\n" +
" publishSRTPassphrase: a\n",
`invalid 'publishSRTPassphrase': must be between 10 and 79 characters`,
" srtPublishPassphrase: a\n",
`invalid 'srtPublishPassphrase': must be between 10 and 79 characters`,
},
{
"invalid srt read passphrase",
"paths:\n" +
" mypath:\n" +
" readSRTPassphrase: a\n",
" srtReadPassphrase: a\n",
`invalid 'readRTPassphrase': must be between 10 and 79 characters`,
},
} {
Expand Down
14 changes: 7 additions & 7 deletions internal/conf/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ type PathConf struct {
RtspRangeStart string `json:"rtspRangeStart"`

// SRT
PublishSRTPassphrase string `json:"publishSRTPassphrase"`
ReadSRTPassphrase string `json:"readSRTPassphrase"`
SRTPublishPassphrase string `json:"srtPublishPassphrase"`
SRTReadPassphrase string `json:"srtReadPassphrase"`

// Redirect
SourceRedirect string `json:"sourceRedirect"`
Expand Down Expand Up @@ -378,14 +378,14 @@ func (pconf *PathConf) check(conf *Conf, name string) error {

// SRT

if pconf.PublishSRTPassphrase != "" {
err := srtCheckPassphrase(pconf.PublishSRTPassphrase)
if pconf.SRTPublishPassphrase != "" {
err := srtCheckPassphrase(pconf.SRTPublishPassphrase)
if err != nil {
return fmt.Errorf("invalid 'publishSRTPassphrase': %v", err)
return fmt.Errorf("invalid 'srtPublishPassphrase': %v", err)
}
}
if pconf.ReadSRTPassphrase != "" {
err := srtCheckPassphrase(pconf.ReadSRTPassphrase)
if pconf.SRTReadPassphrase != "" {
err := srtCheckPassphrase(pconf.SRTReadPassphrase)
if err != nil {
return fmt.Errorf("invalid 'readRTPassphrase': %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/core/srt_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func (c *srtConn) runPublish(req srtNewConnReq, pathName string, user string, pa

defer res.path.removePublisher(pathRemovePublisherReq{author: c})

err := srtCheckPassphrase(req.connReq, res.path.conf.PublishSRTPassphrase)
err := srtCheckPassphrase(req.connReq, res.path.conf.SRTPublishPassphrase)
if err != nil {
return false, err
}

Check warning on line 245 in internal/core/srt_conn.go

View check run for this annotation

Codecov / codecov/patch

internal/core/srt_conn.go#L244-L245

Added lines #L244 - L245 were not covered by tests
Expand Down Expand Up @@ -336,7 +336,7 @@ func (c *srtConn) runRead(req srtNewConnReq, pathName string, user string, pass

defer res.path.removeReader(pathRemoveReaderReq{author: c})

err := srtCheckPassphrase(req.connReq, res.path.conf.ReadSRTPassphrase)
err := srtCheckPassphrase(req.connReq, res.path.conf.SRTReadPassphrase)
if err != nil {
return false, err
}

Check warning on line 342 in internal/core/srt_conn.go

View check run for this annotation

Codecov / codecov/patch

internal/core/srt_conn.go#L341-L342

Added lines #L341 - L342 were not covered by tests
Expand Down
4 changes: 2 additions & 2 deletions internal/core/srt_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ func TestSRTServer(t *testing.T) {

switch ca {
case "publish passphrase":
conf += " publishSRTPassphrase: 123456789abcde"
conf += " srtPublishPassphrase: 123456789abcde"

case "read passphrase":
conf += " readSRTPassphrase: 123456789abcde"
conf += " srtReadPassphrase: 123456789abcde"
}

p, ok := newInstance(conf)
Expand Down
4 changes: 2 additions & 2 deletions mediamtx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,9 @@ paths:
# It can be can be a relative path (i.e. /otherstream) or an absolute RTSP URL.
fallback:
# SRT encryption passphrase required to publish on this path
publishSRTPassphrase:
srtPublishPassphrase:
# SRT encryption passphrase require to read from this path
readSRTPassphrase:
srtReadPassphrase:

###############################################
# RTSP path settings (when source is a RTSP or a RTSPS URL)
Expand Down

0 comments on commit 79c49c2

Please sign in to comment.