conf

package
v1.20.1-soundar.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

Package conf contains the struct that holds the configuration of the software.

Index

Constants

This section is empty.

Variables

View Source
var ErrPathNotFound = errors.New("path not found")

ErrPathNotFound is returned when a path is not found.

Functions

func IsValidPathName

func IsValidPathName(name string) error

IsValidPathName checks whether the path name is valid.

Types

type AlwaysAvailableTrack

type AlwaysAvailableTrack struct {
	Codec        AlwaysAvailableTrackCodec `json:"codec"`
	SampleRate   int                       `json:"sampleRate"`
	ChannelCount int                       `json:"channelCount"`
	MULaw        bool                      `json:"muLaw"`
}

AlwaysAvailableTrack is an item of alwaysAvailableTracks.

func (*AlwaysAvailableTrack) UnmarshalJSON

func (t *AlwaysAvailableTrack) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type AlwaysAvailableTrackCodec

type AlwaysAvailableTrackCodec string

AlwaysAvailableTrackCodec is a codec of AlwaysAvailableTrack.

const (
	CodecAV1        AlwaysAvailableTrackCodec = "AV1"
	CodecVP9        AlwaysAvailableTrackCodec = "VP9"
	CodecH265       AlwaysAvailableTrackCodec = "H265"
	CodecH264       AlwaysAvailableTrackCodec = "H264"
	CodecMPEG4Audio AlwaysAvailableTrackCodec = "MPEG4Audio"
	CodecOpus       AlwaysAvailableTrackCodec = "Opus"
	CodecG711       AlwaysAvailableTrackCodec = "G711"
	CodecLPCM       AlwaysAvailableTrackCodec = "LPCM"
)

available codecs.

func (*AlwaysAvailableTrackCodec) UnmarshalEnv

func (d *AlwaysAvailableTrackCodec) UnmarshalEnv(_ string, v string) error

UnmarshalEnv implements env.Unmarshaler.

type AuthAction

type AuthAction string

AuthAction is an authentication action.

const (
	AuthActionPublish  AuthAction = "publish"
	AuthActionRead     AuthAction = "read"
	AuthActionPlayback AuthAction = "playback"
	AuthActionAPI      AuthAction = "api"
	AuthActionMetrics  AuthAction = "metrics"
	AuthActionPprof    AuthAction = "pprof"
)

auth actions

func (*AuthAction) UnmarshalEnv

func (d *AuthAction) UnmarshalEnv(_ string, v string) error

UnmarshalEnv implements env.Unmarshaler.

func (*AuthAction) UnmarshalJSON

func (d *AuthAction) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type AuthInternalUser

type AuthInternalUser struct {
	User        Credential                   `json:"user"`
	Pass        Credential                   `json:"pass"`
	IPs         IPNetworks                   `json:"ips"`
	Permissions []AuthInternalUserPermission `json:"permissions"`
}

AuthInternalUser is an user.

type AuthInternalUserPermission

type AuthInternalUserPermission struct {
	Action AuthAction `json:"action"`
	Path   string     `json:"path"`
}

AuthInternalUserPermission is a permission of a user.

type AuthMethod

type AuthMethod string

AuthMethod is an authentication method.

const (
	AuthMethodInternal AuthMethod = "internal"
	AuthMethodHTTP     AuthMethod = "http"
	AuthMethodJWT      AuthMethod = "jwt"
)

authentication methods.

func (*AuthMethod) UnmarshalEnv

func (d *AuthMethod) UnmarshalEnv(_ string, v string) error

UnmarshalEnv implements env.Unmarshaler.

func (*AuthMethod) UnmarshalJSON

func (d *AuthMethod) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Conf

