Surface user agent in the auth HTTP webhook payload as "userAgent" and in the API structs for RTMP, RTSP, WebRTC and HLS connections. --------- Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
50 lines
1.6 KiB
Go
50 lines
1.6 KiB
Go
package defs
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// APIRTMPServer contains methods used by the API and Metrics server.
|
|
type APIRTMPServer interface {
|
|
APIConnsList() (*APIRTMPConnList, error)
|
|
APIConnsGet(uuid.UUID) (*APIRTMPConn, error)
|
|
APIConnsKick(uuid.UUID) error
|
|
}
|
|
|
|
// APIRTMPConnState is the state of a RTMP connection.
|
|
type APIRTMPConnState string
|
|
|
|
// states.
|
|
const (
|
|
APIRTMPConnStateIdle APIRTMPConnState = "idle"
|
|
APIRTMPConnStateRead APIRTMPConnState = "read"
|
|
APIRTMPConnStatePublish APIRTMPConnState = "publish"
|
|
)
|
|
|
|
// APIRTMPConn is a RTMP connection.
|
|
type APIRTMPConn struct {
|
|
ID uuid.UUID `json:"id"`
|
|
Created time.Time `json:"created"`
|
|
RemoteAddr string `json:"remoteAddr"`
|
|
State APIRTMPConnState `json:"state"`
|
|
Path string `json:"path"`
|
|
Query string `json:"query"`
|
|
User string `json:"user"`
|
|
UserAgent string `json:"userAgent"`
|
|
InboundBytes uint64 `json:"inboundBytes"`
|
|
OutboundBytes uint64 `json:"outboundBytes"`
|
|
OutboundFramesDiscarded uint64 `json:"outboundFramesDiscarded"`
|
|
// deprecated
|
|
BytesReceived uint64 `json:"bytesReceived" deprecated:"true"`
|
|
BytesSent uint64 `json:"bytesSent" deprecated:"true"`
|
|
}
|
|
|
|
// APIRTMPConnList is a list of RTMP connections.
|
|
type APIRTMPConnList struct {
|
|
ItemCount int `json:"itemCount"`
|
|
PageCount int `json:"pageCount"`
|
|
Items []APIRTMPConn `json:"items"`
|
|
}
|