Skip to content

Commit

Permalink
Merge pull request deepch#298 from mboekhold/error_logging_unauthorized
Browse files Browse the repository at this point in the history
Add unauthorized error to logging information
  • Loading branch information
deepch authored Feb 22, 2023
2 parents bc824b2 + 3729499 commit 67af21b
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion apiHTTPHLS.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func HTTPAPIServerStreamHLSM3U8(c *gin.Context) {
if !RemoteAuthorization("HLS", c.Param("uuid"), c.Param("channel"), c.Param("token"), c.ClientIP()) {
requestLogger.WithFields(logrus.Fields{
"call": "RemoteAuthorization",
}).Errorln(ErrorStreamNotFound.Error())
}).Errorln(ErrorStreamUnauthorized.Error())
return
}

Expand Down
2 changes: 1 addition & 1 deletion apiHTTPHLSLL.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func HTTPAPIServerStreamHLSLLInit(c *gin.Context) {
if !RemoteAuthorization("HLS", c.Param("uuid"), c.Param("channel"), c.Param("token"), c.ClientIP()) {
requestLogger.WithFields(logrus.Fields{
"call": "RemoteAuthorization",
}).Errorln(ErrorStreamNotFound.Error())
}).Errorln(ErrorStreamUnauthorized.Error())
return
}

Expand Down
2 changes: 1 addition & 1 deletion apiHTTPMSE.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func HTTPAPIServerStreamMSE(c *gin.Context) {
if !RemoteAuthorization("WS", c.Param("uuid"), c.Param("channel"), c.Param("token"), c.ClientIP()) {
requestLogger.WithFields(logrus.Fields{
"call": "RemoteAuthorization",
}).Errorln(ErrorStreamNotFound.Error())
}).Errorln(ErrorStreamUnauthorized.Error())
return
}

Expand Down
4 changes: 2 additions & 2 deletions apiHTTPWebRTC.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ func HTTPAPIServerStreamWebRTC(c *gin.Context) {
if !RemoteAuthorization("WebRTC", c.Param("uuid"), c.Param("channel"), c.Query("token"), c.ClientIP()) {
requestLogger.WithFields(logrus.Fields{
"call": "RemoteAuthorization",
}).Errorln(ErrorStreamNotFound.Error())
}).Errorln(ErrorStreamUnauthorized.Error())
return
}

Storage.StreamChannelRun(c.Param("uuid"), c.Param("channel"))
codecs, err := Storage.StreamChannelCodecs(c.Param("uuid"), c.Param("channel"))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion serverRTSP.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func RTSPServerClientHandle(conn net.Conn) {
"channel": channel,
"func": "handleRTSPServerRequest",
"call": "StreamChannelExist",
}).Errorln(ErrorStreamNotFound.Error())
}).Errorln(ErrorStreamUnauthorized.Error())
err = RTSPServerClientResponse(uuid, channel, conn, 401, map[string]string{"CSeq": strconv.Itoa(cSEQ)})
if err != nil {
return
Expand Down
1 change: 1 addition & 0 deletions storageStruct.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var (
ErrorStreamChannelNotFound = errors.New("stream channel not found")
ErrorStreamChannelCodecNotFound = errors.New("stream channel codec not ready, possible stream offline")
ErrorStreamsLen0 = errors.New("streams len zero")
ErrorStreamUnauthorized = errors.New("stream request unauthorized")
)

//StorageST main storage struct
Expand Down

0 comments on commit 67af21b

Please sign in to comment.