Browse Source

require sourceRedirect if source is redirect

pull/169/head
aler9 5 years ago
parent
commit
0c1b13fa82
  1. 19
      conf/pathconf.go

19
conf/pathconf.go

@ -63,7 +63,7 @@ func (pconf *PathConf) fillAndCheck(name string) error { @@ -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 { @@ -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,16 +112,21 @@ func (pconf *PathConf) fillAndCheck(name string) error { @@ -112,16 +112,21 @@ func (pconf *PathConf) fillAndCheck(name string) error {
} else if pconf.Source == "record" {
} else if pconf.Source == "redirect" {
} else {
return fmt.Errorf("unsupported source: '%s'", pconf.Source)
if pconf.SourceRedirect == "" {
return fmt.Errorf("source redirect must be filled")
}
if pconf.SourceRedirect != "" {
_, err := url.Parse(pconf.SourceRedirect)
if err != nil {
return fmt.Errorf("'%s' is not a valid url", pconf.SourceRedirect)
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.PublishUser != "" {

Loading…
Cancel
Save