Browse Source

reorganize conf

pull/52/head v0.9.5
aler9 5 years ago
parent
commit
fb81ffc930
  1. 56
      conf.go
  2. 26
      rtsp-simple-server.yml

56
conf.go

@ -13,37 +13,37 @@ import (
) )
type confPath struct { type confPath struct {
Source string `yaml:"source"` Source string `yaml:"source"`
sourceUrl *url.URL sourceUrl *url.URL ``
SourceProtocol string `yaml:"sourceProtocol"` SourceProtocol string `yaml:"sourceProtocol"`
sourceProtocolParsed gortsplib.StreamProtocol sourceProtocolParsed gortsplib.StreamProtocol ``
SourceOnDemand bool `yaml:"sourceOnDemand"` SourceOnDemand bool `yaml:"sourceOnDemand"`
PublishUser string `yaml:"publishUser"` RunOnDemand string `yaml:"runOnDemand"`
PublishPass string `yaml:"publishPass"` RunOnPublish string `yaml:"runOnPublish"`
PublishIps []string `yaml:"publishIps"` RunOnRead string `yaml:"runOnRead"`
publishIpsParsed []interface{} PublishUser string `yaml:"publishUser"`
ReadUser string `yaml:"readUser"` PublishPass string `yaml:"publishPass"`
ReadPass string `yaml:"readPass"` PublishIps []string `yaml:"publishIps"`
ReadIps []string `yaml:"readIps"` publishIpsParsed []interface{} ``
readIpsParsed []interface{} ReadUser string `yaml:"readUser"`
RunOnDemand string `yaml:"runOnDemand"` ReadPass string `yaml:"readPass"`
RunOnPublish string `yaml:"runOnPublish"` ReadIps []string `yaml:"readIps"`
RunOnRead string `yaml:"runOnRead"` readIpsParsed []interface{} ``
} }
type conf struct { type conf struct {
Protocols []string `yaml:"protocols"` Protocols []string `yaml:"protocols"`
protocolsParsed map[gortsplib.StreamProtocol]struct{} protocolsParsed map[gortsplib.StreamProtocol]struct{} ``
RtspPort int `yaml:"rtspPort"` RtspPort int `yaml:"rtspPort"`
RtpPort int `yaml:"rtpPort"` RtpPort int `yaml:"rtpPort"`
RtcpPort int `yaml:"rtcpPort"` RtcpPort int `yaml:"rtcpPort"`
RunOnConnect string `yaml:"runOnConnect"` RunOnConnect string `yaml:"runOnConnect"`
ReadTimeout time.Duration `yaml:"readTimeout"` ReadTimeout time.Duration `yaml:"readTimeout"`
WriteTimeout time.Duration `yaml:"writeTimeout"` WriteTimeout time.Duration `yaml:"writeTimeout"`
AuthMethods []string `yaml:"authMethods"` AuthMethods []string `yaml:"authMethods"`
authMethodsParsed []gortsplib.AuthMethod authMethodsParsed []gortsplib.AuthMethod ``
Pprof bool `yaml:"pprof"` Pprof bool `yaml:"pprof"`
Paths map[string]*confPath `yaml:"paths"` Paths map[string]*confPath `yaml:"paths"`
} }
func loadConf(fpath string, stdin io.Reader) (*conf, error) { func loadConf(fpath string, stdin io.Reader) (*conf, error) {

26
rtsp-simple-server.yml

@ -34,6 +34,19 @@ paths:
# is connected, saving bandwidth # is connected, saving bandwidth
sourceOnDemand: no sourceOnDemand: no
# command to run when this path is requested.
# This can be used, for example, to publish a stream on demand.
# This is terminated with SIGINT when the path is not requested anymore.
runOnDemand:
# command to run when a client starts publishing.
# This is terminated with SIGINT when a client stops publishing.
runOnPublish:
# command to run when a clients starts reading.
# This is terminated with SIGINT when a client stops reading.
runOnRead:
# username required to publish # username required to publish
publishUser: publishUser:
# password required to publish # password required to publish
@ -47,16 +60,3 @@ paths:
readPass: readPass:
# IPs or networks (x.x.x.x/24) allowed to read # IPs or networks (x.x.x.x/24) allowed to read
readIps: [] readIps: []
# command to run when this path is requested.
# This can be used, for example, to publish a stream on demand.
# This is terminated with SIGINT when the path is not requested anymore.
runOnDemand:
# command to run when a client starts publishing.
# This is terminated with SIGINT when a client stops publishing.
runOnPublish:
# command to run when a clients starts reading.
# This is terminated with SIGINT when a client stops reading.
runOnRead:

Loading…
Cancel
Save