conf

package
v0.0.0-...-0619cdb Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidPathName

func IsValidPathName(name string) error

IsValidPathName checks if a path name is valid.

Types

type AuthMethods

type AuthMethods []headers.AuthMethod

AuthMethods is the authMethods parameter.

func (AuthMethods) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (*AuthMethods) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

type Conf

type Conf struct {
	// general
	LogLevel                  LogLevel        `json:"logLevel"`
	LogDestinations           LogDestinations `json:"logDestinations"`
	LogFile                   string          `json:"logFile"`
	ReadTimeout               StringDuration  `json:"readTimeout"`
	WriteTimeout              StringDuration  `json:"writeTimeout"`
	ReadBufferCount           int             `json:"readBufferCount"`
	ExternalAuthenticationURL string          `json:"externalAuthenticationURL"`
	API                       bool            `json:"api"`
	APIAddress                string          `json:"apiAddress"`
	Metrics                   bool            `json:"metrics"`
	MetricsAddress            string          `json:"metricsAddress"`
	PPROF                     bool            `json:"pprof"`
	PPROFAddress              string          `json:"pprofAddress"`
	RunOnConnect              string          `json:"runOnConnect"`
	RunOnConnectRestart       bool            `json:"runOnConnectRestart"`

	// RTSP
	RTSPDisable       bool        `json:"rtspDisable"`
	Protocols         Protocols   `json:"protocols"`
	Encryption        Encryption  `json:"encryption"`
	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"`
	ServerKey         string      `json:"serverKey"`
	ServerCert        string      `json:"serverCert"`
	AuthMethods       AuthMethods `json:"authMethods"`

	// RTMP
	RTMPDisable    bool       `json:"rtmpDisable"`
	RTMPAddress    string     `json:"rtmpAddress"`
	RTMPEncryption Encryption `json:"rtmpEncryption"`
	RTMPSAddress   string     `json:"rtmpsAddress"`
	RTMPServerKey  string     `json:"rtmpServerKey"`
	RTMPServerCert string     `json:"rtmpServerCert"`

	// HLS
	HLSDisable         bool           `json:"hlsDisable"`
	HLSAddress         string         `json:"hlsAddress"`
	HLSAlwaysRemux     bool           `json:"hlsAlwaysRemux"`
	HLSVariant         HLSVariant     `json:"hlsVariant"`
	HLSSegmentCount    int            `json:"hlsSegmentCount"`
	HLSSegmentDuration StringDuration `json:"hlsSegmentDuration"`
	HLSPartDuration    StringDuration `json:"hlsPartDuration"`
	HLSSegmentMaxSize  StringSize     `json:"hlsSegmentMaxSize"`
	HLSAllowOrigin     string         `json:"hlsAllowOrigin"`
	HLSEncryption      bool           `json:"hlsEncryption"`
	HLSServerKey       string         `json:"hlsServerKey"`
	HLSServerCert      string         `json:"hlsServerCert"`
	HLSTrustedProxies  IPsOrCIDRs     `json:"hlsTrustedProxies"`

	// paths
	Paths map[string]*PathConf `json:"paths"`
}

Conf is a configuration.

func Load

func Load(fpath string) (*Conf, bool, error)

Load loads a Conf.

func LoadFromReader

func LoadFromReader(reader io.Reader) (*Conf, bool, error)

func (*Conf) CheckAndFillMissing

func (conf *Conf) CheckAndFillMissing() error

CheckAndFillMissing checks the configuration for errors and fills missing parameters.

type Credential

type Credential string

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

func (Credential) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (*Credential) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

type Encryption

type Encryption int

Encryption is the encryption parameter.

const (
	EncryptionNo Encryption = iota
	EncryptionOptional
	EncryptionStrict
)

supported encryption policies.

func (Encryption) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (*Encryption) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

type HLSVariant

type HLSVariant hls.MuxerVariant

HLSVariant is the hlsVariant parameter.

const (
	HLSVariantMPEGTS     HLSVariant = HLSVariant(hls.MuxerVariantMPEGTS)
	HLSVariantFMP4       HLSVariant = HLSVariant(hls.MuxerVariantFMP4)
	HLSVariantLowLatency HLSVariant = HLSVariant(hls.MuxerVariantLowLatency)
)

supported HLS variants.

func (HLSVariant) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (*HLSVariant) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

type IPsOrCIDRs