type Conf struct {
	// General
	LogLevel            LogLevel        `json:"logLevel"`
	LogDestinations     LogDestinations `json:"logDestinations"`
	LogStructured       bool            `json:"logStructured"`
	LogFile             string          `json:"logFile"`
	SysLogPrefix        string          `json:"sysLogPrefix"`
	DumpPackets         bool            `json:"dumpPackets"`
	ReadTimeout         Duration        `json:"readTimeout"`
	WriteTimeout        Duration        `json:"writeTimeout"`
	ReadBufferCount     *int            `json:"readBufferCount,omitempty" deprecated:"true"`
	WriteQueueSize      int             `json:"writeQueueSize"`
	UDPMaxPayloadSize   int             `json:"udpMaxPayloadSize"`
	UDPReadBufferSize   uint            `json:"udpReadBufferSize"`
	RunOnConnect        string          `json:"runOnConnect"`
	RunOnConnectRestart bool            `json:"runOnConnectRestart"`
	RunOnDisconnect     string          `json:"runOnDisconnect"`

	// Authentication
	AuthMethod                AuthMethod                   `json:"authMethod"`
	AuthInternalUsers         []AuthInternalUser           `json:"authInternalUsers"`
	AuthHTTPAddress           string                       `json:"authHTTPAddress"`
	ExternalAuthenticationURL *string                      `json:"externalAuthenticationURL,omitempty" deprecated:"true"`
	AuthHTTPFingerprint       string                       `json:"authHTTPFingerprint"`
	AuthHTTPExclude           []AuthInternalUserPermission `json:"authHTTPExclude"`
	AuthJWTJWKS               string                       `json:"authJWTJWKS"`
	AuthJWTJWKSFingerprint    string                       `json:"authJWTJWKSFingerprint"`
	AuthJWTClaimKey           string                       `json:"authJWTClaimKey"`
	AuthJWTExclude            []AuthInternalUserPermission `json:"authJWTExclude"`
	AuthJWTInHTTPQuery        *bool                        `json:"authJWTInHTTPQuery,omitempty" deprecated:"true"`
	AuthJWTIssuer             string                       `json:"authJWTIssuer"`
	AuthJWTAudience           string                       `json:"authJWTAudience"`

	// Control API
	API               bool       `json:"api"`
	APIAddress        string     `json:"apiAddress"`
	APIEncryption     bool       `json:"apiEncryption"`
	APIServerKey      string     `json:"apiServerKey"`
	APIServerCert     string     `json:"apiServerCert"`
	APIAllowOrigin    *string    `json:"apiAllowOrigin,omitempty" deprecated:"true"`
	APIAllowOrigins   []string   `json:"apiAllowOrigins"`
	APITrustedProxies IPNetworks `json:"apiTrustedProxies"`

	// Metrics
	Metrics               bool       `json:"metrics"`
	MetricsAddress        string     `json:"metricsAddress"`
	MetricsEncryption     bool       `json:"metricsEncryption"`
	MetricsServerKey      string     `json:"metricsServerKey"`
	MetricsServerCert     string     `json:"metricsServerCert"`
	MetricsAllowOrigin    *string    `json:"metricsAllowOrigin,omitempty" deprecated:"true"`
	MetricsAllowOrigins   []string   `json:"metricsAllowOrigins"`
	MetricsTrustedProxies IPNetworks `json:"metricsTrustedProxies"`

	// PPROF
	PPROF               bool       `json:"pprof"`
	PPROFAddress        string     `json:"pprofAddress"`
	PPROFEncryption     bool       `json:"pprofEncryption"`
	PPROFServerKey      string     `json:"pprofServerKey"`
	PPROFServerCert     string     `json:"pprofServerCert"`
	PPROFAllowOrigin    *string    `json:"pprofAllowOrigin,omitempty" deprecated:"true"`
	PPROFAllowOrigins   []string   `json:"pprofAllowOrigins"`
	PPROFTrustedProxies IPNetworks `json:"pprofTrustedProxies"`

	// Playback
	Playback               bool       `json:"playback"`
	PlaybackAddress        string     `json:"playbackAddress"`
	PlaybackEncryption     bool       `json:"playbackEncryption"`
	PlaybackServerKey      string     `json:"playbackServerKey"`
	PlaybackServerCert     string     `json:"playbackServerCert"`
	PlaybackAllowOrigin    *string    `json:"playbackAllowOrigin,omitempty" deprecated:"true"`
	PlaybackAllowOrigins   []string   `json:"playbackAllowOrigins"`
	PlaybackTrustedProxies IPNetworks `json:"playbackTrustedProxies"`

	// RTSP server
	RTSP                  bool             `json:"rtsp"`
	RTSPDisable           *bool            `json:"rtspDisable,omitempty" deprecated:"true"`
	Protocols             *RTSPTransports  `json:"protocols,omitempty" deprecated:"true"`
	RTSPTransports        RTSPTransports   `json:"rtspTransports"`
	Encryption            *Encryption      `json:"encryption,omitempty" deprecated:"true"`
	RTSPEncryption        Encryption       `json:"rtspEncryption"`
	RTSPAddress           string           `json:"rtspAddress"`
	RTSPSAddress          string           `json:"rtspsAddress"`
	RTPAddress            string           `json:"rtpAddress"`
	RTCPAddress           string           `json:"rtcpAddress"`
	MulticastIPRange      string           `json:"multicastIPRange"`
	MulticastRTPPort      int              `json:"multicastRTPPort"`
	MulticastRTCPPort     int              `json:"multicastRTCPPort"`
	SRTPAddress           string           `json:"srtpAddress"`
	SRTCPAddress          string           `json:"srtcpAddress"`
	MulticastSRTPPort     int              `json:"multicastSRTPPort"`
	MulticastSRTCPPort    int              `json:"multicastSRTCPPort"`
	ServerKey             *string          `json:"serverKey,omitempty"`
	ServerCert            *string          `json:"serverCert,omitempty"`
	RTSPServerKey         string           `json:"rtspServerKey"`
	RTSPServerCert        string           `json:"rtspServerCert"`
	AuthMethods           *RTSPAuthMethods `json:"authMethods,omitempty" deprecated:"true"`
	RTSPAuthMethods       RTSPAuthMethods  `json:"rtspAuthMethods"`
	RTSPTrustedProxies    IPNetworks       `json:"rtspTrustedProxies"`
	RTSPUDPReadBufferSize *uint            `json:"rtspUDPReadBufferSize,omitempty" deprecated:"true"`

	// RTMP server
	RTMP               bool       `json:"rtmp"`
	RTMPDisable        *bool      `json:"rtmpDisable,omitempty" deprecated:"true"`
	RTMPEncryption     Encryption `json:"rtmpEncryption"`
	RTMPAddress        string     `json:"rtmpAddress"`
	RTMPSAddress       string     `json:"rtmpsAddress"`
	RTMPServerKey      string     `json:"rtmpServerKey"`
	RTMPServerCert     string     `json:"rtmpServerCert"`
	RTMPTrustedProxies IPNetworks `json:"rtmpTrustedProxies"`

	// HLS server
	HLS                bool       `json:"hls"`
	HLSDisable         *bool      `json:"hlsDisable,omitempty" deprecated:"true"`
	HLSAddress         string     `json:"hlsAddress"`
	HLSEncryption      bool       `json:"hlsEncryption"`
	HLSServerKey       string     `json:"hlsServerKey"`
	HLSServerCert      string     `json:"hlsServerCert"`
	HLSAllowOrigin     *string    `json:"hlsAllowOrigin,omitempty" deprecated:"true"`
	HLSAllowOrigins    []string   `json:"hlsAllowOrigins"`
	HLSTrustedProxies  IPNetworks `json:"hlsTrustedProxies"`
	HLSAlwaysRemux     bool       `json:"hlsAlwaysRemux"`
	HLSVariant         HLSVariant `json:"hlsVariant"`
	HLSSegmentCount    int        `json:"hlsSegmentCount"`
	HLSSegmentDuration Duration   `json:"hlsSegmentDuration"`
	HLSPartDuration    Duration   `json:"hlsPartDuration"`
	HLSSegmentMaxSize  StringSize `json:"hlsSegmentMaxSize"`
	HLSDirectory       string     `json:"hlsDirectory"`
	HLSMuxerCloseAfter Duration   `json:"hlsMuxerCloseAfter"`
	HLSCDNSecret       string     `json:"hlsCDNSecret"`

	// WebRTC server
	WebRTC                      bool              `json:"webrtc"`
	WebRTCDisable               *bool             `json:"webrtcDisable,omitempty" deprecated:"true"`
	WebRTCAddress               string            `json:"webrtcAddress"`
	WebRTCEncryption            bool              `json:"webrtcEncryption"`
	WebRTCServerKey             string            `json:"webrtcServerKey"`
	WebRTCServerCert            string            `json:"webrtcServerCert"`
	WebRTCAllowOrigin           *string           `json:"webrtcAllowOrigin,omitempty" deprecated:"true"`
	WebRTCAllowOrigins          []string          `json:"webrtcAllowOrigins"`
	WebRTCTrustedProxies        IPNetworks        `json:"webrtcTrustedProxies"`
	WebRTCLocalUDPAddress       string            `json:"webrtcLocalUDPAddress"`
	WebRTCLocalTCPAddress       string            `json:"webrtcLocalTCPAddress"`
	WebRTCIPsFromInterfaces     bool              `json:"webrtcIPsFromInterfaces"`
	WebRTCIPsFromInterfacesList []string          `json:"webrtcIPsFromInterfacesList"`
	WebRTCAdditionalHosts       []string          `json:"webrtcAdditionalHosts"`
	WebRTCICEServers2           []WebRTCICEServer `json:"webrtcICEServers2"`
	WebRTCSTUNGatherTimeout     Duration          `json:"webrtcSTUNGatherTimeout"`
	WebRTCHandshakeTimeout      Duration          `json:"webrtcHandshakeTimeout"`
	WebRTCTrackGatherTimeout    Duration          `json:"webrtcTrackGatherTimeout"`
	WebRTCICEUDPMuxAddress      *string           `json:"webrtcICEUDPMuxAddress,omitempty" deprecated:"true"`
	WebRTCICETCPMuxAddress      *string           `json:"webrtcICETCPMuxAddress,omitempty" deprecated:"true"`
	WebRTCICEHostNAT1To1IPs     *[]string         `json:"webrtcICEHostNAT1To1IPs,omitempty" deprecated:"true"`
	WebRTCICEServers            *[]string         `json:"webrtcICEServers,omitempty" deprecated:"true"`

	// SRT server
	SRT        bool   `json:"srt"`
	SRTAddress string `json:"srtAddress"`

	// MoQ server
	MoQ               bool       `json:"moq"`
	MoQHTTP2Address   string     `json:"moqHTTP2Address"`
	MoQHTTP3Address   string     `json:"moqHTTP3Address"`
	MoQQUICAddress    string     `json:"moqQUICAddress"`
	MoQServerKey      string     `json:"moqServerKey"`
	MoQServerCert     string     `json:"moqServerCert"`
	MoQAllowOrigins   []string   `json:"moqAllowOrigins"`
	MoQTrustedProxies IPNetworks `json:"moqTrustedProxies"`
	MoQHTTPS2Address  *string    `json:"moqHTTPS2Address,omitempty" deprecated:"true"`
	MoQHTTPS3Address  *string    `json:"moqHTTPS3Address,omitempty" deprecated:"true"`

	// Record (deprecated)
	Record                *bool         `json:"record,omitempty" deprecated:"true"`
	RecordPath            *string       `json:"recordPath,omitempty" deprecated:"true"`
	RecordFormat          *RecordFormat `json:"recordFormat,omitempty" deprecated:"true"`
	RecordPartDuration    *Duration     `json:"recordPartDuration,omitempty" deprecated:"true"`
	RecordSegmentDuration *Duration     `json:"recordSegmentDuration,omitempty" deprecated:"true"`
	RecordDeleteAfter     *Duration     `json:"recordDeleteAfter,omitempty" deprecated:"true"`

	// Path defaults
	PathDefaults Path `json:"pathDefaults"`

	// Paths
	OptionalPaths map[string]*OptionalPath `json:"paths"`
	Paths         map[string]*Path         `json:"-"` // filled by Validate()
}

