config

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: AGPL-3.0-or-later Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultListenAddr is the default listen address for the server.
	DefaultListenAddr = "localhost:50051"
	// TLSMinVersion is the minimum required version of TLS.
	TLSMinVersion = tls.VersionTLS13
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ListenAddr   string        `yaml:"listenAddr,omitempty"`
	Host         string        `yaml:"host,omitempty"`
	TLS          *TLS          `yaml:"tls,omitempty"`
	LogFile      LogFile       `yaml:"logfile"`
	Sources      Sources       `yaml:"sources"`
	Destinations []Destination `yaml:"destinations"`
}

Config holds the configuration for the application.

type ConfigDirFunc

type ConfigDirFunc func() (string, error)

ConfigDirFunc is a function that returns the user configuration directory.

type Destination

type Destination struct {
	Name string `yaml:"name"`
	URL  string `yaml:"url"`
}

Destination holds the configuration for a destination.

type LogFile

type LogFile struct {
	Enabled bool   `yaml:"enabled"`
	Path    string `yaml:"path,omitempty"`
	// contains filtered or unexported fields
}

LogFile holds the configuration for the log file.

func (LogFile) GetPath added in v0.0.4

func (l LogFile) GetPath() string

GetPath returns the path to the log file. If the path is not set, it returns the default log path.

type MediaServerSource added in v0.0.8

type MediaServerSource struct {
	StreamKey string     `yaml:"streamKey,omitempty"`
	RTMP      RTMPSource `yaml:"rtmp"`
	RTMPS     RTMPSource `yaml:"rtmps"`
}

MediaServerSource holds the configuration for the media server source.

type NetAddr added in v0.0.8

type NetAddr struct {
	IP   string `yaml:"ip,omitempty"`
	Port int    `yaml:"port,omitempty"`
}

NetAddr holds an IP and/or port.

type RTMPSource

type RTMPSource struct {
	Enabled bool `yaml:"enabled"`

	NetAddr `yaml:",inline"`
}

RTMPSource holds the configuration for the RTMP source.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service provides configuration services.

func NewDefaultService

func NewDefaultService() (*Service, error)

NewDefaultService creates a new service with the default configuration file location.

func NewService

func NewService(configDirFunc ConfigDirFunc, chanSize int) (*Service, error)

NewService creates a new service with provided ConfigDirFunc.

The app data directories (config and state) are created if they do not exist.

func (*Service) C added in v0.0.3

func (s *Service) C() <-chan Config

C returns a channel that receives configuration updates.

The channel is never closed.

func (*Service) Current added in v0.0.3

func (s *Service) Current() Config

Current returns the current configuration.

This will be the last-loaded or last-updated configuration, or a default configuration if nothing else is available.

func (*Service) Path

func (s *Service) Path() string

Path returns the path to the configuration file.

func (*Service) ReadOrCreateConfig

func (s *Service) ReadOrCreateConfig() (cfg Config, _ error)

ReadOrCreateConfig reads the configuration from the file or creates it with default values.

func (*Service) SetConfig added in v0.0.3

func (s *Service) SetConfig(cfg Config) error

SetConfig sets the configuration to the given value and writes it to the file.

type Sources

type Sources struct {
	MediaServer MediaServerSource `yaml:"mediaServer"`
}

Sources holds the configuration for the sources.

type TLS added in v0.0.8

type TLS struct {
	CertPath string `yaml:"cert,omitempty"`
	KeyPath  string `yaml:"key,omitempty"`
}

TLS holds the TLS configuration.

Jump to

Keyboard shortcuts

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