config

package
v1.4.3-dev5 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CongestionControlProbeModePadding CongestionControlProbeMode = "padding"
	CongestionControlProbeModeMedia   CongestionControlProbeMode = "media"

	StreamTrackerTypePacket StreamTrackerType = "packet"
	StreamTrackerTypeFrame  StreamTrackerType = "frame"

	StatsUpdateInterval          = time.Second * 10
	TelemetryStatsUpdateInterval = time.Second * 30
)

Variables

View Source
var (
	ErrKeyFileIncorrectPermission = errors.New("key file must have 0600 permission")
	ErrKeysNotSet                 = errors.New("one of key-file or keys must be provided")
)

Functions

func GenerateCLIFlags

func GenerateCLIFlags(existingFlags []cli.Flag, hidden bool) ([]cli.Flag, error)

func InitLoggerFromConfig

func InitLoggerFromConfig(config LoggingConfig)

func SetLogger

func SetLogger(l logger.Logger)

Note: only pass in logr.Logger with default depth

Types

type APIConfig

type APIConfig struct {
	// amount of time to wait for API to execute, default 2s
	ExecutionTimeout time.Duration

	// amount of time to wait before checking for operation complete
	CheckInterval time.Duration
}

not exposed to YAML

func DefaultAPIConfig

func DefaultAPIConfig() APIConfig

type AudioConfig

type AudioConfig struct {
	// minimum level to be considered active, 0-127, where 0 is loudest
	ActiveLevel uint8 `yaml:"active_level,omitempty"`
	// percentile to measure, a participant is considered active if it has exceeded the ActiveLevel more than
	// MinPercentile% of the time
	MinPercentile uint8 `yaml:"min_percentile,omitempty"`
	// interval to update clients, in ms
	UpdateInterval uint32 `yaml:"update_interval,omitempty"`
	// smoothing for audioLevel values sent to the client.
	// audioLevel will be an average of `smooth_intervals`, 0 to disable
	SmoothIntervals uint32 `yaml:"smooth_intervals,omitempty"`
	// enable red encoding downtrack for opus only audio up track
	ActiveREDEncoding bool `yaml:"active_red_encoding,omitempty"`
}

type CodecSpec

type CodecSpec struct {
	Mime     string `yaml:"mime"`
	FmtpLine string `yaml:"fmtp_line"`
}

type Config

type Config struct {
	Port           uint32                   `yaml:"port"`
	BindAddresses  []string                 `yaml:"bind_addresses,omitempty"`
	PrometheusPort uint32                   `yaml:"prometheus_port,omitempty"`
	Environment    string                   `yaml:"environment,omitempty"`
	RTC            RTCConfig                `yaml:"rtc,omitempty"`
	Redis          redisLiveKit.RedisConfig `yaml:"redis,omitempty"`
	Audio          AudioConfig              `yaml:"audio,omitempty"`
	Video          VideoConfig              `yaml:"video,omitempty"`
	Room           RoomConfig               `yaml:"room,omitempty"`
	TURN           TURNConfig               `yaml:"turn,omitempty"`
	Ingress        IngressConfig            `yaml:"ingress,omitempty"`
	WebHook        WebHookConfig            `yaml:"webhook,omitempty"`
	NodeSelector   NodeSelectorConfig       `yaml:"node_selector,omitempty"`
	KeyFile        string                   `yaml:"key_file,omitempty"`
	Keys           map[string]string        `yaml:"keys,omitempty"`
	Region         string                   `yaml:"region,omitempty"`
	SignalRelay    SignalRelayConfig        `yaml:"signal_relay,omitempty"`
	// LogLevel is deprecated
	LogLevel string        `yaml:"log_level,omitempty"`
	Logging  LoggingConfig `yaml:"logging,omitempty"`
	Limit    LimitConfig   `yaml:"limit,omitempty"`

	Development bool `yaml:"development,omitempty"`
}

func NewConfig