Conf is a configuration.

func Load

func Load(fpath string, defaultConfPaths []string, l logger.Writer) (*Conf, string, error)

Load loads a Conf.

func (*Conf) AddPath

func (conf *Conf) AddPath(name string, p *OptionalPath) error

AddPath adds a path.

func (Conf) Clone

func (conf Conf) Clone() *Conf

Clone clones the configuration.

func (*Conf) Global

func (conf *Conf) Global() *Global

Global returns the global part of Conf.

func (*Conf) PatchGlobal

func (conf *Conf) PatchGlobal(optional *OptionalGlobal)

PatchGlobal patches the global configuration.

func (*Conf) PatchPath

func (conf *Conf) PatchPath(name string, optional2 *OptionalPath) error

PatchPath patches a path.

func (*Conf) PatchPathDefaults

func (conf *Conf) PatchPathDefaults(optional *OptionalPath)

PatchPathDefaults patches path default settings.

func (*Conf) RemovePath

func (conf *Conf) RemovePath(name string) error

RemovePath removes a path.

func (*Conf) ReplacePath

func (conf *Conf) ReplacePath(name string, optional2 *OptionalPath) error

ReplacePath replaces a path.

func (*Conf) Validate

func (conf *Conf) Validate(l logger.Writer) error

Validate checks the configuration for errors, converts deprecated fields into new ones, fills dependent fields.

