Files
mediamtx/internal/defs/api_hls.go
T
Alessandro RosandGitHub f87d9e659e hls: track sessions (#962) (#5683)
sessions are now tracked through cookies or query parameters.

This provides the ability to inspect sessions through logs, metrics and
API, allows more precise tracking of outbound bytes, decreases load on
external HTTP authentication URLs since they are now called once per
session and not once per request.
2026-04-25 21:10:34 +02:00

53 lines
1.5 KiB
Go

package defs
import (
"time"
"github.com/google/uuid"
)
// APIHLSServer contains methods used by the API and Metrics server.
type APIHLSServer interface {
APISessionsList() (*APIHLSSessionList, error)
APISessionsGet(uuid.UUID) (*APIHLSSession, error)
APISessionsKick(uuid.UUID) error
APIMuxersList() (*APIHLSMuxerList, error)
APIMuxersGet(string) (*APIHLSMuxer, error)
}
// APIHLSSessionList is a list of HLS sessions.
type APIHLSSessionList struct {
ItemCount int `json:"itemCount"`
PageCount int `json:"pageCount"`
Items []APIHLSSession `json:"items"`
}
// APIHLSSession is an HLS session.
type APIHLSSession struct {
ID uuid.UUID `json:"id"`
Created time.Time `json:"created"`
RemoteAddr string `json:"remoteAddr"`
Path string `json:"path"`
Query string `json:"query"`
User string `json:"user"`
OutboundBytes uint64 `json:"outboundBytes"`
}
// APIHLSMuxerList is a list of HLS muxers.
type APIHLSMuxerList struct {
ItemCount int `json:"itemCount"`
PageCount int `json:"pageCount"`
Items []APIHLSMuxer `json:"items"`
}
// APIHLSMuxer is an HLS muxer.
type APIHLSMuxer struct {
Path string `json:"path"`
Created time.Time `json:"created"`
LastRequest time.Time `json:"lastRequest"`
OutboundBytes uint64 `json:"outboundBytes"`
OutboundFramesDiscarded uint64 `json:"outboundFramesDiscarded"`
// deprecated
BytesSent uint64 `json:"bytesSent" deprecated:"true"`
}