mirror of
https://github.com/aler9/rtsp-simple-server
synced 2025-10-09 01:20:21 +08:00
api, metrics: add endpoints and metrics for RTSP connections (#1233)
new API endpoints: * /v1/rtspconns/list * /v1/rtspsconns/list new metrics: * rtsp_conns * rtsps_conns
This commit is contained in:
@@ -314,8 +314,11 @@ func (s *rtmpServer) connClose(c *rtmpConn) {
|
||||
}
|
||||
|
||||
// apiConnsList is called by api.
|
||||
func (s *rtmpServer) apiConnsList(req rtmpServerAPIConnsListReq) rtmpServerAPIConnsListRes {
|
||||
req.res = make(chan rtmpServerAPIConnsListRes)
|
||||
func (s *rtmpServer) apiConnsList() rtmpServerAPIConnsListRes {
|
||||
req := rtmpServerAPIConnsListReq{
|
||||
res: make(chan rtmpServerAPIConnsListRes),
|
||||
}
|
||||
|
||||
select {
|
||||
case s.chAPIConnsList <- req:
|
||||
return <-req.res
|
||||
@@ -326,8 +329,12 @@ func (s *rtmpServer) apiConnsList(req rtmpServerAPIConnsListReq) rtmpServerAPICo
|
||||
}
|
||||
|
||||
// apiConnsKick is called by api.
|
||||
func (s *rtmpServer) apiConnsKick(req rtmpServerAPIConnsKickReq) rtmpServerAPIConnsKickRes {
|
||||
req.res = make(chan rtmpServerAPIConnsKickRes)
|
||||
func (s *rtmpServer) apiConnsKick(id string) rtmpServerAPIConnsKickRes {
|
||||
req := rtmpServerAPIConnsKickReq{
|
||||
id: id,
|
||||
res: make(chan rtmpServerAPIConnsKickRes),
|
||||
}
|
||||
|
||||
select {
|
||||
case s.chAPIConnsKick <- req:
|
||||
return <-req.res
|
||||
|
Reference in New Issue
Block a user