type Credential

type Credential string

Credential is a parameter that is used as username or password.

func (Credential) Check

func (d Credential) Check(guess string) bool

Check returns true if the given value matches the credential.

func (Credential) IsArgon2

func (d Credential) IsArgon2() bool

IsArgon2 returns true if the credential is an argon2 hash.

func (Credential) IsHashed

func (d Credential) IsHashed() bool

IsHashed returns true if the credential is a sha256 or argon2 hash.

func (Credential) IsSha256

func (d Credential) IsSha256() bool

IsSha256 returns true if the credential is a sha256 hash.

func (*Credential) UnmarshalEnv

func (d *Credential) UnmarshalEnv(_ string, v string) error

UnmarshalEnv implements env.Unmarshaler.

func (*Credential) UnmarshalJSON

func (d *Credential) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Duration

type Duration time.Duration

Duration is a duration. It differs from the standard duration in these ways: - it is unmarshaled/marshaled from/to a string (instead of a number) - it supports days

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Duration) UnmarshalEnv

func (d *Duration) UnmarshalEnv(_ string, v string) error

UnmarshalEnv implements env.Unmarshaler.

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Encryption

type Encryption string

Encryption is the rtspEncryption / rtmpEncryption parameter.

const (
	EncryptionNo       Encryption = "no"
	EncryptionOptional Encryption = "optional"
	EncryptionStrict   Encryption = "strict"
)

values.

func (*Encryption) UnmarshalEnv

func (d *Encryption) UnmarshalEnv(_ string, v string) error

UnmarshalEnv implements env.Unmarshaler.

func (*Encryption) UnmarshalJSON

func (d *Encryption) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Forward

type Forward []ForwardDest

Forward is a list of ForwardDest.

func (Forward) Validate

func (p Forward) Validate() error

Validate validates the configuration.

type ForwardDest

type ForwardDest struct {
	Dest            string `json:"dest"`
	DestFingerprint string `json:"destFingerprint"`
	WHIPBearerToken string `json:"whipBearerToken"`
}

ForwardDest is a destination to which a path is forwarded.

func (*ForwardDest) Validate

func (p *ForwardDest) Validate() error

Validate validates the configuration.

type Global

type Global struct {
	Values any
}

