Documentation
¶
Index ¶
- Variables
- type Config
- func (config Config) Assign(source Config)
- func (config Config) CreateElem(eleType reflect.Type) reflect.Value
- func (config Config) Get(key string) (v any)
- func (config Config) GetChild(key string) Config
- func (config Config) Has(key string) (ok bool)
- func (config Config) HasChild(key string) (ok bool)
- func (config Config) Merge(source Config)
- func (config *Config) Set(key string, value any)
- func (config Config) Unmarshal(s any)
- type Console
- type Engine
- func (cfg *Engine) GetEnableReport() bool
- func (cfg *Engine) GetInstanceId() string
- func (cfg *Engine) InitDefaultHttp()
- func (cfg *Engine) OnEvent(event any)
- func (cfg *Engine) ReceiveRequest(s quic.Stream, conn quic.Connection) error
- func (cfg *Engine) Remote(ctx context.Context) (wasConnected bool, err error)
- func (cfg *Engine) WsRemote()
- func (cfg *Engine) WtRemote(ctx context.Context)
- type HTTP
- type HTTPConfig
- type HTTPPlugin
- type Middleware
- type Plugin
- type Publish
- type PublishConfig
- type Pull
- type PullConfig
- type Push
- type PushConfig
- type Quic
- type QuicConfig
- type QuicPlugin
- type Subscribe
- type SubscribeConfig
- type TCP
- type TCPConfig
- type TCPPlugin
Constants ¶
This section is empty.
Variables ¶
View Source
var LocalCert []byte
View Source
var LocalKey []byte
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
Publish
Subscribe
HTTP
Console
EnableAVCC bool `default:"true"` //启用AVCC格式,rtmp、http-flv协议使用
EnableRTP bool `default:"true"` //启用RTP格式,rtsp、webrtc等协议使用,已废弃,在 rtp 下面配置
EnableSubEvent bool `default:"true"` //启用订阅事件,禁用可以提高性能
EnableAuth bool `default:"true"` //启用鉴权
LogLang string `default:"zh"` //日志语言
LogLevel string `default:"info"` //日志级别
EventBusSize int `default:"10"` //事件总线大小
PulseInterval time.Duration `default:"5s"` //心跳事件间隔
DisableAll bool `default:"false"` //禁用所有插件
RTPReorderBufferLen int `default:"50"` //RTP重排序缓冲区长度
PoolSize int //内存池大小
// contains filtered or unexported fields
}
var Global *Engine
func (*Engine) GetEnableReport ¶
func (*Engine) GetInstanceId ¶
func (*Engine) InitDefaultHttp ¶
func (cfg *Engine) InitDefaultHttp()
func (*Engine) ReceiveRequest ¶
type HTTP ¶
type HTTP struct {
ListenAddr string
ListenAddrTLS string
CertFile string
KeyFile string
CORS bool `default:"true"` //是否自动添加CORS头
UserName string
Password string
ReadTimeout time.Duration
WriteTimeout time.Duration
IdleTimeout time.Duration
// contains filtered or unexported fields
}
func (*HTTP) AddMiddleware ¶
func (config *HTTP) AddMiddleware(middleware Middleware)
func (*HTTP) GetHTTPConfig ¶
type HTTPConfig ¶
type HTTPPlugin ¶
type Plugin ¶
type Plugin interface {
// 可能的入参类型:FirstConfig 第一次初始化配置,Config 后续配置更新,SE系列(StateEvent)流状态变化事件
OnEvent(any)
}
type Publish ¶
type Publish struct {
PubAudio bool `default:"true"`
PubVideo bool `default:"true"`
InsertSEI bool // 是否启用SEI插入
KickExist bool // 是否踢掉已经存在的发布者
PublishTimeout time.Duration `default:"10s"` // 发布无数据超时
WaitCloseTimeout time.Duration // 延迟自动关闭(等待重连)
DelayCloseTimeout time.Duration // 延迟自动关闭(无订阅时)
IdleTimeout time.Duration // 空闲(无订阅)超时
PauseTimeout time.Duration `default:"30s"` // 暂停超时
BufferTime time.Duration // 缓冲长度(单位:秒),0代表取最近关键帧
SpeedLimit time.Duration `default:"500ms"` //速度限制最大等待时间
Key string // 发布鉴权key
SecretArgName string `default:"secret"` // 发布鉴权参数名
ExpireArgName string `default:"expire"` // 发布鉴权失效时间参数名
RingSize string `default:"256-1024"` // 初始缓冲区大小
}
func (Publish) GetPublishConfig ¶
type PublishConfig ¶
type PublishConfig interface {
GetPublishConfig() Publish
}
type Pull ¶
type Pull struct {
RePull int // 断开后自动重拉,0 表示不自动重拉,-1 表示无限重拉,高于0 的数代表最大重拉次数
EnableRegexp bool // 是否启用正则表达式
PullOnStart map[string]string // 启动时拉流的列表
PullOnSub map[string]string // 订阅时自动拉流的列表
Proxy string // 代理地址
}
func (*Pull) AddPullOnStart ¶
func (*Pull) AddPullOnSub ¶
func (*Pull) CheckPullOnStart ¶
func (*Pull) CheckPullOnSub ¶
func (*Pull) GetPullConfig ¶
type PullConfig ¶
type PullConfig interface {
GetPullConfig() *Pull
}
type Push ¶
type Push struct {
EnableRegexp bool // 是否启用正则表达式
RePush int // 断开后自动重推,0 表示不自动重推,-1 表示无限重推,高于0 的数代表最大重推次数
PushList map[string]string // 自动推流列表
Proxy string // 代理地址
}
func (*Push) GetPushConfig ¶
type PushConfig ¶
type PushConfig interface {
GetPushConfig() *Push
}
type Quic ¶
func (*Quic) ListenQuic ¶
func (q *Quic) ListenQuic(ctx context.Context, plugin QuicPlugin) error
type QuicConfig ¶
type QuicConfig interface {
ListenQuic(context.Context, QuicPlugin) error
}
type QuicPlugin ¶
type QuicPlugin interface {
Plugin
ServeQuic(quic.Connection)
}
type Subscribe ¶
type Subscribe struct {
SubAudio bool `default:"true"`
SubVideo bool `default:"true"`
SubVideoArgName string `default:"vts"` // 指定订阅的视频轨道参数名
SubAudioArgName string `default:"ats"` // 指定订阅的音频轨道参数名
SubDataArgName string `default:"dts"` // 指定订阅的数据轨道参数名
SubModeArgName string `default:"mode"` // 指定订阅的模式参数名
SubAudioTracks []string // 指定订阅的音频轨道
SubVideoTracks []string // 指定订阅的视频轨道
SubDataTracks []string // 指定订阅的数据轨道
SubMode int // 0,实时模式:追赶发布者进度,在播放首屏后等待发布者的下一个关键帧,然后跳到该帧。1、首屏后不进行追赶。2、从缓冲最大的关键帧开始播放,也不追赶,需要发布者配置缓存长度
SyncMode int // 0,采用时间戳同步,1,采用写入时间同步
IFrameOnly bool // 只要关键帧
WaitTimeout time.Duration `default:"10s"` // 等待流超时
WriteBufferSize int `default:"0"` // 写缓冲大小
Key string // 订阅鉴权key
SecretArgName string `default:"secret"` // 订阅鉴权参数名
ExpireArgName string `default:"expire"` // 订阅鉴权失效时间参数名
Internal bool `default:"false"` // 是否内部订阅
}
func (*Subscribe) GetSubscribeConfig ¶
type SubscribeConfig ¶
type SubscribeConfig interface {
GetSubscribeConfig() *Subscribe
}
Click to show internal directories.
Click to hide internal directories.