Documentation
¶
Overview ¶
Code generated by godddx, DO AVOID EDIT.
Code generated by godddx, DO AVOID EDIT.
Code generated by godddx, DO AVOID EDIT.
Code generated by godddx, DO AVOID EDIT.
Code generated by godddx, DO AVOID EDIT.
Index ¶
- Constants
- type AddMediaServerInput
- type AddStreamProxyRequest
- type Core
- func (c *Core) AddMediaServer(ctx context.Context, in *AddMediaServerInput) (*MediaServer, error)
- func (c *Core) DelMediaServer(ctx context.Context, id string) (*MediaServer, error)
- func (c *Core) EditMediaServer(ctx context.Context, in *EditMediaServerInput, id string, serverPort int) (*MediaServer, error)
- func (c *Core) FindMediaServer(ctx context.Context, in *FindMediaServerInput) ([]*MediaServer, int64, error)
- func (c *Core) GetMediaServer(ctx context.Context, id string) (*MediaServer, error)
- type Driver
- type EditMediaServerInput
- type FindMediaServerInput
- type GetSnapRequest
- type LalmaxDriver
- func (l *LalmaxDriver) AddStreamProxy(ctx context.Context, ms *MediaServer, req *AddStreamProxyRequest) (*zlm.AddStreamProxyResponse, error)
- func (l *LalmaxDriver) CloseRTPServer(ctx context.Context, ms *MediaServer, req *zlm.CloseRTPServerRequest) (*zlm.CloseRTPServerResponse, error)
- func (l *LalmaxDriver) Connect(ctx context.Context, ms *MediaServer) error
- func (l *LalmaxDriver) GetSnapshot(ctx context.Context, ms *MediaServer, req *GetSnapRequest) ([]byte, error)
- func (l *LalmaxDriver) GetStreamLiveAddr(ctx context.Context, ms *MediaServer, httpPrefix string, host string, ...) StreamLiveAddr
- func (l *LalmaxDriver) OpenRTPServer(ctx context.Context, ms *MediaServer, req *zlm.OpenRTPServerRequest) (*zlm.OpenRTPServerResponse, error)
- func (l *LalmaxDriver) Ping(ctx context.Context, ms *MediaServer) error
- func (l *LalmaxDriver) Protocol() string
- func (l *LalmaxDriver) Setup(ctx context.Context, ms *MediaServer, webhookURL string) error
- type MediaServer
- type MediaServerPorts
- type MediaServerStorer
- type NodeManager
- func (n *NodeManager) AddStreamProxy(server *MediaServer, in AddStreamProxyRequest) (*zlm.AddStreamProxyResponse, error)
- func (n *NodeManager) Close()
- func (n *NodeManager) CloseRTPServer(server *MediaServer, in zlm.CloseRTPServerRequest) (*zlm.CloseRTPServerResponse, error)
- func (n *NodeManager) GetSnapshot(server *MediaServer, in GetSnapRequest) ([]byte, error)
- func (n *NodeManager) GetStreamLiveAddr(server *MediaServer, httpPrefix, host, app, stream string) StreamLiveAddr
- func (n *NodeManager) IsOnline(serverID string) bool
- func (n *NodeManager) Keepalive(serverID string)
- func (n *NodeManager) OpenRTPServer(server *MediaServer, in zlm.OpenRTPServerRequest) (*zlm.OpenRTPServerResponse, error)
- func (n *NodeManager) RegisterDriver(name string, driver Driver)
- func (n *NodeManager) Run(bc *conf.Bootstrap, serverPort int) error
- type NodeServicer
- type Storer
- type StreamLiveAddr
- type WarpMediaServer
- type ZLMDriver
- func (d *ZLMDriver) AddStreamProxy(ctx context.Context, ms *MediaServer, req *AddStreamProxyRequest) (*zlm.AddStreamProxyResponse, error)
- func (d *ZLMDriver) CloseRTPServer(ctx context.Context, ms *MediaServer, req *zlm.CloseRTPServerRequest) (*zlm.CloseRTPServerResponse, error)
- func (d *ZLMDriver) Connect(ctx context.Context, ms *MediaServer) error
- func (d *ZLMDriver) GetSnapshot(ctx context.Context, ms *MediaServer, req *GetSnapRequest) ([]byte, error)
- func (d *ZLMDriver) GetStreamLiveAddr(ctx context.Context, ms *MediaServer, httpPrefix, host, app, stream string) StreamLiveAddr
- func (d *ZLMDriver) OpenRTPServer(ctx context.Context, ms *MediaServer, req *zlm.OpenRTPServerRequest) (*zlm.OpenRTPServerResponse, error)
- func (d *ZLMDriver) Ping(ctx context.Context, ms *MediaServer) error
- func (d *ZLMDriver) Protocol() string
- func (d *ZLMDriver) Setup(ctx context.Context, ms *MediaServer, webhookURL string) error
Constants ¶
const ( ProtocolZLMediaKit = "zlm" ProtocolLalmax = "lalmax" )
const ( PullTimeoutMs = 10000 PullRetryNum = 3 )
const DefaultMediaServerID = "local"
DefaultMediaServerID 临时变量,待未来重构分布式流媒体时,移除
const KeepaliveInterval = 2 * 15 * time.Second
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddMediaServerInput ¶
type AddMediaServerInput struct {
IP string `json:"ip"`
HookIP string `json:"hook_ip"`
SDPIP string `json:"sdpip"`
StreamIP string `json:"stream_ip"`
Ports MediaServerPorts `json:"ports"`
AutoConfig bool `json:"auto_config"`
Secret string `json:"secret"`
HookAliveInterval int `json:"hook_alive_interval"`
RTPEnable bool `json:"rtpenable"`
Status bool `json:"status"`
RTPPortRange string `json:"rtpport_range"`
SendRTPPortRange string `json:"send_rtpport_range"`
RecordAssistPort int `json:"record_assist_port"`
LastKeepaliveAt orm.Time `json:"last_keepalive_at"`
IsDefault bool `json:"is_default"`
RecordDay int `json:"record_day"`
RecordPath string `json:"record_path"`
Type string `json:"type"`
TranscodeSuffix string `json:"transcode_suffix"`
}
type AddStreamProxyRequest ¶
type Core ¶
type Core struct {
*NodeManager
// contains filtered or unexported fields
}
Core business domain
func (*Core) AddMediaServer ¶
func (c *Core) AddMediaServer(ctx context.Context, in *AddMediaServerInput) (*MediaServer, error)
AddMediaServer Insert into database
func (*Core) DelMediaServer ¶
DelMediaServer Delete object
func (*Core) EditMediaServer ¶
func (c *Core) EditMediaServer(ctx context.Context, in *EditMediaServerInput, id string, serverPort int) (*MediaServer, error)
EditMediaServer Update object information
func (*Core) FindMediaServer ¶
func (c *Core) FindMediaServer(ctx context.Context, in *FindMediaServerInput) ([]*MediaServer, int64, error)
FindMediaServer Paginated search
func (*Core) GetMediaServer ¶
GetMediaServer Query a single object
type Driver ¶
type Driver interface {
// Protocol 返回协议/类型名称,如 "zlm", "srs"
Protocol() string
// Connect 测试连接并获取初始信息 (对应目前的 connection 方法中的部分逻辑)
Connect(ctx context.Context, ms *MediaServer) error
// Setup 下发配置到流媒体服务 (对应目前的 connection 方法中的配置逻辑)
Setup(ctx context.Context, ms *MediaServer, webhookURL string) error
// Ping 主动探测服务是否在线
Ping(ctx context.Context, ms *MediaServer) error
// Stream Operations
OpenRTPServer(ctx context.Context, ms *MediaServer, req *zlm.OpenRTPServerRequest) (*zlm.OpenRTPServerResponse, error)
CloseRTPServer(ctx context.Context, ms *MediaServer, req *zlm.CloseRTPServerRequest) (*zlm.CloseRTPServerResponse, error)
AddStreamProxy(ctx context.Context, ms *MediaServer, req *AddStreamProxyRequest) (*zlm.AddStreamProxyResponse, error)
GetSnapshot(ctx context.Context, ms *MediaServer, req *GetSnapRequest) ([]byte, error)
GetStreamLiveAddr(ctx context.Context, ms *MediaServer, httpPrefix, host, app, stream string) StreamLiveAddr
}
Driver 定义流媒体服务的通用行为
type EditMediaServerInput ¶
type EditMediaServerInput struct {
IP string `json:"ip"`
HookIP string `json:"hook_ip"`
SDPIP string `json:"sdp_ip"`
// StreamIP string `json:"stream_ip"`
// Ports MediaServerPorts `json:"ports"`
// AutoConfig bool `json:"auto_config"`
Secret string `json:"secret"`
Type string `json:"type"` // lalmax/zlm
}
type FindMediaServerInput ¶
type FindMediaServerInput struct {
web.PagerFilter
IP string `form:"ip"`
HookIP string `form:"hook_ip"`
SDPIP string `form:"sdpip"`
StreamIP string `form:"stream_ip"`
Ports MediaServerPorts `form:"ports"`
AutoConfig bool `form:"auto_config"`
Secret string `form:"secret"`
HookAliveInterval int `form:"hook_alive_interval"`
RTPEnable bool `form:"rtpenable"`
Status bool `form:"status"`
RTPPortRange string `form:"rtpport_range"`
SendRTPPortRange string `form:"send_rtpport_range"`
RecordAssistPort int `form:"record_assist_port"`
LastKeepaliveAt orm.Time `form:"last_keepalive_at"`
IsDefault bool `form:"is_default"`
RecordDay int `form:"record_day"`
RecordPath string `form:"record_path"`
Type string `form:"type"`
TranscodeSuffix string `form:"transcode_suffix"`
}
type GetSnapRequest ¶
type GetSnapRequest struct {
zlm.GetSnapRequest
// lalmax
Stream string `json:"stream"`
}
type LalmaxDriver ¶
type LalmaxDriver struct {
// contains filtered or unexported fields
}
func NewLalmaxDriver ¶
func NewLalmaxDriver() *LalmaxDriver
func (*LalmaxDriver) AddStreamProxy ¶
func (l *LalmaxDriver) AddStreamProxy(ctx context.Context, ms *MediaServer, req *AddStreamProxyRequest) (*zlm.AddStreamProxyResponse, error)
AddStreamProxy implements Driver.
func (*LalmaxDriver) CloseRTPServer ¶
func (l *LalmaxDriver) CloseRTPServer(ctx context.Context, ms *MediaServer, req *zlm.CloseRTPServerRequest) (*zlm.CloseRTPServerResponse, error)
CloseRTPServer implements Driver.
func (*LalmaxDriver) Connect ¶
func (l *LalmaxDriver) Connect(ctx context.Context, ms *MediaServer) error
Connect implements Driver.
func (*LalmaxDriver) GetSnapshot ¶
func (l *LalmaxDriver) GetSnapshot(ctx context.Context, ms *MediaServer, req *GetSnapRequest) ([]byte, error)
GetSnapshot implements Driver.
func (*LalmaxDriver) GetStreamLiveAddr ¶
func (l *LalmaxDriver) GetStreamLiveAddr(ctx context.Context, ms *MediaServer, httpPrefix string, host string, app string, stream string) StreamLiveAddr
GetStreamLiveAddr implements Driver.
func (*LalmaxDriver) OpenRTPServer ¶
func (l *LalmaxDriver) OpenRTPServer(ctx context.Context, ms *MediaServer, req *zlm.OpenRTPServerRequest) (*zlm.OpenRTPServerResponse, error)
OpenRTPServer implements Driver.
func (*LalmaxDriver) Ping ¶
func (l *LalmaxDriver) Ping(ctx context.Context, ms *MediaServer) error
Ping implements Driver.
func (*LalmaxDriver) Protocol ¶
func (l *LalmaxDriver) Protocol() string
Protocol implements Driver.
func (*LalmaxDriver) Setup ¶
func (l *LalmaxDriver) Setup(ctx context.Context, ms *MediaServer, webhookURL string) error
Setup implements Driver.
type MediaServer ¶
type MediaServer struct {
ID string `gorm:"primaryKey" json:"id"`
IP string `gorm:"column:ip;notNull;default:''" json:"ip"`
CreatedAt orm.Time `gorm:"column:created_at;notNull;default:CURRENT_TIMESTAMP" json:"created_at"`
UpdatedAt orm.Time `gorm:"column:updated_at;notNull;default:CURRENT_TIMESTAMP" json:"updated_at"`
HookIP string `gorm:"column:hook_ip;notNull;default:''" json:"hook_ip"`
SDPIP string `gorm:"column:sdp_ip;notNull;default:''" json:"sdp_ip"`
StreamIP string `gorm:"column:stream_ip;notNull;default:''" json:"stream_ip"`
Ports MediaServerPorts `gorm:"column:ports;notNull;default:'{}';type:jsonb" json:"ports"`
AutoConfig bool `gorm:"column:auto_config;notNull;default:FALSE" json:"auto_config"`
Secret string `gorm:"column:secret;notNull;default:''" json:"secret"`
HookAliveInterval int `gorm:"column:hook_alive_interval;notNull;default:0" json:"hook_alive_interval"`
RTPEnable bool `gorm:"column:rtpenable;notNull;default:FALSE" json:"rtpenable"`
Status bool `gorm:"column:status;notNull;default:FALSE" json:"status"`
RTPPortRange string `gorm:"column:rtpport_range;notNull;default:''" json:"rtpport_range"`
SendRTPPortRange string `gorm:"column:send_rtpport_range;notNull;default:''" json:"send_rtpport_range"`
RecordAssistPort int `gorm:"column:record_assist_port;notNull;default:0" json:"record_assist_port"`
LastKeepaliveAt orm.Time `gorm:"column:last_keepalive_at;notNull;default:CURRENT_TIMESTAMP" json:"last_keepalive_at"`
RecordDay int `gorm:"column:record_day;notNull;default:0" json:"record_day"`
RecordPath string `gorm:"column:record_path;notNull;default:''" json:"record_path"`
Type string `gorm:"column:type;notNull;default:''" json:"type"`
TranscodeSuffix string `gorm:"column:transcode_suffix;notNull;default:''" json:"transcode_suffix"`
}
MediaServer domain model
func (*MediaServer) GetSDPIP ¶
func (m *MediaServer) GetSDPIP() string
func (*MediaServer) TableName ¶
func (*MediaServer) TableName() string
TableName database table name
type MediaServerPorts ¶
type MediaServerPorts struct {
HTTP int `json:"http"`
HTTPS int `json:"https"`
RTMP int `json:"rtmp"`
FLV int `json:"flv"`
FLVs int `json:"flvs"`
WsFLV int `json:"ws_flv"`
WsFLVs int `json:"ws_flvs"`
RTMPs int `json:"rtmps"`
RTPPorxy int `json:"rtpporxy"`
RTSP int `json:"rtsp"`
RTSPs int `json:"rtsps"`
}
MediaServerPorts domain model
func (*MediaServerPorts) Scan ¶
func (i *MediaServerPorts) Scan(input any) error
Scan implements orm.Scaner.
type MediaServerStorer ¶
type MediaServerStorer interface {
Find(context.Context, *[]*MediaServer, orm.Pager, ...orm.QueryOption) (int64, error)
Get(context.Context, *MediaServer, ...orm.QueryOption) error
Add(context.Context, *MediaServer) error
Edit(context.Context, *MediaServer, func(*MediaServer), ...orm.QueryOption) error
Del(context.Context, *MediaServer, ...orm.QueryOption) error
}
MediaServerStorer Instantiation interface
type NodeManager ¶
type NodeManager struct {
// contains filtered or unexported fields
}
func NewNodeManager ¶
func NewNodeManager(storer Storer) *NodeManager
func (*NodeManager) AddStreamProxy ¶
func (n *NodeManager) AddStreamProxy(server *MediaServer, in AddStreamProxyRequest) (*zlm.AddStreamProxyResponse, error)
AddStreamProxy 添加流代理
func (*NodeManager) Close ¶
func (n *NodeManager) Close()
func (*NodeManager) CloseRTPServer ¶
func (n *NodeManager) CloseRTPServer(server *MediaServer, in zlm.CloseRTPServerRequest) (*zlm.CloseRTPServerResponse, error)
CloseRTPServer 关闭RTP服务器
func (*NodeManager) GetSnapshot ¶
func (n *NodeManager) GetSnapshot(server *MediaServer, in GetSnapRequest) ([]byte, error)
func (*NodeManager) GetStreamLiveAddr ¶
func (n *NodeManager) GetStreamLiveAddr(server *MediaServer, httpPrefix, host, app, stream string) StreamLiveAddr
func (*NodeManager) IsOnline ¶
func (n *NodeManager) IsOnline(serverID string) bool
func (*NodeManager) Keepalive ¶
func (n *NodeManager) Keepalive(serverID string)
func (*NodeManager) OpenRTPServer ¶
func (n *NodeManager) OpenRTPServer(server *MediaServer, in zlm.OpenRTPServerRequest) (*zlm.OpenRTPServerResponse, error)
OpenRTPServer 开启RTP服务器
func (*NodeManager) RegisterDriver ¶
func (n *NodeManager) RegisterDriver(name string, driver Driver)
type NodeServicer ¶
type NodeServicer any
type StreamLiveAddr ¶
type WarpMediaServer ¶
type WarpMediaServer struct {
IsOnline bool
LastUpdatedAt time.Time
Config *MediaServer
}
type ZLMDriver ¶
type ZLMDriver struct {
// contains filtered or unexported fields
}
func NewZLMDriver ¶
func NewZLMDriver() *ZLMDriver
func (*ZLMDriver) AddStreamProxy ¶
func (d *ZLMDriver) AddStreamProxy(ctx context.Context, ms *MediaServer, req *AddStreamProxyRequest) (*zlm.AddStreamProxyResponse, error)
func (*ZLMDriver) CloseRTPServer ¶
func (d *ZLMDriver) CloseRTPServer(ctx context.Context, ms *MediaServer, req *zlm.CloseRTPServerRequest) (*zlm.CloseRTPServerResponse, error)
func (*ZLMDriver) GetSnapshot ¶
func (d *ZLMDriver) GetSnapshot(ctx context.Context, ms *MediaServer, req *GetSnapRequest) ([]byte, error)
func (*ZLMDriver) GetStreamLiveAddr ¶
func (d *ZLMDriver) GetStreamLiveAddr(ctx context.Context, ms *MediaServer, httpPrefix, host, app, stream string) StreamLiveAddr
GetStreamLiveAddr implements Driver.
func (*ZLMDriver) OpenRTPServer ¶
func (d *ZLMDriver) OpenRTPServer(ctx context.Context, ms *MediaServer, req *zlm.OpenRTPServerRequest) (*zlm.OpenRTPServerResponse, error)