Global is the global part of Conf.

func (*Global) MarshalJSON

func (p *Global) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

type HLSVariant

type HLSVariant gohlslib.MuxerVariant

HLSVariant is the hlsVariant parameter.

func (HLSVariant) MarshalJSON

func (d HLSVariant) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*HLSVariant) UnmarshalEnv

func (d *HLSVariant) UnmarshalEnv(_ string, v string) error

UnmarshalEnv implements env.Unmarshaler.

func (*HLSVariant) UnmarshalJSON

func (d *HLSVariant) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type IPNetwork

type IPNetwork net.IPNet

IPNetwork represents an IP network.

func (IPNetwork) Contains

func (n IPNetwork) Contains(ip net.IP) bool

Contains checks whether the IP is part of the network.

func (IPNetwork) MarshalJSON

func (n IPNetwork) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (IPNetwork) String

func (n IPNetwork) String() string

String implements fmt.Stringer.

func (*IPNetwork) UnmarshalJSON

func (n *IPNetwork) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type IPNetworks

type IPNetworks []IPNetwork

IPNetworks is a parameter that contains a list of IP networks.

func (IPNetworks) Contains

func (d IPNetworks) Contains(ip net.IP) bool

Contains checks whether the IP is part of one of the networks.

func (*IPNetworks) ToTrustedProxies

func (d *IPNetworks) ToTrustedProxies() []string

ToTrustedProxies converts IPNetworks into a string slice for SetTrustedProxies.

func (*IPNetworks) UnmarshalEnv

func (d *IPNetworks) UnmarshalEnv(_ string, v string) error

UnmarshalEnv implements env.Unmarshaler.

type LogDestination

type LogDestination logger.Destination

LogDestination represents a log destination.

func (LogDestination) MarshalJSON

func (d LogDestination) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*LogDestination) UnmarshalJSON

func (d *LogDestination) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type LogDestinations

type LogDestinations []LogDestination

LogDestinations is the logDestionations parameter.

func (LogDestinations) ToDestinations

func (d LogDestinations) ToDestinations() []logger.Destination

ToDestinations converts to logger.Destination slice.

func (*LogDestinations) UnmarshalEnv

func (d *LogDestinations) UnmarshalEnv(_ string, v string) error

UnmarshalEnv implements env.Unmarshaler.

type LogLevel

type LogLevel logger.Level

LogLevel is the logLevel parameter.

func (LogLevel) MarshalJSON

func (d LogLevel) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*LogLevel) UnmarshalEnv

func (d *LogLevel) UnmarshalEnv(_ string, v string) error

UnmarshalEnv implements env.Unmarshaler.

func (*LogLevel) UnmarshalJSON

func (d *LogLevel) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type MoQTransport

type MoQTransport string

MoQTransport is the moqTransport parameter.

const (
	MoQTransportQUIC         MoQTransport = "quic"
	MoQTransportWebTransport MoQTransport = "webtransport"
)

supported values.

func (*MoQTransport) UnmarshalEnv

func (d *MoQTransport) UnmarshalEnv(_ string, v string) error

UnmarshalEnv implements env.Unmarshaler.

func (*MoQTransport) UnmarshalJSON

func (d *MoQTransport) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type OptionalGlobal

type OptionalGlobal struct {
	Values any
}

OptionalGlobal is a Conf whose values can all be optional.

func (*OptionalGlobal) MarshalJSON

func (p *OptionalGlobal) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*OptionalGlobal) UnmarshalJSON

func (p *OptionalGlobal) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type OptionalPath

type OptionalPath struct {
	Values any
}

OptionalPath is a Path whose values can all be optional.

func (*OptionalPath) MarshalJSON

func (p *OptionalPath) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*OptionalPath) UnmarshalEnv

func (p *OptionalPath) UnmarshalEnv(prefix string, _ string) error

UnmarshalEnv implements env.Unmarshaler.

func (*OptionalPath) UnmarshalJSON

func (p *OptionalPath) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Path