func NewConfig(confString string, strictMode bool, c *cli.Context, baseFlags []cli.Flag) (*Config, error)

func (*Config) IsTURNSEnabled

func (conf *Config) IsTURNSEnabled() bool

func (*Config) ToCLIFlagNames

func (conf *Config) ToCLIFlagNames(existingFlags []cli.Flag) map[string]reflect.Value

func (*Config) ValidateKeys

func (conf *Config) ValidateKeys() error

type CongestionControlConfig

type CongestionControlConfig struct {
	Enabled            bool                       `yaml:"enabled"`
	AllowPause         bool                       `yaml:"allow_pause"`
	UseSendSideBWE     bool                       `yaml:"send_side_bandwidth_estimation,omitempty"`
	ProbeMode          CongestionControlProbeMode `yaml:"padding_mode,omitempty"`
	MinChannelCapacity int64                      `yaml:"min_channel_capacity,omitempty"`
}

type CongestionControlProbeMode

type CongestionControlProbeMode string

type IngressConfig

type IngressConfig struct {
	RTMPBaseURL string `yaml:"rtmp_base_url"`
	WHIPBaseURL string `yaml:"whip_base_url"`
}

type LimitConfig

type LimitConfig struct {
	NumTracks              int32   `yaml:"num_tracks,omitempty"`
	BytesPerSec            float32 `yaml:"bytes_per_sec,omitempty"`
	SubscriptionLimitVideo int32   `yaml:"subscription_limit_video,omitempty"`
	SubscriptionLimitAudio int32   `yaml:"subscription_limit_audio,omitempty"`
}

type LoggingConfig

type LoggingConfig struct {
	logger.Config `yaml:",inline"`
	PionLevel     string `yaml:"pion_level,omitempty"`
}

type NodeSelectorConfig

type NodeSelectorConfig struct {
	Kind         string         `yaml:"kind"`
	SortBy       string         `yaml:"sort_by,omitempty"`
	CPULoadLimit float32        `yaml:"cpu_load_limit,omitempty"`
	SysloadLimit float32        `yaml:"sysload_limit,omitempty"`
	Regions      []RegionConfig `yaml:"regions,omitempty"`
}

type PLIThrottleConfig

type PLIThrottleConfig struct {
	LowQuality  time.Duration `yaml:"low_quality,omitempty"`
	MidQuality  time.Duration `yaml:"mid_quality,omitempty"`
	HighQuality time.Duration `yaml:"high_quality,omitempty"`
}

type RTCConfig

type RTCConfig struct {
	rtcconfig.RTCConfig `yaml:",inline"`

	TURNServers []TURNServer `yaml:"turn_servers,omitempty"`

	StrictACKs bool `yaml:"strict_acks,omitempty"`

	// Number of packets to buffer for NACK
	PacketBufferSize int `yaml:"packet_buffer_size,omitempty"`

	// Throttle periods for pli/fir rtcp packets
	PLIThrottle PLIThrottleConfig `yaml:"pli_throttle,omitempty"`

	CongestionControl CongestionControlConfig `yaml:"congestion_control,omitempty"`

	// allow TCP and TURN/TLS fallback
	AllowTCPFallback *bool `yaml:"allow_tcp_fallback,omitempty"`

	// force a reconnect on a publication error
	ReconnectOnPublicationError *bool `yaml:"reconnect_on_publication_error,omitempty"`

	// force a reconnect on a subscription error
	ReconnectOnSubscriptionError *bool `yaml:"reconnect_on_subscription_error,omitempty"`

	// allow time stamp adjust to keep drift low, this is experimental
	AllowTimestampAdjustment *bool `yaml:"allow_timestamp_adjustment,omitempty"`
}

type RegionConfig

type RegionConfig struct {
	Name string  `yaml:"name"`
	Lat  float64 `yaml:"lat"`
	Lon  float64 `yaml:"lon"`
}

RegionConfig lists available regions and their latitude/longitude, so the selector would prefer regions that are closer

type RoomConfig

type RoomConfig struct {
	// enable rooms to be automatically created
	AutoCreate         bool        `yaml:"auto_create,omitempty"`
	EnabledCodecs      []CodecSpec `yaml:"enabled_codecs,omitempty"`
	MaxParticipants    uint32      `yaml:"max_participants,omitempty"`
	EmptyTimeout       uint32      `yaml:"empty_timeout,omitempty"`
	EnableRemoteUnmute bool        `yaml:"enable_remote_unmute,omitempty"`
	MaxMetadataSize    uint32      `yaml:"max_metadata_size,omitempty"`
}

type SignalRelayConfig

type SignalRelayConfig struct {
	Enabled          bool          `yaml:"enabled"`
	RetryTimeout     time.Duration `yaml:"retry_timeout,omitempty"`
	MinRetryInterval time.Duration `yaml:"min_retry_interval,omitempty"`
	MaxRetryInterval time.Duration `yaml:"max_retry_interval,omitempty"`
	StreamBufferSize int           `yaml:"stream_buffer_size,omitempty"`
}

type StreamTrackerConfig

type StreamTrackerConfig struct {
	StreamTrackerType     StreamTrackerType                   `yaml:"stream_tracker_type,omitempty"`
	BitrateReportInterval map[int32]time.Duration             `yaml:"bitrate_report_interval,omitempty"`
	PacketTracker         map[int32]StreamTrackerPacketConfig `yaml:"packet_tracker,omitempty"`
	FrameTracker          map[int32]StreamTrackerFrameConfig  `yaml:"frame_tracker,omitempty"`
}

type StreamTrackerFrameConfig

type StreamTrackerFrameConfig struct {
	MinFPS float64 `yaml:"min_fps"`
}

type StreamTrackerPacketConfig

type StreamTrackerPacketConfig struct {
	SamplesRequired uint32        `yaml:"samples_required,omitempty"` // number of samples needed per cycle
	CyclesRequired  uint32        `yaml:"cycles_required,omitempty"`  // number of cycles needed to be active
	CycleDuration   time.Duration `yaml:"cycle_duration,omitempty"`
}

type StreamTrackerType

type StreamTrackerType string

type StreamTrackersConfig

type StreamTrackersConfig struct {
	Video       StreamTrackerConfig `yaml:"video,omitempty"`
	Screenshare StreamTrackerConfig `yaml:"screenshare,omitempty"`
}

type TURNConfig

type TURNConfig struct {
	Enabled             bool   `yaml:"enabled"`
	Domain              string `yaml:"domain,omitempty"`
	CertFile            string `yaml:"cert_file,omitempty"`
	KeyFile             string `yaml:"key_file,omitempty"`
	TLSPort             int    `yaml:"tls_port,omitempty"`
	UDPPort             int    `yaml:"udp_port,omitempty"`
	RelayPortRangeStart uint16 `yaml:"relay_range_start,omitempty"`
	RelayPortRangeEnd   uint16 `yaml:"relay_range_end,omitempty"`
	ExternalTLS         bool   `yaml:"external_tls,omitempty"`
}

type TURNServer

type TURNServer struct {
	Host       string `yaml:"host"`
	Port       int    `yaml:"port"`
	Protocol   string `yaml:"protocol"`
	Username   string `yaml:"username,omitempty"`
	Credential string `yaml:"credential,omitempty"`
}

type VideoConfig

type VideoConfig struct {
	DynacastPauseDelay time.Duration        `yaml:"dynacast_pause_delay,omitempty"`
	StreamTracker      StreamTrackersConfig `yaml:"stream_tracker,omitempty"`
}

type WebHookConfig

type WebHookConfig struct {
	URLs []string `yaml:"urls"`
	// key to use for webhook
	APIKey string `yaml:"api_key"`
}

Jump to

Keyboard shortcuts

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