Browse Source

run gofmt

pull/2/head
aler9 5 years ago
parent
commit
3617e544c9
  1. 28
      client.go
  2. 8
      main.go

28
client.go

@ -164,14 +164,14 @@ func (c *client) log(format string, args ...interface{}) { @@ -164,14 +164,14 @@ func (c *client) log(format string, args ...interface{}) {
func (c *client) run() {
defer func() {
if c.p.postScript != "" {
postScript := exec.Command(c.p.postScript)
err := postScript.Run()
if err != nil {
c.log("ERR: %s", err)
}
}
}()
if c.p.postScript != "" {
postScript := exec.Command(c.p.postScript)
err := postScript.Run()
if err != nil {
c.log("ERR: %s", err)
}
}
}()
defer c.log("disconnected")
@ -187,12 +187,12 @@ func (c *client) run() { @@ -187,12 +187,12 @@ func (c *client) run() {
c.log("connected")
if c.p.preScript != "" {
preScript := exec.Command(c.p.preScript)
err := preScript.Run()
if err != nil {
c.log("ERR: %s", err)
}
}
preScript := exec.Command(c.p.preScript)
err := preScript.Run()
if err != nil {
c.log("ERR: %s", err)
}
}
for {
req, err := c.conn.ReadRequest()

8
main.go

@ -54,7 +54,7 @@ type program struct { @@ -54,7 +54,7 @@ type program struct {
rtpPort int
rtcpPort int
publishKey string
preScript string
preScript string
postScript string
mutex sync.RWMutex
rtspl *serverTcpListener
@ -112,8 +112,8 @@ func newProgram(protocolsStr string, rtspPort int, rtpPort int, rtcpPort int, pu @@ -112,8 +112,8 @@ func newProgram(protocolsStr string, rtspPort int, rtpPort int, rtcpPort int, pu
if preScript != "" {
if runtime.GOOS != "linux" {
return nil, fmt.Errorf("connect script currenty supported only on Linux")
} else if !regexp.MustCompile(`(?m)^(.+)\/([^/]+)$`).MatchString(preScript) {
return nil, fmt.Errorf("connect script must be a valid path")
} else if !regexp.MustCompile(`(?m)^(.+)\/([^/]+)$`).MatchString(preScript) {
return nil, fmt.Errorf("connect script must be a valid path")
}
}
@ -121,7 +121,7 @@ func newProgram(protocolsStr string, rtspPort int, rtpPort int, rtcpPort int, pu @@ -121,7 +121,7 @@ func newProgram(protocolsStr string, rtspPort int, rtpPort int, rtcpPort int, pu
if runtime.GOOS != "linux" {
return nil, fmt.Errorf("disconnect script currently supported only on Linux")
} else if !regexp.MustCompile(`(?m)^(.+)\/([^/]+)$`).MatchString(postScript) {
return nil, fmt.Errorf("disconnect script must be a valid path")
return nil, fmt.Errorf("disconnect script must be a valid path")
}
}

Loading…
Cancel
Save