conf

package
v0.23.4 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: MIT Imports: 20 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) UnmarshalEnv

func (d *AuthMethods) UnmarshalEnv(s string) error

UnmarshalEnv implements envUnmarshaler.

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"`
	UDPMaxPayloadSize         int             `json:"udpMaxPayloadSize"`
	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"`
	HLSEncryption      bool           `json:"hlsEncryption"`
	HLSServerKey       string         `json:"hlsServerKey"`
	HLSServerCert      string         `json:"hlsServerCert"`
	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"`
	HLSTrustedProxies  IPsOrCIDRs     `json:"hlsTrustedProxies"`
	HLSDirectory       string         `json:"hlsDirectory"`

	// WebRTC
	WebRTCDisable           bool       `json:"webrtcDisable"`
	WebRTCAddress           string     `json:"webrtcAddress"`
	WebRTCEncryption        bool       `json:"webrtcEncryption"`
	WebRTCServerKey         string     `json:"webrtcServerKey"`
	WebRTCServerCert        string     `json:"webrtcServerCert"`
	WebRTCAllowOrigin       string     `json:"webrtcAllowOrigin"`
	WebRTCTrustedProxies    IPsOrCIDRs `json:"webrtcTrustedProxies"`
	WebRTCICEServers        []string   `json:"webrtcICEServers"`
	WebRTCICEHostNAT1To1IPs []string   `json:"webrtcICEHostNAT1To1IPs"`
	WebRTCICEUDPMuxAddress  string     `json:"webrtcICEUDPMuxAddress"`
	WebRTCICETCPMuxAddress  string     `json:"webrtcICETCPMuxAddress"`

	// 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 (*Conf) Check

func (conf *Conf) Check() error

Check checks the configuration for errors.

func (Conf) Clone

func (conf Conf) Clone() *Conf

Clone clones the configuration.

func (*Conf) UnmarshalJSON

func (conf *Conf) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler. It is used to set default values.

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) UnmarshalEnv

func (d *Credential) UnmarshalEnv(s string) error

UnmarshalEnv implements envUnmarshaler.

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) UnmarshalEnv

func (d *Encryption) UnmarshalEnv(s string) error

UnmarshalEnv implements envUnmarshaler.

func (*Encryption) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

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(s string) error

UnmarshalEnv implements envUnmarshaler.

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) UnmarshalEnv

func (d *IPsOrCIDRs) UnmarshalEnv(s string) error

UnmarshalEnv implements envUnmarshaler.

func (*IPsOrCIDRs) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

type LogDestinations

type LogDestinations []logger.Destination

LogDestinations is the logDestionations parameter.

func (LogDestinations) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (*LogDestinations) UnmarshalEnv

func (d *LogDestinations) UnmarshalEnv(s string) error

UnmarshalEnv implements envUnmarshaler.

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) UnmarshalEnv

func (d *LogLevel) UnmarshalEnv(s string) error

UnmarshalEnv implements envUnmarshaler.

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"`

	// general
	SourceFingerprint          string         `json:"sourceFingerprint"`
	SourceOnDemand             bool           `json:"sourceOnDemand"`
	SourceOnDemandStartTimeout StringDuration `json:"sourceOnDemandStartTimeout"`
	SourceOnDemandCloseAfter   StringDuration `json:"sourceOnDemandCloseAfter"`

	// 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"`

	// publisher
	DisablePublisherOverride bool   `json:"disablePublisherOverride"`
	Fallback                 string `json:"fallback"`

	// rtsp
	SourceProtocol      SourceProtocol `json:"sourceProtocol"`
	SourceAnyPortEnable bool           `json:"sourceAnyPortEnable"`
	RtspRangeType       RtspRangeType  `json:"rtspRangeType"`
	RtspRangeStart      string         `json:"rtspRangeStart"`

	// redirect
	SourceRedirect string `json:"sourceRedirect"`

	// raspberry pi camera
	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               float64 `json:"rpiCameraFPS"`
	RPICameraIDRPeriod         int     `json:"rpiCameraIDRPeriod"`
	RPICameraBitrate           int     `json:"rpiCameraBitrate"`
	RPICameraProfile           string  `json:"rpiCameraProfile"`
	RPICameraLevel             string  `json:"rpiCameraLevel"`
	RPICameraAfMode            string  `json:"rpiCameraAfMode"`
	RPICameraAfRange           string  `json:"rpiCameraAfRange"`
	RPICameraAfSpeed           string  `json:"rpiCameraAfSpeed"`
	RPICameraLensPosition      float64 `json:"rpiCameraLensPosition"`
	RPICameraAfWindow          string  `json:"rpiCameraAfWindow"`
	RPICameraTextOverlayEnable bool    `json:"rpiCameraTextOverlayEnable"`
	RPICameraTextOverlay       string  `json:"rpiCameraTextOverlay"`

	// 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) Clone

func (pconf PathConf) Clone() *PathConf

Clone clones the configuration.

func (*PathConf) Equal

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

Equal checks whether two PathConfs are equal.

func (PathConf) HasOnDemandPublisher

func (pconf PathConf) HasOnDemandPublisher() bool

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

func (PathConf) HasOnDemandStaticSource

func (pconf PathConf) HasOnDemandStaticSource() bool

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

func (PathConf) HasStaticSource

func (pconf PathConf) HasStaticSource() bool

HasStaticSource checks whether the path has a static source.

func (*PathConf) UnmarshalJSON

func (pconf *PathConf) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler. It is used to set default values.

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) UnmarshalEnv

func (d *Protocols) UnmarshalEnv(s string) error

UnmarshalEnv implements envUnmarshaler.

func (*Protocols) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

type RtspRangeType

type RtspRangeType int

RtspRangeType is the type used in the Range header.

const (
	RtspRangeTypeUndefined RtspRangeType = iota
	RtspRangeTypeClock
	RtspRangeTypeNPT
	RtspRangeTypeSMPTE
)

supported rtsp range types.

func (RtspRangeType) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (*RtspRangeType) UnmarshalEnv

func (d *RtspRangeType) UnmarshalEnv(s string) error

UnmarshalEnv implements envUnmarshaler.

func (*RtspRangeType) UnmarshalJSON

func (d *RtspRangeType) 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) UnmarshalEnv

func (d *SourceProtocol) UnmarshalEnv(s string) error

UnmarshalEnv implements envUnmarshaler.

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) UnmarshalEnv

func (d *StringDuration) UnmarshalEnv(s string) error

UnmarshalEnv implements envUnmarshaler.

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) UnmarshalEnv

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

UnmarshalEnv implements envUnmarshaler.

func (*StringSize) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

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 yaml contains a yaml loader.
Package yaml contains a yaml loader.

Jump to

Keyboard shortcuts

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