type Path struct {
	Regexp *regexp.Regexp `json:"-"`    // filled by Validate()
	Name   string         `json:"name"` // filled by Validate()

	// General
	Source                     string   `json:"source"`
	SourceFingerprint          string   `json:"sourceFingerprint"`
	SourceOnDemand             bool     `json:"sourceOnDemand"`
	SourceOnDemandStartTimeout Duration `json:"sourceOnDemandStartTimeout"`
	SourceOnDemandCloseAfter   Duration `json:"sourceOnDemandCloseAfter"`
	MaxReaders                 int      `json:"maxReaders"`
	SRTReadPassphrase          string   `json:"srtReadPassphrase"`
	Fallback                   *string  `json:"fallback,omitempty" deprecated:"true"`
	UseAbsoluteTimestamp       bool     `json:"useAbsoluteTimestamp"`

	// Always available
	AlwaysAvailable       bool                   `json:"alwaysAvailable"`
	AlwaysAvailableTracks []AlwaysAvailableTrack `json:"alwaysAvailableTracks"`
	AlwaysAvailableFile   string                 `json:"alwaysAvailableFile"`

	// Forward
	Forward Forward `json:"forward"`

	// Record
	Record                bool         `json:"record"`
	Playback              *bool        `json:"playback,omitempty" deprecated:"true"`
	RecordPath            string       `json:"recordPath"`
	RecordFormat          RecordFormat `json:"recordFormat"`
	RecordPartDuration    Duration     `json:"recordPartDuration"`
	RecordMaxPartSize     StringSize   `json:"recordMaxPartSize"`
	RecordSegmentDuration Duration     `json:"recordSegmentDuration"`
	RecordDeleteAfter     Duration     `json:"recordDeleteAfter"`

	// Authentication (deprecated)
	PublishUser *Credential `json:"publishUser,omitempty" deprecated:"true"`
	PublishPass *Credential `json:"publishPass,omitempty" deprecated:"true"`
	PublishIPs  *IPNetworks `json:"publishIPs,omitempty" deprecated:"true"`
	ReadUser    *Credential `json:"readUser,omitempty" deprecated:"true"`
	ReadPass    *Credential `json:"readPass,omitempty" deprecated:"true"`
	ReadIPs     *IPNetworks `json:"readIPs,omitempty" deprecated:"true"`

	// Publisher source
	OverridePublisher        bool   `json:"overridePublisher"`
	DisablePublisherOverride *bool  `json:"disablePublisherOverride,omitempty" deprecated:"true"`
	SRTPublishPassphrase     string `json:"srtPublishPassphrase"`
	RTSPDemuxMpegts          bool   `json:"rtspDemuxMpegts"`

	// RTSP source
	RTSPTransport          RTSPTransport  `json:"rtspTransport"`
	RTSPAnyPort            bool           `json:"rtspAnyPort"`
	SourceProtocol         *RTSPTransport `json:"sourceProtocol,omitempty" deprecated:"true"`
	SourceAnyPortEnable    *bool          `json:"sourceAnyPortEnable,omitempty" deprecated:"true"`
	RTSPRangeType          RTSPRangeType  `json:"rtspRangeType"`
	RTSPRangeStart         string         `json:"rtspRangeStart"`
	RTSPScale              string         `json:"rtspScale"`
	RTSPUDPReadBufferSize  *uint          `json:"rtspUDPReadBufferSize,omitempty" deprecated:"true"`
	RTSPUDPSourcePortRange []uint         `json:"rtspUDPSourcePortRange"`

	// MPEG-TS source
	MPEGTSUDPReadBufferSize *uint `json:"mpegtsUDPReadBufferSize,omitempty" deprecated:"true"`

	// RTP source
	RTPSDP               string `json:"rtpSDP"`
	RTPUDPReadBufferSize *uint  `json:"rtpUDPReadBufferSize,omitempty" deprecated:"true"`

	// MoQ source
	MoQTransport MoQTransport `json:"moqTransport"`

	// WHEP source
	WHEPBearerToken        string   `json:"whepBearerToken"`
	WHEPSTUNGatherTimeout  Duration `json:"whepSTUNGatherTimeout"`
	WHEPHandshakeTimeout   Duration `json:"whepHandshakeTimeout"`
	WHEPTrackGatherTimeout Duration `json:"whepTrackGatherTimeout"`

	// Redirect source
	SourceRedirect string `json:"sourceRedirect"`

	// Raspberry Pi Camera source
	RPICameraCamID                 uint      `json:"rpiCameraCamID"`
	RPICameraSecondary             bool      `json:"rpiCameraSecondary"`
	RPICameraWidth                 uint      `json:"rpiCameraWidth"`
	RPICameraHeight                uint      `json:"rpiCameraHeight"`
	RPICameraHFlip                 bool      `json:"rpiCameraHFlip"`
	RPICameraVFlip                 bool      `json:"rpiCameraVFlip"`
	RPICameraBrightness            float64   `json:"rpiCameraBrightness"`
	RPICameraContrast              float64   `json:"rpiCameraContrast"`
	RPICameraSaturation            float64   `json:"rpiCameraSaturation"`
	RPICameraSharpness             float64   `json:"rpiCameraSharpness"`
	RPICameraExposure              string    `json:"rpiCameraExposure"`
	RPICameraAWB                   string    `json:"rpiCameraAWB"`
	RPICameraAWBGains              []float64 `json:"rpiCameraAWBGains"`
	RPICameraDenoise               string    `json:"rpiCameraDenoise"`
	RPICameraShutter               uint      `json:"rpiCameraShutter"`
	RPICameraMetering              string    `json:"rpiCameraMetering"`
	RPICameraGain                  float64   `json:"rpiCameraGain"`
	RPICameraEV                    float64   `json:"rpiCameraEV"`
	RPICameraROI                   string    `json:"rpiCameraROI"`
	RPICameraHDR                   bool      `json:"rpiCameraHDR"`
	RPICameraTuningFile            string    `json:"rpiCameraTuningFile"`
	RPICameraMode                  string    `json:"rpiCameraMode"`
	RPICameraFPS                   float64   `json:"rpiCameraFPS"`
	RPICameraAfMode                string    `json:"rpiCameraAfMode"`
	RPICameraAfRange               string    `json:"rpiCameraAfRange"`
	RPICameraAfSpeed               string    `json:"rpiCameraAfSpeed"`
	RPICameraLensPosition          float64   `json:"rpiCameraLensPosition"`
	RPICameraAfWindow              string    `json:"rpiCameraAfWindow"`
	RPICameraFlickerPeriod         uint      `json:"rpiCameraFlickerPeriod"`
	RPICameraTextOverlayEnable     bool      `json:"rpiCameraTextOverlayEnable"`
	RPICameraTextOverlay           string    `json:"rpiCameraTextOverlay"`
	RPICameraCodec                 string    `json:"rpiCameraCodec"`
	RPICameraIDRPeriod             uint      `json:"rpiCameraIDRPeriod"`
	RPICameraBitrate               uint      `json:"rpiCameraBitrate"`
	RPICameraProfile               *string   `json:"rpiCameraProfile,omitempty" deprecated:"true"`
	RPICameraLevel                 *string   `json:"rpiCameraLevel,omitempty" deprecated:"true"`
	RPICameraHardwareH264Profile   *string   `json:"rpiCameraHardwareH264Profile,omitempty" deprecated:"true"`
	RPICameraHardwareH264Level     *string   `json:"rpiCameraHardwareH264Level,omitempty" deprecated:"true"`
	RPICameraSoftwareH264Profile   *string   `json:"rpiCameraSoftwareH264Profile,omitempty" deprecated:"true"`
	RPICameraSoftwareH264Level     *string   `json:"rpiCameraSoftwareH264Level,omitempty" deprecated:"true"`
	RPICameraH264Profile           string    `json:"rpiCameraH264Profile"`
	RPICameraH264Level             string    `json:"rpiCameraH264Level"`
	RPICameraJPEGQuality           *uint     `json:"rpiCameraJPEGQuality,omitempty" deprecated:"true"`
	RPICameraMJPEGQuality          uint      `json:"rpiCameraMJPEGQuality"`
	RPICameraPrimaryName           string    `json:"-"` // filled by Validate()
	RPICameraSecondaryCodec        string    `json:"-"` // filled by Validate()
	RPICameraSecondaryWidth        uint      `json:"-"` // filled by Validate()
	RPICameraSecondaryHeight       uint      `json:"-"` // filled by Validate()
	RPICameraSecondaryFPS          float64   `json:"-"` // filled by Validate()
	RPICameraSecondaryIDRPeriod    uint      `json:"-"` // filled by Validate()
	RPICameraSecondaryBitrate      uint      `json:"-"` // filled by Validate()
	RPICameraSecondaryH264Profile  string    `json:"-"` // filled by Validate()
	RPICameraSecondaryH264Level    string    `json:"-"` // filled by Validate()
	RPICameraSecondaryMJPEGQuality uint      `json:"-"` // filled by Validate()

	// Hooks
	RunOnInit                  string   `json:"runOnInit"`
	RunOnInitRestart           bool     `json:"runOnInitRestart"`
	RunOnDemand                string   `json:"runOnDemand"`
	RunOnDemandRestart         bool     `json:"runOnDemandRestart"`
	RunOnDemandStartTimeout    Duration `json:"runOnDemandStartTimeout"`
	RunOnDemandCloseAfter      Duration `json:"runOnDemandCloseAfter"`
	RunOnUnDemand              string   `json:"runOnUnDemand"`
	RunOnAvailable             string   `json:"runOnAvailable"`
	RunOnAvailableRestart      bool     `json:"runOnAvailableRestart"`
	RunOnUnavailable           string   `json:"runOnUnavailable"`
	RunOnReady                 *string  `json:"runOnReady,omitempty" deprecated:"true"`
	RunOnReadyRestart          *bool    `json:"runOnReadyRestart,omitempty" deprecated:"true"`
	RunOnNotReady              *string  `json:"runOnNotReady,omitempty" deprecated:"true"`
	RunOnOnline                string   `json:"runOnOnline"`
	RunOnOnlineRestart         bool     `json:"runOnOnlineRestart"`
	RunOnOffline               string   `json:"runOnOffline"`
	RunOnRead                  string   `json:"runOnRead"`
	RunOnReadRestart           bool     `json:"runOnReadRestart"`
	RunOnUnread                string   `json:"runOnUnread"`
	RunOnRecordSegmentCreate   string   `json:"runOnRecordSegmentCreate"`
	RunOnRecordSegmentComplete string   `json:"runOnRecordSegmentComplete"`
}

