Files
mediamtx/internal/defs/api_path.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

92 lines
3.6 KiB
Go

package defs
import (
"time"
)
// APIPathManager contains methods used by the API and Metrics server.
type APIPathManager interface {
APIPathsList() (*APIPathList, error)
APIPathsGet(string) (*APIPath, error)
}
// APIPathSourceType is the type of a path source.
type APIPathSourceType string
// source types.
const (
APIPathSourceTypeHLSSource APIPathSourceType = "hlsSource"
APIPathSourceTypeRedirect APIPathSourceType = "redirect"
APIPathSourceTypeRPICameraSource APIPathSourceType = "rpiCameraSource"
APIPathSourceTypeRTMPConn APIPathSourceType = "rtmpConn"
APIPathSourceTypeRTMPSConn APIPathSourceType = "rtmpsConn"
APIPathSourceTypeRTMPSource APIPathSourceType = "rtmpSource"
APIPathSourceTypeRTSPSession APIPathSourceType = "rtspSession"
APIPathSourceTypeRTSPSource APIPathSourceType = "rtspSource"
APIPathSourceTypeRTSPSSession APIPathSourceType = "rtspsSession"
APIPathSourceTypeSRTConn APIPathSourceType = "srtConn"
APIPathSourceTypeSRTSource APIPathSourceType = "srtSource"
APIPathSourceTypeMPEGTSSource APIPathSourceType = "mpegtsSource"
APIPathSourceTypeRTPSource APIPathSourceType = "rtpSource"
APIPathSourceTypeWebRTCSession APIPathSourceType = "webRTCSession"
APIPathSourceTypeWebRTCSource APIPathSourceType = "webRTCSource"
)
// APIPathSource is a source.
type APIPathSource struct {
Type APIPathSourceType `json:"type"`
ID string `json:"id"`
}
// APIPathReaderType is the type of a path reader.
type APIPathReaderType string
// reader types.
const (
APIPathReaderTypeHLSSession APIPathReaderType = "hlsSession"
APIPathReaderTypeRTMPConn APIPathReaderType = "rtmpConn"
APIPathReaderTypeRTMPSConn APIPathReaderType = "rtmpsConn"
APIPathReaderTypeRTSPConn APIPathReaderType = "rtspConn"
APIPathReaderTypeRTSPSession APIPathReaderType = "rtspSession"
APIPathReaderTypeRTSPSConn APIPathReaderType = "rtspsConn"
APIPathReaderTypeRTSPSSession APIPathReaderType = "rtspsSession"
APIPathReaderTypeSRTConn APIPathReaderType = "srtConn"
APIPathReaderTypeWebRTCSession APIPathReaderType = "webRTCSession"
APIPathReaderTypeHidden APIPathReaderType = "hidden"
)
// APIPathReader is a reader.
type APIPathReader struct {
Type APIPathReaderType `json:"type"`
ID string `json:"id"`
}
// APIPath is a path.
type APIPath struct {
Name string `json:"name"`
ConfName string `json:"confName"`
Ready bool `json:"ready" deprecated:"true"`
ReadyTime *time.Time `json:"readyTime" deprecated:"true"`
Available bool `json:"available"`
AvailableTime *time.Time `json:"availableTime"`
Online bool `json:"online"`
OnlineTime *time.Time `json:"onlineTime"`
Source *APIPathSource `json:"source"`
Tracks []APIPathTrackCodec `json:"tracks" deprecated:"true"`
Tracks2 []APIPathTrack `json:"tracks2"`
Readers []APIPathReader `json:"readers"`
InboundBytes uint64 `json:"inboundBytes"`
OutboundBytes uint64 `json:"outboundBytes"`
InboundFramesInError uint64 `json:"inboundFramesInError"`
// deprecated
BytesReceived uint64 `json:"bytesReceived" deprecated:"true"`
BytesSent uint64 `json:"bytesSent" deprecated:"true"`
}
// APIPathList is a list of paths.
type APIPathList struct {
ItemCount int `json:"itemCount"`
PageCount int `json:"pageCount"`
Items []APIPath `json:"items"`
}