Skip to content

Commit

Permalink
reorganize conf
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Jul 30, 2020
1 parent 7ec3f77 commit fb81ffc
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 41 deletions.
56 changes: 28 additions & 28 deletions conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,37 @@ import (
)

type confPath struct {
Source string `yaml:"source"`
sourceUrl *url.URL
SourceProtocol string `yaml:"sourceProtocol"`
sourceProtocolParsed gortsplib.StreamProtocol
SourceOnDemand bool `yaml:"sourceOnDemand"`
PublishUser string `yaml:"publishUser"`
PublishPass string `yaml:"publishPass"`
PublishIps []string `yaml:"publishIps"`
publishIpsParsed []interface{}
ReadUser string `yaml:"readUser"`
ReadPass string `yaml:"readPass"`
ReadIps []string `yaml:"readIps"`
readIpsParsed []interface{}
RunOnDemand string `yaml:"runOnDemand"`
RunOnPublish string `yaml:"runOnPublish"`
RunOnRead string `yaml:"runOnRead"`
Source string `yaml:"source"`
sourceUrl *url.URL ``
SourceProtocol string `yaml:"sourceProtocol"`
sourceProtocolParsed gortsplib.StreamProtocol ``
SourceOnDemand bool `yaml:"sourceOnDemand"`
RunOnDemand string `yaml:"runOnDemand"`
RunOnPublish string `yaml:"runOnPublish"`
RunOnRead string `yaml:"runOnRead"`
PublishUser string `yaml:"publishUser"`
PublishPass string `yaml:"publishPass"`
PublishIps []string `yaml:"publishIps"`
publishIpsParsed []interface{} ``
ReadUser string `yaml:"readUser"`
ReadPass string `yaml:"readPass"`
ReadIps []string `yaml:"readIps"`
readIpsParsed []interface{} ``
}

type conf struct {
Protocols []string `yaml:"protocols"`
protocolsParsed map[gortsplib.StreamProtocol]struct{}
RtspPort int `yaml:"rtspPort"`
RtpPort int `yaml:"rtpPort"`
RtcpPort int `yaml:"rtcpPort"`
RunOnConnect string `yaml:"runOnConnect"`
ReadTimeout time.Duration `yaml:"readTimeout"`
WriteTimeout time.Duration `yaml:"writeTimeout"`
AuthMethods []string `yaml:"authMethods"`
authMethodsParsed []gortsplib.AuthMethod
Pprof bool `yaml:"pprof"`
Paths map[string]*confPath `yaml:"paths"`
Protocols []string `yaml:"protocols"`
protocolsParsed map[gortsplib.StreamProtocol]struct{} ``
RtspPort int `yaml:"rtspPort"`
RtpPort int `yaml:"rtpPort"`
RtcpPort int `yaml:"rtcpPort"`
RunOnConnect string `yaml:"runOnConnect"`
ReadTimeout time.Duration `yaml:"readTimeout"`
WriteTimeout time.Duration `yaml:"writeTimeout"`
AuthMethods []string `yaml:"authMethods"`
authMethodsParsed []gortsplib.AuthMethod ``
Pprof bool `yaml:"pprof"`
Paths map[string]*confPath `yaml:"paths"`
}

func loadConf(fpath string, stdin io.Reader) (*conf, error) {
Expand Down
26 changes: 13 additions & 13 deletions rtsp-simple-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ paths:
# is connected, saving bandwidth
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
publishUser:
# password required to publish
Expand All @@ -47,16 +60,3 @@ paths:
readPass:
# IPs or networks (x.x.x.x/24) allowed to read
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:

0 comments on commit fb81ffc

Please sign in to comment.