Path is a path configuration.

func FindPathConf

func FindPathConf(pathConfs map[string]*Path, name string) (*Path, []string, error)

FindPathConf returns the configuration corresponding to the given path name.

func (Path) Clone

func (pconf Path) Clone() *Path

Clone clones the configuration.

func (*Path) Equal

func (pconf *Path) Equal(other *Path) bool

Equal checks whether two Paths are equal.

func (Path) HasOnDemandPublisher

func (pconf Path) HasOnDemandPublisher() bool

HasOnDemandPublisher checks whether the path has a on-demand publisher.

func (Path) HasOnDemandStaticSource

func (pconf Path) HasOnDemandStaticSource() bool

HasOnDemandStaticSource checks whether the path has a on demand static source.

func (Path) HasStaticSource

func (pconf Path) HasStaticSource() bool

HasStaticSource checks whether the path has a static source.

type RTSPAuthMethod

type RTSPAuthMethod auth.VerifyMethod

RTSPAuthMethod represents an RTSP authentication method.

func (RTSPAuthMethod) MarshalJSON

func (d RTSPAuthMethod) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*RTSPAuthMethod) UnmarshalJSON

func (d *RTSPAuthMethod) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type RTSPAuthMethods

type RTSPAuthMethods []RTSPAuthMethod