type IPsOrCIDRs []fmt.Stringer

IPsOrCIDRs is a parameter that contains a list of IPs or CIDRs.

func (IPsOrCIDRs) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (*IPsOrCIDRs) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

type LogDestinations

type LogDestinations map[logger.Destination]struct{}

LogDestinations is the logDestionations parameter.

func (LogDestinations) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (*LogDestinations) UnmarshalJSON

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

UnmarshalJSON implements json.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) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

type PathConf

type PathConf struct {
	Regexp *regexp.Regexp `json:"-"`

	// source
	Source                     string         `json:"source"`
	SourceProtocol             SourceProtocol `json:"sourceProtocol"`
	SourceAnyPortEnable        bool           `json:"sourceAnyPortEnable"`
	SourceFingerprint          string         `json:"sourceFingerprint"`
	SourceOnDemand             bool           `json:"sourceOnDemand"`
	SourceOnDemandStartTimeout StringDuration `json:"sourceOnDemandStartTimeout"`
	SourceOnDemandCloseAfter   StringDuration `json:"sourceOnDemandCloseAfter"`
	SourceRedirect             string         `json:"sourceRedirect"`
	DisablePublisherOverride   bool           `json:"disablePublisherOverride"`
	Fallback                   string         `json:"fallback"`
	RPICameraCamID             int            `json:"rpiCameraCamID"`
	RPICameraWidth             int            `json:"rpiCameraWidth"`
	RPICameraHeight            int            `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"`
	RPICameraDenoise           string         `json:"rpiCameraDenoise"`
	RPICameraShutter           int            `json:"rpiCameraShutter"`
	RPICameraMetering          string         `json:"rpiCameraMetering"`
	RPICameraGain              float64        `json:"rpiCameraGain"`
	RPICameraEV                float64        `json:"rpiCameraEV"`
	RPICameraROI               string         `json:"rpiCameraROI"`
	RPICameraTuningFile        string         `json:"rpiCameraTuningFile"`
	RPICameraMode              string         `json:"rpiCameraMode"`
	RPICameraFPS               int            `json:"rpiCameraFPS"`
	RPICameraIDRPeriod         int            `json:"rpiCameraIDRPeriod"`
	RPICameraBitrate           int            `json:"rpiCameraBitrate"`
	RPICameraProfile           string         `json:"rpiCameraProfile"`
	RPICameraLevel             string         `json:"rpiCameraLevel"`

	// authentication
	PublishUser Credential `json:"publishUser"`
	PublishPass Credential `json:"publishPass"`
	PublishIPs  IPsOrCIDRs `json:"publishIPs"`
	ReadUser    Credential `json:"readUser"`
	ReadPass    Credential `json:"readPass"`
	ReadIPs     IPsOrCIDRs `json:"readIPs"`

	// external commands
	RunOnInit               string         `json:"runOnInit"`
	RunOnInitRestart        bool           `json:"runOnInitRestart"`
	RunOnDemand             string         `json:"runOnDemand"`
	RunOnDemandRestart      bool           `json:"runOnDemandRestart"`
	RunOnDemandStartTimeout StringDuration `json:"runOnDemandStartTimeout"`
	RunOnDemandCloseAfter   StringDuration `json:"runOnDemandCloseAfter"`
	RunOnReady              string         `json:"runOnReady"`
	RunOnReadyRestart       bool           `json:"runOnReadyRestart"`
	RunOnRead               string         `json:"runOnRead"`
	RunOnReadRestart        bool           `json:"runOnReadRestart"`
}

PathConf is a path configuration.

func (*PathConf) Equal

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

Equal checks whether two PathConfs are equal.

type Protocol

type Protocol gortsplib.Transport

Protocol is a RTSP transport.

type Protocols

type Protocols map[Protocol]struct{}

Protocols is the protocols parameter.

func (Protocols) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (*Protocols) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

type SourceProtocol

type SourceProtocol struct {
	*gortsplib.Transport
}

SourceProtocol is the sourceProtocol parameter.

func (SourceProtocol) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (*SourceProtocol) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

type StringDuration

type StringDuration time.Duration

StringDuration is a duration that is unmarshaled from a string. Durations are normally unmarshaled from numbers.

func (StringDuration) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (*StringDuration) UnmarshalJSON

func (d *StringDuration) 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) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

Jump to

Keyboard shortcuts

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