conf

package
v0.0.0-...-6f888eb Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

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 marshals a AuthMethods into JSON.

func (*AuthMethods) UnmarshalJSON

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

UnmarshalJSON unmarshals a AuthMethods from JSON.

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"`
	ReadBufferSize    int         `json:"readBufferSize"`

	// RTMP
	RTMPDisable bool   `json:"rtmpDisable"`
	RTMPAddress string `json:"rtmpAddress"`

	// HLS
	HLSDisable         bool           `json:"hlsDisable"`
	HLSAddress         string         `json:"hlsAddress"`
	HLSAlwaysRemux     bool           `json:"hlsAlwaysRemux"`
	HLSSegmentCount    int            `json:"hlsSegmentCount"`
	HLSSegmentDuration StringDuration `json:"hlsSegmentDuration"`
	HLSSegmentMaxSize  StringSize     `json:"hlsSegmentMaxSize"`
	HLSAllowOrigin     string         `json:"hlsAllowOrigin"`

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

Conf 配置对象

func Load

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

Load 加载配置

func (*Conf) CheckAndFillMissing

func (conf *Conf) CheckAndFillMissing() error

CheckAndFillMissing 检查并填充缺失值

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 marshals a Credential into JSON.

func (*Credential) UnmarshalJSON

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

UnmarshalJSON unmarshals a Credential from JSON.

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 marshals a Encryption into JSON.

func (*Encryption) UnmarshalJSON

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

UnmarshalJSON unmarshals a Encryption from JSON.

type IPsOrNets

type IPsOrNets []interface{}

IPsOrNets is a parameter that acceps IPs or subnets.

func (IPsOrNets) MarshalJSON

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

MarshalJSON marshals a IPsOrNets into JSON.

func (*IPsOrNets) UnmarshalJSON

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

UnmarshalJSON unmarshals a IPsOrNets from JSON.

type LogDestinations

type LogDestinations map[logger.Destination]struct{}

LogDestinations is the logDestionations parameter.

func (LogDestinations) MarshalJSON

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

MarshalJSON marshals a LogDestinations into JSON.

func (*LogDestinations) UnmarshalJSON

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

UnmarshalJSON unmarshals a LogDestinations from JSON.

type LogLevel

type LogLevel logger.Level

LogLevel is the logLevel parameter.

func (LogLevel) MarshalJSON

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

MarshalJSON marshals a LogLevel into JSON.

func (*LogLevel) UnmarshalJSON

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

UnmarshalJSON unmarshals a LogLevel from JSON.

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

	// authentication
	PublishUser Credential `json:"publishUser"`
	PublishPass Credential `json:"publishPass"`
	PublishIPs  IPsOrNets  `json:"publishIPs"`
	ReadUser    Credential `json:"readUser"`
	ReadPass    Credential `json:"readPass"`
	ReadIPs     IPsOrNets  `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"`

	// deprecated, replaced by runOnReady. TODO: remove in next version
	RunOnPublish        string `json:"runOnPublish"`
	RunOnPublishRestart bool   `json:"runOnPublishRestart"`
}

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 marshals a Protocols into JSON.

func (*Protocols) UnmarshalJSON

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

UnmarshalJSON unmarshals a Protocols from JSON.

type SourceProtocol

type SourceProtocol struct {
	*gortsplib.Transport
}

SourceProtocol is the sourceProtocol parameter.

func (SourceProtocol) MarshalJSON

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

MarshalJSON marshals a SourceProtocol into JSON.

func (*SourceProtocol) UnmarshalJSON

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

UnmarshalJSON unmarshals a SourceProtocol from JSON.

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 marshals a StringDuration into JSON.

func (*StringDuration) UnmarshalJSON

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

UnmarshalJSON unmarshals a StringDuration from JSON.

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 marshals a StringSize into JSON.

func (*StringSize) UnmarshalJSON

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

UnmarshalJSON unmarshals a StringSize from JSON.

Jump to

Keyboard shortcuts

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