mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-24 20:11:56 -08:00
require sourceRedirect if source is redirect
This commit is contained in:
parent
f5ec679187
commit
0c1b13fa82
1 changed files with 14 additions and 9 deletions
|
|
@ -63,7 +63,7 @@ func (pconf *PathConf) fillAndCheck(name string) error {
|
|||
|
||||
u, err := url.Parse(pconf.Source)
|
||||
if err != nil {
|
||||
return fmt.Errorf("'%s' is not a valid url", pconf.Source)
|
||||
return fmt.Errorf("'%s' is not a valid rtsp url", pconf.Source)
|
||||
}
|
||||
|
||||
if u.User != nil {
|
||||
|
|
@ -97,7 +97,7 @@ func (pconf *PathConf) fillAndCheck(name string) error {
|
|||
|
||||
u, err := url.Parse(pconf.Source)
|
||||
if err != nil {
|
||||
return fmt.Errorf("'%s' is not a valid url", pconf.Source)
|
||||
return fmt.Errorf("'%s' is not a valid rtmp url", pconf.Source)
|
||||
}
|
||||
|
||||
if u.User != nil {
|
||||
|
|
@ -112,18 +112,23 @@ func (pconf *PathConf) fillAndCheck(name string) error {
|
|||
} else if pconf.Source == "record" {
|
||||
|
||||
} else if pconf.Source == "redirect" {
|
||||
if pconf.SourceRedirect == "" {
|
||||
return fmt.Errorf("source redirect must be filled")
|
||||
}
|
||||
|
||||
_, err := url.Parse(pconf.SourceRedirect)
|
||||
if err != nil {
|
||||
return fmt.Errorf("'%s' is not a valid rtsp url", pconf.SourceRedirect)
|
||||
}
|
||||
|
||||
if u.Scheme != "rtsp" {
|
||||
return fmt.Errorf("'%s' is not a valid rtsp url", pconf.SourceRedirect)
|
||||
}
|
||||
|
||||
} else {
|
||||
return fmt.Errorf("unsupported source: '%s'", pconf.Source)
|
||||
}
|
||||
|
||||
if pconf.SourceRedirect != "" {
|
||||
_, err := url.Parse(pconf.SourceRedirect)
|
||||
if err != nil {
|
||||
return fmt.Errorf("'%s' is not a valid url", pconf.SourceRedirect)
|
||||
}
|
||||
}
|
||||
|
||||
if pconf.PublishUser != "" {
|
||||
if !regexp.MustCompile("^[a-zA-Z0-9]+$").MatchString(pconf.PublishUser) {
|
||||
return fmt.Errorf("publish username must be alphanumeric")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue