settings

package
v0.3.0-alpha-2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Settings      = make(map[string]Setting)
	GroupSettings = make(map[model.SettingGroup][]Setting)
)
View Source
var (
	DisableCreateRoom    = newBoolSetting("disable_create_room", false, model.SettingGroupRoom)
	RoomMustNeedPwd      = newBoolSetting("room_must_need_pwd", false, model.SettingGroupRoom)
	CreateRoomNeedReview = newBoolSetting("create_room_need_review", false, model.SettingGroupRoom)
	RoomTTL              = newInt64Setting("room_ttl", int64(time.Hour*48), model.SettingGroupRoom)
	UserMaxRoomCount     = newInt64Setting("user_max_room_count", 3, model.SettingGroupRoom)
)
View Source
var (
	DisableUserSignup = newBoolSetting("disable_user_signup", false, model.SettingGroupUser)
	SignupNeedReview  = newBoolSetting("signup_need_review", false, model.SettingGroupUser)
)
View Source
var (
	MovieProxy        = newBoolSetting("movie_proxy", true, model.SettingGroupProxy)
	LiveProxy         = newBoolSetting("live_proxy", true, model.SettingGroupProxy)
	AllowProxyToLocal = newBoolSetting("allow_proxy_to_local", false, model.SettingGroupProxy)
)
View Source
var (
	// can watch live streams through the RTMP protocol (without authentication, insecure).
	RtmpPlayer = newBoolSetting("rtmp_player", false, model.SettingGroupRtmp)
	// default use http header host
	CustomPublishHost = newStringSetting("custom_publish_host", "", model.SettingGroupRtmp)
	// disguise the .ts file as a .png file
	TsDisguisedAsPng = newBoolSetting("ts_disguised_as_png", true, model.SettingGroupRtmp)
)

Functions

func Init

func Init() error

func SetSettingValue

func SetSettingValue(s Setting, value any) error

func SetValue

func SetValue(name string, value any) error

Types

type Bool

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

func NewBool

func NewBool(name string, value bool, group model.SettingGroup) *Bool

func (*Bool) Default

func (b *Bool) Default() bool

func (*Bool) DefaultInterface

func (b *Bool) DefaultInterface() any

func (*Bool) DefaultRaw

func (b *Bool) DefaultRaw() string

func (*Bool) Get

func (b *Bool) Get() bool

func (*Bool) Group

func (d *Bool) Group() model.SettingGroup

func (*Bool) Init

func (b *Bool) Init(value string) error

func (*Bool) Interface

func (b *Bool) Interface() any

func (*Bool) Name

func (d *Bool) Name() string

func (*Bool) Parse

func (b *Bool) Parse(value string) (bool, error)

func (*Bool) Raw

func (b *Bool) Raw() string

func (*Bool) Set

func (b *Bool) Set(value bool) error

func (*Bool) SetRaw

func (b *Bool) SetRaw(value string) error

func (*Bool) Stringify

func (b *Bool) Stringify(value bool) string

func (*Bool) Type

func (d *Bool) Type() model.SettingType

type BoolSetting

type BoolSetting interface {
	Setting
	Set(bool) error
	Get() bool
	Default() bool
	Parse(string) (bool, error)
	Stringify(bool) string
}

type Float64

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

func NewFloat64

func NewFloat64(name string, value float64, group model.SettingGroup) *Float64

func (*Float64) Default

func (f *Float64) Default() float64

func (*Float64) DefaultInterface

func (f *Float64) DefaultInterface() any

func (*Float64) DefaultRaw

func (f *Float64) DefaultRaw() string

func (*Float64) Get

func (f *Float64) Get() float64

func (*Float64) Group

func (d *Float64) Group() model.SettingGroup

func (*Float64) Init

func (f *Float64) Init(value string) error

func (*Float64) Interface

func (f *Float64) Interface() any

func (*Float64) Name

func (d *Float64) Name() string

func (*Float64) Parse

func (f *Float64) Parse(value string) (float64, error)

func (*Float64) Raw

func (f *Float64) Raw() string

func (*Float64) Set

func (f *Float64) Set(value float64) error

func (*Float64) SetRaw

func (f *Float64) SetRaw(value string) error

func (*Float64) Stringify

func (f *Float64) Stringify(value float64) string

func (*Float64) Type

func (d *Float64) Type() model.SettingType

type Float64Setting

type Float64Setting interface {
	Setting
	Set(float64) error
	Get() float64
	Default() float64
	Parse(string) (float64, error)
	Stringify(float64) string
}

type Int64

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

func NewInt64

func NewInt64(name string, value int64, group model.SettingGroup) *Int64

func (*Int64) Default

func (i *Int64) Default() int64

func (*Int64) DefaultInterface

func (i *Int64) DefaultInterface() any

func (*Int64) DefaultRaw

func (i *Int64) DefaultRaw() string

func (*Int64) Get

func (i *Int64) Get() int64

func (*Int64) Group

func (d *Int64) Group() model.SettingGroup

func (*Int64) Init

func (i *Int64) Init(value string) error

func (*Int64) Interface

func (i *Int64) Interface() any

func (*Int64) Name

func (d *Int64) Name() string

func (*Int64) Parse

func (i *Int64) Parse(value string) (int64, error)

func (*Int64) Raw

func (i *Int64) Raw() string

func (*Int64) Set

func (i *Int64) Set(value int64) error

func (*Int64) SetRaw

func (i *Int64) SetRaw(value string) error

func (*Int64) Stringify

func (i *Int64) Stringify(value int64) string

func (*Int64) Type

func (d *Int64) Type() model.SettingType

type Int64Setting

type Int64Setting interface {
	Setting
	Set(int64) error
	Get() int64
	Default() int64
	Parse(string) (int64, error)
	Stringify(int64) string
}

type Setting

type Setting interface {
	Name() string
	Type() model.SettingType
	Group() model.SettingGroup
	Init(string) error
	Raw() string
	SetRaw(string) error
	DefaultRaw() string
	DefaultInterface() any
	Interface() any
}

func ToSettings

func ToSettings[s Setting](settings map[string]s) []Setting

type String

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

func NewString

func NewString(name string, value string, group model.SettingGroup) *String

func (*String) Default

func (s *String) Default() string

func (*String) DefaultInterface

func (s *String) DefaultInterface() any

func (*String) DefaultRaw

func (s *String) DefaultRaw() string

func (*String) Get

func (s *String) Get() string

func (*String) Group

func (d *String) Group() model.SettingGroup

func (*String) Init

func (s *String) Init(value string) error

func (*String) Interface

func (s *String) Interface() any

func (*String) Name

func (d *String) Name() string

func (*String) Parse

func (s *String) Parse(value string) (string, error)

func (*String) Raw

func (s *String) Raw() string

func (*String) Set

func (s *String) Set(value string) error

func (*String) SetRaw

func (s *String) SetRaw(value string) error

func (*String) Stringify

func (s *String) Stringify(value string) string

func (*String) Type

func (d *String) Type() model.SettingType

type StringSetting

type StringSetting interface {
	Setting
	Set(string) error
	Get() string
	Default() string
	Parse(string) (string, error)
	Stringify(string) string
}

Jump to

Keyboard shortcuts

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