RTSPAuthMethods is the rtspAuthMethods parameter.

func (RTSPAuthMethods) ToAuthMethods

func (d RTSPAuthMethods) ToAuthMethods() []auth.VerifyMethod

ToAuthMethods converts to auth.VerifyMethod slice.

func (*RTSPAuthMethods) UnmarshalEnv

func (d *RTSPAuthMethods) UnmarshalEnv(_ string, v string) error

UnmarshalEnv implements env.Unmarshaler.

type RTSPRangeType

type RTSPRangeType string

RTSPRangeType is the type used in the Range header.

const (
	RTSPRangeTypeUndefined RTSPRangeType = ""
	RTSPRangeTypeClock     RTSPRangeType = "clock"
	RTSPRangeTypeNPT       RTSPRangeType = "npt"
	RTSPRangeTypeSMPTE     RTSPRangeType = "smpte"
)

supported values.

func (*RTSPRangeType) UnmarshalEnv

func (d *RTSPRangeType) UnmarshalEnv(_ string, v string) error

UnmarshalEnv implements env.Unmarshaler.

func (*RTSPRangeType) UnmarshalJSON

func (d *RTSPRangeType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type RTSPTransport

type RTSPTransport struct {
	*gortsplib.Protocol
}

RTSPTransport is the rtspTransport parameter.

func (RTSPTransport) MarshalJSON

func (d RTSPTransport) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*RTSPTransport) UnmarshalEnv

func (d *RTSPTransport) UnmarshalEnv(_ string, v string) error

UnmarshalEnv implements env.Unmarshaler.

func (*RTSPTransport) UnmarshalJSON

func (d *RTSPTransport) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type RTSPTransports

type RTSPTransports map[gortsplib.Protocol]struct{}

RTSPTransports is the rtspTransports parameter.

func (RTSPTransports) MarshalJSON

func (d RTSPTransports) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*RTSPTransports) UnmarshalEnv

func (d *RTSPTransports) UnmarshalEnv(_ string, v string) error

UnmarshalEnv implements env.Unmarshaler.

func (*RTSPTransports) UnmarshalJSON

func (d *RTSPTransports) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type RecordFormat

type RecordFormat string

RecordFormat is the recordFormat parameter.

const (
	RecordFormatFMP4   RecordFormat = "fmp4"
	RecordFormatMPEGTS RecordFormat = "mpegts"
)

supported values.

func (*RecordFormat) UnmarshalEnv

func (d *RecordFormat) UnmarshalEnv(_ string, v string) error

UnmarshalEnv implements env.Unmarshaler.

func (*RecordFormat) UnmarshalJSON

func (d *RecordFormat) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type StringSize

type StringSize uint64

StringSize is a size that is unmarshaled from a string.

func (StringSize) MarshalJSON

func (s StringSize) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*StringSize) UnmarshalEnv

func (s *StringSize) UnmarshalEnv(_ string, v string) error

UnmarshalEnv implements env.Unmarshaler.

func (*StringSize) UnmarshalJSON

func (s *StringSize) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type WebRTCICEServer

type WebRTCICEServer struct {
	URL        string `json:"url"`
	Username   string `json:"username"`
	Password   string `json:"password"`
	ClientOnly bool   `json:"clientOnly"`
}

WebRTCICEServer is a WebRTC ICE Server.

Directories

Path Synopsis
Package decrypt contains the Decrypt function.
Package decrypt contains the Decrypt function.
Package env contains a function to load configuration from environment.
Package env contains a function to load configuration from environment.
Package jsonwrapper contains a JSON unmarshaler.
Package jsonwrapper contains a JSON unmarshaler.
Package yamlwrapper contains a YAML unmarshaler.
Package yamlwrapper contains a YAML unmarshaler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL