feat: send alarminfo through hook

This commit is contained in:
pggiroro
2025-07-02 21:48:28 +08:00
parent baf3640b23
commit cad47aec5c
14 changed files with 1692 additions and 2073 deletions

View File

@@ -7,14 +7,16 @@ import (
// AlarmInfo 报警信息实体,用于存储到数据库 // AlarmInfo 报警信息实体,用于存储到数据库
type AlarmInfo struct { type AlarmInfo struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id"` // 主键自增ID ID uint `gorm:"primaryKey;autoIncrement" json:"id"` // 主键自增ID
ServerInfo string `gorm:"type:varchar(255);not null" json:"server_info"` // 服务器信息 ServerInfo string `gorm:"type:varchar(255);not null" json:"serverInfo"` // 服务器信息
StreamName string `gorm:"type:varchar(255);index" json:"stream_name"` // 流名称 StreamName string `gorm:"type:varchar(255);index" json:"streamName"` // 流名称
StreamPath string `gorm:"type:varchar(500)" json:"stream_path"` // 流的streampath StreamPath string `gorm:"type:varchar(500)" json:"streamPath"` // 流的streampath
AlarmDesc string `gorm:"type:varchar(500);not null" json:"alarm_desc"` // 报警描述 AlarmName string `gorm:"type:varchar(255);not null" json:"alarmName"` // 报警名称
AlarmType int `gorm:"not null;index" json:"alarm_type"` // 报警类型(对应之前定义的常量) AlarmDesc string `gorm:"type:varchar(500);not null" json:"alarmDesc"` // 报警描述
IsSent bool `gorm:"default:false" json:"is_sent"` // 是否已成功发送 AlarmType int `gorm:"not null;index" json:"alarmType"` // 报警类型(对应之前定义的常量)
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"` // 创建时间,报警时间 IsSent bool `gorm:"default:false" json:"isSent"` // 是否已成功发送
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"` // 更新时间 CreatedAt time.Time `gorm:"autoCreateTime" json:"createdAt"` // 创建时间,报警时间
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updatedAt"` // 更新时间
FilePath string `gorm:"type:varchar(255)" json:"filePath"` // 文件路径
} }
// TableName 指定表名 // TableName 指定表名

113
api.go
View File

@@ -942,3 +942,116 @@ func (s *Server) GetTransformList(ctx context.Context, req *emptypb.Empty) (res
}) })
return return
} }
func (s *Server) GetAlarmList(ctx context.Context, req *pb.AlarmListRequest) (res *pb.AlarmListResponse, err error) {
// 初始化响应对象
res = &pb.AlarmListResponse{
Code: 0,
Message: "success",
PageNum: req.PageNum,
PageSize: req.PageSize,
}
// 检查数据库连接是否可用
if s.DB == nil {
res.Code = 500
res.Message = "数据库连接不可用"
return res, nil
}
// 构建查询条件
query := s.DB.Model(&AlarmInfo{})
// 添加时间范围过滤
startTime, endTime, err := util.TimeRangeQueryParse(url.Values{
"range": []string{req.Range},
"start": []string{req.Start},
"end": []string{req.End},
})
if err == nil {
if !startTime.IsZero() {
query = query.Where("created_at >= ?", startTime)
}
if !endTime.IsZero() {
query = query.Where("created_at <= ?", endTime)
}
}
// 添加告警类型过滤
if req.AlarmType != 0 {
query = query.Where("alarm_type = ?", req.AlarmType)
}
// 添加 StreamPath 过滤
if req.StreamPath != "" {
if strings.Contains(req.StreamPath, "*") {
// 支持通配符搜索
query = query.Where("stream_path LIKE ?", strings.ReplaceAll(req.StreamPath, "*", "%"))
} else {
query = query.Where("stream_path = ?", req.StreamPath)
}
}
// 添加 StreamName 过滤
if req.StreamName != "" {
if strings.Contains(req.StreamName, "*") {
// 支持通配符搜索
query = query.Where("stream_name LIKE ?", strings.ReplaceAll(req.StreamName, "*", "%"))
} else {
query = query.Where("stream_name = ?", req.StreamName)
}
}
// 计算总记录数
var total int64
if err = query.Count(&total).Error; err != nil {
res.Code = 500
res.Message = "查询告警信息总数失败: " + err.Error()
return res, nil
}
res.Total = int32(total)
// 如果没有记录,直接返回
if total == 0 {
return res, nil
}
// 处理分页参数
if req.PageNum <= 0 {
req.PageNum = 1
}
if req.PageSize <= 0 {
req.PageSize = 10
}
// 查询分页数据
var alarmInfoList []AlarmInfo
offset := (req.PageNum - 1) * req.PageSize
if err = query.Order("created_at DESC").
Offset(int(offset)).
Limit(int(req.PageSize)).
Find(&alarmInfoList).Error; err != nil {
res.Code = 500
res.Message = "查询告警信息失败: " + err.Error()
return res, nil
}
// 转换为 protobuf 格式
res.Data = make([]*pb.AlarmInfo, len(alarmInfoList))
for i, alarm := range alarmInfoList {
res.Data[i] = &pb.AlarmInfo{
Id: uint32(alarm.ID),
ServerInfo: alarm.ServerInfo,
StreamName: alarm.StreamName,
StreamPath: alarm.StreamPath,
AlarmDesc: alarm.AlarmDesc,
AlarmType: int32(alarm.AlarmType),
IsSent: alarm.IsSent,
CreatedAt: timestamppb.New(alarm.CreatedAt),
UpdatedAt: timestamppb.New(alarm.UpdatedAt),
FilePath: alarm.FilePath,
}
}
return res, nil
}

View File

@@ -10,6 +10,7 @@ package pb
import ( import (
"context" "context"
"errors"
"io" "io"
"net/http" "net/http"
@@ -24,116 +25,110 @@ import (
) )
// Suppress "imported and not used" errors // Suppress "imported and not used" errors
var _ codes.Code var (
var _ io.Reader _ codes.Code
var _ status.Status _ io.Reader
var _ = runtime.String _ status.Status
var _ = utilities.NewDoubleArray _ = errors.New
var _ = metadata.Join _ = runtime.String
_ = utilities.NewDoubleArray
_ = metadata.Join
)
func request_Auth_Login_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func request_Auth_Login_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq LoginRequest var (
var metadata runtime.ServerMetadata protoReq LoginRequest
metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { )
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := client.Login(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.Login(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err return msg, metadata, err
} }
func local_request_Auth_Login_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func local_request_Auth_Login_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq LoginRequest var (
var metadata runtime.ServerMetadata protoReq LoginRequest
metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { )
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := server.Login(ctx, &protoReq) msg, err := server.Login(ctx, &protoReq)
return msg, metadata, err return msg, metadata, err
} }
func request_Auth_Logout_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func request_Auth_Logout_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq LogoutRequest var (
var metadata runtime.ServerMetadata protoReq LogoutRequest
metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { )
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := client.Logout(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.Logout(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err return msg, metadata, err
} }
func local_request_Auth_Logout_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func local_request_Auth_Logout_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq LogoutRequest var (
var metadata runtime.ServerMetadata protoReq LogoutRequest
metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { )
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := server.Logout(ctx, &protoReq) msg, err := server.Logout(ctx, &protoReq)
return msg, metadata, err return msg, metadata, err
} }
var ( var filter_Auth_GetUserInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
filter_Auth_GetUserInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Auth_GetUserInfo_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func request_Auth_GetUserInfo_0(ctx context.Context, marshaler runtime.Marshaler, client AuthClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq UserInfoRequest var (
var metadata runtime.ServerMetadata protoReq UserInfoRequest
metadata runtime.ServerMetadata
)
io.Copy(io.Discard, req.Body)
if err := req.ParseForm(); err != nil { if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Auth_GetUserInfo_0); err != nil { if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Auth_GetUserInfo_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := client.GetUserInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.GetUserInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err return msg, metadata, err
} }
func local_request_Auth_GetUserInfo_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func local_request_Auth_GetUserInfo_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq UserInfoRequest var (
var metadata runtime.ServerMetadata protoReq UserInfoRequest
metadata runtime.ServerMetadata
)
if err := req.ParseForm(); err != nil { if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Auth_GetUserInfo_0); err != nil { if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Auth_GetUserInfo_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := server.GetUserInfo(ctx, &protoReq) msg, err := server.GetUserInfo(ctx, &protoReq)
return msg, metadata, err return msg, metadata, err
} }
// RegisterAuthHandlerServer registers the http handlers for service Auth to "mux". // RegisterAuthHandlerServer registers the http handlers for service Auth to "mux".
// UnaryRPC :call AuthServer directly. // UnaryRPC :call AuthServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAuthHandlerFromEndpoint instead. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAuthHandlerFromEndpoint instead.
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterAuthHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AuthServer) error { func RegisterAuthHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AuthServer) error {
mux.Handle(http.MethodPost, pattern_Auth_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("POST", pattern_Auth_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
var stream runtime.ServerTransportStream var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pb.Auth/Login", runtime.WithHTTPPathPattern("/api/auth/login"))
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pb.Auth/Login", runtime.WithHTTPPathPattern("/api/auth/login"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
@@ -145,20 +140,15 @@ func RegisterAuthHandlerServer(ctx context.Context, mux *runtime.ServeMux, serve
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Auth_Login_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Auth_Login_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
mux.Handle(http.MethodPost, pattern_Auth_Logout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("POST", pattern_Auth_Logout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
var stream runtime.ServerTransportStream var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pb.Auth/Logout", runtime.WithHTTPPathPattern("/api/auth/logout"))
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pb.Auth/Logout", runtime.WithHTTPPathPattern("/api/auth/logout"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
@@ -170,20 +160,15 @@ func RegisterAuthHandlerServer(ctx context.Context, mux *runtime.ServeMux, serve
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Auth_Logout_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Auth_Logout_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
mux.Handle(http.MethodGet, pattern_Auth_GetUserInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("GET", pattern_Auth_GetUserInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
var stream runtime.ServerTransportStream var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/pb.Auth/GetUserInfo", runtime.WithHTTPPathPattern("/api/auth/userinfo"))
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pb.Auth/GetUserInfo", runtime.WithHTTPPathPattern("/api/auth/userinfo"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
@@ -195,9 +180,7 @@ func RegisterAuthHandlerServer(ctx context.Context, mux *runtime.ServeMux, serve
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Auth_GetUserInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Auth_GetUserInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
return nil return nil
@@ -206,25 +189,24 @@ func RegisterAuthHandlerServer(ctx context.Context, mux *runtime.ServeMux, serve
// RegisterAuthHandlerFromEndpoint is same as RegisterAuthHandler but // RegisterAuthHandlerFromEndpoint is same as RegisterAuthHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done. // automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterAuthHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { func RegisterAuthHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.DialContext(ctx, endpoint, opts...) conn, err := grpc.NewClient(endpoint, opts...)
if err != nil { if err != nil {
return err return err
} }
defer func() { defer func() {
if err != nil { if err != nil {
if cerr := conn.Close(); cerr != nil { if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
} }
return return
} }
go func() { go func() {
<-ctx.Done() <-ctx.Done()
if cerr := conn.Close(); cerr != nil { if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
} }
}() }()
}() }()
return RegisterAuthHandler(ctx, mux, conn) return RegisterAuthHandler(ctx, mux, conn)
} }
@@ -238,16 +220,13 @@ func RegisterAuthHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AuthClient". // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AuthClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AuthClient" // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AuthClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "AuthClient" to call the correct interceptors. // "AuthClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterAuthHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AuthClient) error { func RegisterAuthHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AuthClient) error {
mux.Handle(http.MethodPost, pattern_Auth_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("POST", pattern_Auth_Login_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/pb.Auth/Login", runtime.WithHTTPPathPattern("/api/auth/login"))
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/pb.Auth/Login", runtime.WithHTTPPathPattern("/api/auth/login"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
@@ -258,18 +237,13 @@ func RegisterAuthHandlerClient(ctx context.Context, mux *runtime.ServeMux, clien
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Auth_Login_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Auth_Login_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
mux.Handle(http.MethodPost, pattern_Auth_Logout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("POST", pattern_Auth_Logout_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/pb.Auth/Logout", runtime.WithHTTPPathPattern("/api/auth/logout"))
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/pb.Auth/Logout", runtime.WithHTTPPathPattern("/api/auth/logout"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
@@ -280,18 +254,13 @@ func RegisterAuthHandlerClient(ctx context.Context, mux *runtime.ServeMux, clien
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Auth_Logout_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Auth_Logout_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
mux.Handle(http.MethodGet, pattern_Auth_GetUserInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("GET", pattern_Auth_GetUserInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/pb.Auth/GetUserInfo", runtime.WithHTTPPathPattern("/api/auth/userinfo"))
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/pb.Auth/GetUserInfo", runtime.WithHTTPPathPattern("/api/auth/userinfo"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
@@ -302,26 +271,19 @@ func RegisterAuthHandlerClient(ctx context.Context, mux *runtime.ServeMux, clien
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Auth_GetUserInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Auth_GetUserInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
return nil return nil
} }
var ( var (
pattern_Auth_Login_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "auth", "login"}, "")) pattern_Auth_Login_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "auth", "login"}, ""))
pattern_Auth_Logout_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "auth", "logout"}, "")) pattern_Auth_Logout_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "auth", "logout"}, ""))
pattern_Auth_GetUserInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "auth", "userinfo"}, "")) pattern_Auth_GetUserInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "auth", "userinfo"}, ""))
) )
var ( var (
forward_Auth_Login_0 = runtime.ForwardResponseMessage forward_Auth_Login_0 = runtime.ForwardResponseMessage
forward_Auth_Logout_0 = runtime.ForwardResponseMessage forward_Auth_Logout_0 = runtime.ForwardResponseMessage
forward_Auth_GetUserInfo_0 = runtime.ForwardResponseMessage forward_Auth_GetUserInfo_0 = runtime.ForwardResponseMessage
) )

View File

@@ -4770,6 +4770,306 @@ func (x *ReqRecordCatalog) GetType() string {
return "" return ""
} }
type AlarmInfo struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
ServerInfo string `protobuf:"bytes,2,opt,name=serverInfo,proto3" json:"serverInfo,omitempty"`
StreamName string `protobuf:"bytes,3,opt,name=streamName,proto3" json:"streamName,omitempty"`
StreamPath string `protobuf:"bytes,4,opt,name=streamPath,proto3" json:"streamPath,omitempty"`
AlarmDesc string `protobuf:"bytes,5,opt,name=alarmDesc,proto3" json:"alarmDesc,omitempty"`
AlarmType int32 `protobuf:"varint,6,opt,name=alarmType,proto3" json:"alarmType,omitempty"`
IsSent bool `protobuf:"varint,7,opt,name=isSent,proto3" json:"isSent,omitempty"`
FilePath string `protobuf:"bytes,8,opt,name=filePath,proto3" json:"filePath,omitempty"`
CreatedAt *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AlarmInfo) Reset() {
*x = AlarmInfo{}
mi := &file_global_proto_msgTypes[66]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AlarmInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AlarmInfo) ProtoMessage() {}
func (x *AlarmInfo) ProtoReflect() protoreflect.Message {
mi := &file_global_proto_msgTypes[66]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AlarmInfo.ProtoReflect.Descriptor instead.
func (*AlarmInfo) Descriptor() ([]byte, []int) {
return file_global_proto_rawDescGZIP(), []int{66}
}
func (x *AlarmInfo) GetId() uint32 {
if x != nil {
return x.Id
}
return 0
}
func (x *AlarmInfo) GetServerInfo() string {
if x != nil {
return x.ServerInfo
}
return ""
}
func (x *AlarmInfo) GetStreamName() string {
if x != nil {
return x.StreamName
}
return ""
}
func (x *AlarmInfo) GetStreamPath() string {
if x != nil {
return x.StreamPath
}
return ""
}
func (x *AlarmInfo) GetAlarmDesc() string {
if x != nil {
return x.AlarmDesc
}
return ""
}
func (x *AlarmInfo) GetAlarmType() int32 {
if x != nil {
return x.AlarmType
}
return 0
}
func (x *AlarmInfo) GetIsSent() bool {
if x != nil {
return x.IsSent
}
return false
}
func (x *AlarmInfo) GetFilePath() string {
if x != nil {
return x.FilePath
}
return ""
}
func (x *AlarmInfo) GetCreatedAt() *timestamppb.Timestamp {
if x != nil {
return x.CreatedAt
}
return nil
}
func (x *AlarmInfo) GetUpdatedAt() *timestamppb.Timestamp {
if x != nil {
return x.UpdatedAt
}
return nil
}
type AlarmListRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
PageNum int32 `protobuf:"varint,1,opt,name=pageNum,proto3" json:"pageNum,omitempty"`
PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize,omitempty"`
Range string `protobuf:"bytes,3,opt,name=range,proto3" json:"range,omitempty"`
Start string `protobuf:"bytes,4,opt,name=start,proto3" json:"start,omitempty"`
End string `protobuf:"bytes,5,opt,name=end,proto3" json:"end,omitempty"`
AlarmType int32 `protobuf:"varint,6,opt,name=alarmType,proto3" json:"alarmType,omitempty"`
StreamPath string `protobuf:"bytes,7,opt,name=streamPath,proto3" json:"streamPath,omitempty"`
StreamName string `protobuf:"bytes,8,opt,name=streamName,proto3" json:"streamName,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AlarmListRequest) Reset() {
*x = AlarmListRequest{}
mi := &file_global_proto_msgTypes[67]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AlarmListRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AlarmListRequest) ProtoMessage() {}
func (x *AlarmListRequest) ProtoReflect() protoreflect.Message {
mi := &file_global_proto_msgTypes[67]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AlarmListRequest.ProtoReflect.Descriptor instead.
func (*AlarmListRequest) Descriptor() ([]byte, []int) {
return file_global_proto_rawDescGZIP(), []int{67}
}
func (x *AlarmListRequest) GetPageNum() int32 {
if x != nil {
return x.PageNum
}
return 0
}
func (x *AlarmListRequest) GetPageSize() int32 {
if x != nil {
return x.PageSize
}
return 0
}
func (x *AlarmListRequest) GetRange() string {
if x != nil {
return x.Range
}
return ""
}
func (x *AlarmListRequest) GetStart() string {
if x != nil {
return x.Start
}
return ""
}
func (x *AlarmListRequest) GetEnd() string {
if x != nil {
return x.End
}
return ""
}
func (x *AlarmListRequest) GetAlarmType() int32 {
if x != nil {
return x.AlarmType
}
return 0
}
func (x *AlarmListRequest) GetStreamPath() string {
if x != nil {
return x.StreamPath
}
return ""
}
func (x *AlarmListRequest) GetStreamName() string {
if x != nil {
return x.StreamName
}
return ""
}
type AlarmListResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
Total int32 `protobuf:"varint,3,opt,name=total,proto3" json:"total,omitempty"`
PageNum int32 `protobuf:"varint,4,opt,name=pageNum,proto3" json:"pageNum,omitempty"`
PageSize int32 `protobuf:"varint,5,opt,name=pageSize,proto3" json:"pageSize,omitempty"`
Data []*AlarmInfo `protobuf:"bytes,6,rep,name=data,proto3" json:"data,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AlarmListResponse) Reset() {
*x = AlarmListResponse{}
mi := &file_global_proto_msgTypes[68]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AlarmListResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AlarmListResponse) ProtoMessage() {}
func (x *AlarmListResponse) ProtoReflect() protoreflect.Message {
mi := &file_global_proto_msgTypes[68]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AlarmListResponse.ProtoReflect.Descriptor instead.
func (*AlarmListResponse) Descriptor() ([]byte, []int) {
return file_global_proto_rawDescGZIP(), []int{68}
}
func (x *AlarmListResponse) GetCode() int32 {
if x != nil {
return x.Code
}
return 0
}
func (x *AlarmListResponse) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
func (x *AlarmListResponse) GetTotal() int32 {
if x != nil {
return x.Total
}
return 0
}
func (x *AlarmListResponse) GetPageNum() int32 {
if x != nil {
return x.PageNum
}
return 0
}
func (x *AlarmListResponse) GetPageSize() int32 {
if x != nil {
return x.PageSize
}
return 0
}
func (x *AlarmListResponse) GetData() []*AlarmInfo {
if x != nil {
return x.Data
}
return nil
}
var File_global_proto protoreflect.FileDescriptor var File_global_proto protoreflect.FileDescriptor
const file_global_proto_rawDesc = "" + const file_global_proto_rawDesc = "" +
@@ -5251,7 +5551,45 @@ const file_global_proto_rawDesc = "" +
"\amessage\x18\x02 \x01(\tR\amessage\x12&\n" + "\amessage\x18\x02 \x01(\tR\amessage\x12&\n" +
"\x04data\x18\x03 \x03(\v2\x12.global.RecordFileR\x04data\"&\n" + "\x04data\x18\x03 \x03(\v2\x12.global.RecordFileR\x04data\"&\n" +
"\x10ReqRecordCatalog\x12\x12\n" + "\x10ReqRecordCatalog\x12\x12\n" +
"\x04type\x18\x01 \x01(\tR\x04type2\xba\"\n" + "\x04type\x18\x01 \x01(\tR\x04type\"\xdf\x02\n" +
"\tAlarmInfo\x12\x0e\n" +
"\x02id\x18\x01 \x01(\rR\x02id\x12\x1e\n" +
"\n" +
"serverInfo\x18\x02 \x01(\tR\n" +
"serverInfo\x12\x1e\n" +
"\n" +
"streamName\x18\x03 \x01(\tR\n" +
"streamName\x12\x1e\n" +
"\n" +
"streamPath\x18\x04 \x01(\tR\n" +
"streamPath\x12\x1c\n" +
"\talarmDesc\x18\x05 \x01(\tR\talarmDesc\x12\x1c\n" +
"\talarmType\x18\x06 \x01(\x05R\talarmType\x12\x16\n" +
"\x06isSent\x18\a \x01(\bR\x06isSent\x12\x1a\n" +
"\bfilePath\x18\b \x01(\tR\bfilePath\x128\n" +
"\tcreatedAt\x18\t \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x128\n" +
"\tupdatedAt\x18\n" +
" \x01(\v2\x1a.google.protobuf.TimestampR\tupdatedAt\"\xe4\x01\n" +
"\x10AlarmListRequest\x12\x18\n" +
"\apageNum\x18\x01 \x01(\x05R\apageNum\x12\x1a\n" +
"\bpageSize\x18\x02 \x01(\x05R\bpageSize\x12\x14\n" +
"\x05range\x18\x03 \x01(\tR\x05range\x12\x14\n" +
"\x05start\x18\x04 \x01(\tR\x05start\x12\x10\n" +
"\x03end\x18\x05 \x01(\tR\x03end\x12\x1c\n" +
"\talarmType\x18\x06 \x01(\x05R\talarmType\x12\x1e\n" +
"\n" +
"streamPath\x18\a \x01(\tR\n" +
"streamPath\x12\x1e\n" +
"\n" +
"streamName\x18\b \x01(\tR\n" +
"streamName\"\xb4\x01\n" +
"\x11AlarmListResponse\x12\x12\n" +
"\x04code\x18\x01 \x01(\x05R\x04code\x12\x18\n" +
"\amessage\x18\x02 \x01(\tR\amessage\x12\x14\n" +
"\x05total\x18\x03 \x01(\x05R\x05total\x12\x18\n" +
"\apageNum\x18\x04 \x01(\x05R\apageNum\x12\x1a\n" +
"\bpageSize\x18\x05 \x01(\x05R\bpageSize\x12%\n" +
"\x04data\x18\x06 \x03(\v2\x11.global.AlarmInfoR\x04data2\x98#\n" +
"\x03api\x12P\n" + "\x03api\x12P\n" +
"\aSysInfo\x12\x16.google.protobuf.Empty\x1a\x17.global.SysInfoResponse\"\x14\x82\xd3\xe4\x93\x02\x0e\x12\f/api/sysinfo\x12i\n" + "\aSysInfo\x12\x16.google.protobuf.Empty\x1a\x17.global.SysInfoResponse\"\x14\x82\xd3\xe4\x93\x02\x0e\x12\f/api/sysinfo\x12i\n" +
"\x0fDisabledPlugins\x12\x16.google.protobuf.Empty\x1a\x1f.global.DisabledPluginsResponse\"\x1d\x82\xd3\xe4\x93\x02\x17\x12\x15/api/plugins/disabled\x12P\n" + "\x0fDisabledPlugins\x12\x16.google.protobuf.Empty\x1a\x1f.global.DisabledPluginsResponse\"\x1d\x82\xd3\xe4\x93\x02\x17\x12\x15/api/plugins/disabled\x12P\n" +
@@ -5297,7 +5635,8 @@ const file_global_proto_rawDesc = "" +
"\rGetRecordList\x12\x15.global.ReqRecordList\x1a\x1a.global.RecordResponseList\"/\x82\xd3\xe4\x93\x02)\x12'/api/record/{type}/list/{streamPath=**}\x12\x83\x01\n" + "\rGetRecordList\x12\x15.global.ReqRecordList\x1a\x1a.global.RecordResponseList\"/\x82\xd3\xe4\x93\x02)\x12'/api/record/{type}/list/{streamPath=**}\x12\x83\x01\n" +
"\x12GetEventRecordList\x12\x15.global.ReqRecordList\x1a\x1f.global.EventRecordResponseList\"5\x82\xd3\xe4\x93\x02/\x12-/api/record/{type}/event/list/{streamPath=**}\x12i\n" + "\x12GetEventRecordList\x12\x15.global.ReqRecordList\x1a\x1f.global.EventRecordResponseList\"5\x82\xd3\xe4\x93\x02/\x12-/api/record/{type}/event/list/{streamPath=**}\x12i\n" +
"\x10GetRecordCatalog\x12\x18.global.ReqRecordCatalog\x1a\x17.global.ResponseCatalog\"\"\x82\xd3\xe4\x93\x02\x1c\x12\x1a/api/record/{type}/catalog\x12u\n" + "\x10GetRecordCatalog\x12\x18.global.ReqRecordCatalog\x1a\x17.global.ResponseCatalog\"\"\x82\xd3\xe4\x93\x02\x1c\x12\x1a/api/record/{type}/catalog\x12u\n" +
"\fDeleteRecord\x12\x17.global.ReqRecordDelete\x1a\x16.global.ResponseDelete\"4\x82\xd3\xe4\x93\x02.:\x01*\")/api/record/{type}/delete/{streamPath=**}B\x10Z\x0em7s.live/v5/pbb\x06proto3" "\fDeleteRecord\x12\x17.global.ReqRecordDelete\x1a\x16.global.ResponseDelete\"4\x82\xd3\xe4\x93\x02.:\x01*\")/api/record/{type}/delete/{streamPath=**}\x12\\\n" +
"\fGetAlarmList\x12\x18.global.AlarmListRequest\x1a\x19.global.AlarmListResponse\"\x17\x82\xd3\xe4\x93\x02\x11\x12\x0f/api/alarm/listB\x10Z\x0em7s.live/v5/pbb\x06proto3"
var ( var (
file_global_proto_rawDescOnce sync.Once file_global_proto_rawDescOnce sync.Once
@@ -5311,7 +5650,7 @@ func file_global_proto_rawDescGZIP() []byte {
return file_global_proto_rawDescData return file_global_proto_rawDescData
} }
var file_global_proto_msgTypes = make([]protoimpl.MessageInfo, 73) var file_global_proto_msgTypes = make([]protoimpl.MessageInfo, 76)
var file_global_proto_goTypes = []any{ var file_global_proto_goTypes = []any{
(*DisabledPluginsResponse)(nil), // 0: global.DisabledPluginsResponse (*DisabledPluginsResponse)(nil), // 0: global.DisabledPluginsResponse
(*GetConfigRequest)(nil), // 1: global.GetConfigRequest (*GetConfigRequest)(nil), // 1: global.GetConfigRequest
@@ -5379,170 +5718,178 @@ var file_global_proto_goTypes = []any{
(*ReqRecordDelete)(nil), // 63: global.ReqRecordDelete (*ReqRecordDelete)(nil), // 63: global.ReqRecordDelete
(*ResponseDelete)(nil), // 64: global.ResponseDelete (*ResponseDelete)(nil), // 64: global.ResponseDelete
(*ReqRecordCatalog)(nil), // 65: global.ReqRecordCatalog (*ReqRecordCatalog)(nil), // 65: global.ReqRecordCatalog
nil, // 66: global.Formily.PropertiesEntry (*AlarmInfo)(nil), // 66: global.AlarmInfo
nil, // 67: global.Formily.ComponentPropsEntry (*AlarmListRequest)(nil), // 67: global.AlarmListRequest
nil, // 68: global.FormilyResponse.PropertiesEntry (*AlarmListResponse)(nil), // 68: global.AlarmListResponse
nil, // 69: global.PluginInfo.DescriptionEntry nil, // 69: global.Formily.PropertiesEntry
nil, // 70: global.TaskTreeData.DescriptionEntry nil, // 70: global.Formily.ComponentPropsEntry
nil, // 71: global.StreamWaitListResponse.ListEntry nil, // 71: global.FormilyResponse.PropertiesEntry
nil, // 72: global.TrackSnapShotData.ReaderEntry nil, // 72: global.PluginInfo.DescriptionEntry
(*timestamppb.Timestamp)(nil), // 73: google.protobuf.Timestamp nil, // 73: global.TaskTreeData.DescriptionEntry
(*durationpb.Duration)(nil), // 74: google.protobuf.Duration nil, // 74: global.StreamWaitListResponse.ListEntry
(*anypb.Any)(nil), // 75: google.protobuf.Any nil, // 75: global.TrackSnapShotData.ReaderEntry
(*emptypb.Empty)(nil), // 76: google.protobuf.Empty (*timestamppb.Timestamp)(nil), // 76: google.protobuf.Timestamp
(*durationpb.Duration)(nil), // 77: google.protobuf.Duration
(*anypb.Any)(nil), // 78: google.protobuf.Any
(*emptypb.Empty)(nil), // 79: google.protobuf.Empty
} }
var file_global_proto_depIdxs = []int32{ var file_global_proto_depIdxs = []int32{
12, // 0: global.DisabledPluginsResponse.data:type_name -> global.PluginInfo 12, // 0: global.DisabledPluginsResponse.data:type_name -> global.PluginInfo
66, // 1: global.Formily.properties:type_name -> global.Formily.PropertiesEntry 69, // 1: global.Formily.properties:type_name -> global.Formily.PropertiesEntry
67, // 2: global.Formily.componentProps:type_name -> global.Formily.ComponentPropsEntry 70, // 2: global.Formily.componentProps:type_name -> global.Formily.ComponentPropsEntry
68, // 3: global.FormilyResponse.properties:type_name -> global.FormilyResponse.PropertiesEntry 71, // 3: global.FormilyResponse.properties:type_name -> global.FormilyResponse.PropertiesEntry
4, // 4: global.GetConfigResponse.data:type_name -> global.ConfigData 4, // 4: global.GetConfigResponse.data:type_name -> global.ConfigData
10, // 5: global.SummaryResponse.memory:type_name -> global.Usage 10, // 5: global.SummaryResponse.memory:type_name -> global.Usage
10, // 6: global.SummaryResponse.hardDisk:type_name -> global.Usage 10, // 6: global.SummaryResponse.hardDisk:type_name -> global.Usage
9, // 7: global.SummaryResponse.netWork:type_name -> global.NetWorkInfo 9, // 7: global.SummaryResponse.netWork:type_name -> global.NetWorkInfo
69, // 8: global.PluginInfo.description:type_name -> global.PluginInfo.DescriptionEntry 72, // 8: global.PluginInfo.description:type_name -> global.PluginInfo.DescriptionEntry
73, // 9: global.SysInfoData.startTime:type_name -> google.protobuf.Timestamp 76, // 9: global.SysInfoData.startTime:type_name -> google.protobuf.Timestamp
12, // 10: global.SysInfoData.plugins:type_name -> global.PluginInfo 12, // 10: global.SysInfoData.plugins:type_name -> global.PluginInfo
13, // 11: global.SysInfoResponse.data:type_name -> global.SysInfoData 13, // 11: global.SysInfoResponse.data:type_name -> global.SysInfoData
73, // 12: global.TaskTreeData.startTime:type_name -> google.protobuf.Timestamp 76, // 12: global.TaskTreeData.startTime:type_name -> google.protobuf.Timestamp
70, // 13: global.TaskTreeData.description:type_name -> global.TaskTreeData.DescriptionEntry 73, // 13: global.TaskTreeData.description:type_name -> global.TaskTreeData.DescriptionEntry
15, // 14: global.TaskTreeData.children:type_name -> global.TaskTreeData 15, // 14: global.TaskTreeData.children:type_name -> global.TaskTreeData
15, // 15: global.TaskTreeData.blocked:type_name -> global.TaskTreeData 15, // 15: global.TaskTreeData.blocked:type_name -> global.TaskTreeData
15, // 16: global.TaskTreeResponse.data:type_name -> global.TaskTreeData 15, // 16: global.TaskTreeResponse.data:type_name -> global.TaskTreeData
22, // 17: global.StreamListResponse.data:type_name -> global.StreamInfo 22, // 17: global.StreamListResponse.data:type_name -> global.StreamInfo
71, // 18: global.StreamWaitListResponse.list:type_name -> global.StreamWaitListResponse.ListEntry 74, // 18: global.StreamWaitListResponse.list:type_name -> global.StreamWaitListResponse.ListEntry
22, // 19: global.StreamInfoResponse.data:type_name -> global.StreamInfo 22, // 19: global.StreamInfoResponse.data:type_name -> global.StreamInfo
28, // 20: global.StreamInfo.audioTrack:type_name -> global.AudioTrackInfo 28, // 20: global.StreamInfo.audioTrack:type_name -> global.AudioTrackInfo
31, // 21: global.StreamInfo.videoTrack:type_name -> global.VideoTrackInfo 31, // 21: global.StreamInfo.videoTrack:type_name -> global.VideoTrackInfo
73, // 22: global.StreamInfo.startTime:type_name -> google.protobuf.Timestamp 76, // 22: global.StreamInfo.startTime:type_name -> google.protobuf.Timestamp
74, // 23: global.StreamInfo.bufferTime:type_name -> google.protobuf.Duration 77, // 23: global.StreamInfo.bufferTime:type_name -> google.protobuf.Duration
23, // 24: global.StreamInfo.recording:type_name -> global.RecordingDetail 23, // 24: global.StreamInfo.recording:type_name -> global.RecordingDetail
74, // 25: global.RecordingDetail.fragment:type_name -> google.protobuf.Duration 77, // 25: global.RecordingDetail.fragment:type_name -> google.protobuf.Duration
73, // 26: global.TrackSnapShot.writeTime:type_name -> google.protobuf.Timestamp 76, // 26: global.TrackSnapShot.writeTime:type_name -> google.protobuf.Timestamp
24, // 27: global.TrackSnapShot.wrap:type_name -> global.Wrap 24, // 27: global.TrackSnapShot.wrap:type_name -> global.Wrap
26, // 28: global.MemoryBlockGroup.list:type_name -> global.MemoryBlock 26, // 28: global.MemoryBlockGroup.list:type_name -> global.MemoryBlock
25, // 29: global.TrackSnapShotData.ring:type_name -> global.TrackSnapShot 25, // 29: global.TrackSnapShotData.ring:type_name -> global.TrackSnapShot
72, // 30: global.TrackSnapShotData.reader:type_name -> global.TrackSnapShotData.ReaderEntry 75, // 30: global.TrackSnapShotData.reader:type_name -> global.TrackSnapShotData.ReaderEntry
27, // 31: global.TrackSnapShotData.memory:type_name -> global.MemoryBlockGroup 27, // 31: global.TrackSnapShotData.memory:type_name -> global.MemoryBlockGroup
29, // 32: global.TrackSnapShotResponse.data:type_name -> global.TrackSnapShotData 29, // 32: global.TrackSnapShotResponse.data:type_name -> global.TrackSnapShotData
73, // 33: global.SubscriberSnapShot.startTime:type_name -> google.protobuf.Timestamp 76, // 33: global.SubscriberSnapShot.startTime:type_name -> google.protobuf.Timestamp
37, // 34: global.SubscriberSnapShot.audioReader:type_name -> global.RingReaderSnapShot 37, // 34: global.SubscriberSnapShot.audioReader:type_name -> global.RingReaderSnapShot
37, // 35: global.SubscriberSnapShot.videoReader:type_name -> global.RingReaderSnapShot 37, // 35: global.SubscriberSnapShot.videoReader:type_name -> global.RingReaderSnapShot
74, // 36: global.SubscriberSnapShot.bufferTime:type_name -> google.protobuf.Duration 77, // 36: global.SubscriberSnapShot.bufferTime:type_name -> google.protobuf.Duration
38, // 37: global.SubscribersResponse.data:type_name -> global.SubscriberSnapShot 38, // 37: global.SubscribersResponse.data:type_name -> global.SubscriberSnapShot
41, // 38: global.PullProxyListResponse.data:type_name -> global.PullProxyInfo 41, // 38: global.PullProxyListResponse.data:type_name -> global.PullProxyInfo
73, // 39: global.PullProxyInfo.createTime:type_name -> google.protobuf.Timestamp 76, // 39: global.PullProxyInfo.createTime:type_name -> google.protobuf.Timestamp
73, // 40: global.PullProxyInfo.updateTime:type_name -> google.protobuf.Timestamp 76, // 40: global.PullProxyInfo.updateTime:type_name -> google.protobuf.Timestamp
74, // 41: global.PullProxyInfo.recordFragment:type_name -> google.protobuf.Duration 77, // 41: global.PullProxyInfo.recordFragment:type_name -> google.protobuf.Duration
73, // 42: global.PushProxyInfo.createTime:type_name -> google.protobuf.Timestamp 76, // 42: global.PushProxyInfo.createTime:type_name -> google.protobuf.Timestamp
73, // 43: global.PushProxyInfo.updateTime:type_name -> google.protobuf.Timestamp 76, // 43: global.PushProxyInfo.updateTime:type_name -> google.protobuf.Timestamp
42, // 44: global.PushProxyListResponse.data:type_name -> global.PushProxyInfo 42, // 44: global.PushProxyListResponse.data:type_name -> global.PushProxyInfo
45, // 45: global.StreamAliasListResponse.data:type_name -> global.StreamAlias 45, // 45: global.StreamAliasListResponse.data:type_name -> global.StreamAlias
73, // 46: global.Recording.startTime:type_name -> google.protobuf.Timestamp 76, // 46: global.Recording.startTime:type_name -> google.protobuf.Timestamp
49, // 47: global.RecordingListResponse.data:type_name -> global.Recording 49, // 47: global.RecordingListResponse.data:type_name -> global.Recording
73, // 48: global.PushInfo.startTime:type_name -> google.protobuf.Timestamp 76, // 48: global.PushInfo.startTime:type_name -> google.protobuf.Timestamp
51, // 49: global.PushListResponse.data:type_name -> global.PushInfo 51, // 49: global.PushListResponse.data:type_name -> global.PushInfo
54, // 50: global.TransformListResponse.data:type_name -> global.Transform 54, // 50: global.TransformListResponse.data:type_name -> global.Transform
73, // 51: global.RecordFile.startTime:type_name -> google.protobuf.Timestamp 76, // 51: global.RecordFile.startTime:type_name -> google.protobuf.Timestamp
73, // 52: global.RecordFile.endTime:type_name -> google.protobuf.Timestamp 76, // 52: global.RecordFile.endTime:type_name -> google.protobuf.Timestamp
73, // 53: global.EventRecordFile.startTime:type_name -> google.protobuf.Timestamp 76, // 53: global.EventRecordFile.startTime:type_name -> google.protobuf.Timestamp
73, // 54: global.EventRecordFile.endTime:type_name -> google.protobuf.Timestamp 76, // 54: global.EventRecordFile.endTime:type_name -> google.protobuf.Timestamp
57, // 55: global.RecordResponseList.data:type_name -> global.RecordFile 57, // 55: global.RecordResponseList.data:type_name -> global.RecordFile
58, // 56: global.EventRecordResponseList.data:type_name -> global.EventRecordFile 58, // 56: global.EventRecordResponseList.data:type_name -> global.EventRecordFile
73, // 57: global.Catalog.startTime:type_name -> google.protobuf.Timestamp 76, // 57: global.Catalog.startTime:type_name -> google.protobuf.Timestamp
73, // 58: global.Catalog.endTime:type_name -> google.protobuf.Timestamp 76, // 58: global.Catalog.endTime:type_name -> google.protobuf.Timestamp
61, // 59: global.ResponseCatalog.data:type_name -> global.Catalog 61, // 59: global.ResponseCatalog.data:type_name -> global.Catalog
57, // 60: global.ResponseDelete.data:type_name -> global.RecordFile 57, // 60: global.ResponseDelete.data:type_name -> global.RecordFile
2, // 61: global.Formily.PropertiesEntry.value:type_name -> global.Formily 76, // 61: global.AlarmInfo.createdAt:type_name -> google.protobuf.Timestamp
75, // 62: global.Formily.ComponentPropsEntry.value:type_name -> google.protobuf.Any 76, // 62: global.AlarmInfo.updatedAt:type_name -> google.protobuf.Timestamp
2, // 63: global.FormilyResponse.PropertiesEntry.value:type_name -> global.Formily 66, // 63: global.AlarmListResponse.data:type_name -> global.AlarmInfo
76, // 64: global.api.SysInfo:input_type -> google.protobuf.Empty 2, // 64: global.Formily.PropertiesEntry.value:type_name -> global.Formily
76, // 65: global.api.DisabledPlugins:input_type -> google.protobuf.Empty 78, // 65: global.Formily.ComponentPropsEntry.value:type_name -> google.protobuf.Any
76, // 66: global.api.Summary:input_type -> google.protobuf.Empty 2, // 66: global.FormilyResponse.PropertiesEntry.value:type_name -> global.Formily
33, // 67: global.api.Shutdown:input_type -> global.RequestWithId 79, // 67: global.api.SysInfo:input_type -> google.protobuf.Empty
33, // 68: global.api.Restart:input_type -> global.RequestWithId 79, // 68: global.api.DisabledPlugins:input_type -> google.protobuf.Empty
76, // 69: global.api.TaskTree:input_type -> google.protobuf.Empty 79, // 69: global.api.Summary:input_type -> google.protobuf.Empty
34, // 70: global.api.StopTask:input_type -> global.RequestWithId64 33, // 70: global.api.Shutdown:input_type -> global.RequestWithId
34, // 71: global.api.RestartTask:input_type -> global.RequestWithId64 33, // 71: global.api.Restart:input_type -> global.RequestWithId
17, // 72: global.api.StreamList:input_type -> global.StreamListRequest 79, // 72: global.api.TaskTree:input_type -> google.protobuf.Empty
76, // 73: global.api.WaitList:input_type -> google.protobuf.Empty 34, // 73: global.api.StopTask:input_type -> global.RequestWithId64
20, // 74: global.api.StreamInfo:input_type -> global.StreamSnapRequest 34, // 74: global.api.RestartTask:input_type -> global.RequestWithId64
20, // 75: global.api.PauseStream:input_type -> global.StreamSnapRequest 17, // 75: global.api.StreamList:input_type -> global.StreamListRequest
20, // 76: global.api.ResumeStream:input_type -> global.StreamSnapRequest 79, // 76: global.api.WaitList:input_type -> google.protobuf.Empty
47, // 77: global.api.SetStreamSpeed:input_type -> global.SetStreamSpeedRequest 20, // 77: global.api.StreamInfo:input_type -> global.StreamSnapRequest
48, // 78: global.api.SeekStream:input_type -> global.SeekStreamRequest 20, // 78: global.api.PauseStream:input_type -> global.StreamSnapRequest
36, // 79: global.api.GetSubscribers:input_type -> global.SubscribersRequest 20, // 79: global.api.ResumeStream:input_type -> global.StreamSnapRequest
20, // 80: global.api.AudioTrackSnap:input_type -> global.StreamSnapRequest 47, // 80: global.api.SetStreamSpeed:input_type -> global.SetStreamSpeedRequest
20, // 81: global.api.VideoTrackSnap:input_type -> global.StreamSnapRequest 48, // 81: global.api.SeekStream:input_type -> global.SeekStreamRequest
35, // 82: global.api.ChangeSubscribe:input_type -> global.ChangeSubscribeRequest 36, // 82: global.api.GetSubscribers:input_type -> global.SubscribersRequest
76, // 83: global.api.GetStreamAlias:input_type -> google.protobuf.Empty 20, // 83: global.api.AudioTrackSnap:input_type -> global.StreamSnapRequest
44, // 84: global.api.SetStreamAlias:input_type -> global.SetStreamAliasRequest 20, // 84: global.api.VideoTrackSnap:input_type -> global.StreamSnapRequest
20, // 85: global.api.StopPublish:input_type -> global.StreamSnapRequest 35, // 85: global.api.ChangeSubscribe:input_type -> global.ChangeSubscribeRequest
33, // 86: global.api.StopSubscribe:input_type -> global.RequestWithId 79, // 86: global.api.GetStreamAlias:input_type -> google.protobuf.Empty
76, // 87: global.api.GetConfigFile:input_type -> google.protobuf.Empty 44, // 87: global.api.SetStreamAlias:input_type -> global.SetStreamAliasRequest
7, // 88: global.api.UpdateConfigFile:input_type -> global.UpdateConfigFileRequest 20, // 88: global.api.StopPublish:input_type -> global.StreamSnapRequest
1, // 89: global.api.GetConfig:input_type -> global.GetConfigRequest 33, // 89: global.api.StopSubscribe:input_type -> global.RequestWithId
1, // 90: global.api.GetFormily:input_type -> global.GetConfigRequest 79, // 90: global.api.GetConfigFile:input_type -> google.protobuf.Empty
76, // 91: global.api.GetPullProxyList:input_type -> google.protobuf.Empty 7, // 91: global.api.UpdateConfigFile:input_type -> global.UpdateConfigFileRequest
41, // 92: global.api.AddPullProxy:input_type -> global.PullProxyInfo 1, // 92: global.api.GetConfig:input_type -> global.GetConfigRequest
33, // 93: global.api.RemovePullProxy:input_type -> global.RequestWithId 1, // 93: global.api.GetFormily:input_type -> global.GetConfigRequest
41, // 94: global.api.UpdatePullProxy:input_type -> global.PullProxyInfo 79, // 94: global.api.GetPullProxyList:input_type -> google.protobuf.Empty
76, // 95: global.api.GetPushProxyList:input_type -> google.protobuf.Empty 41, // 95: global.api.AddPullProxy:input_type -> global.PullProxyInfo
42, // 96: global.api.AddPushProxy:input_type -> global.PushProxyInfo 33, // 96: global.api.RemovePullProxy:input_type -> global.RequestWithId
33, // 97: global.api.RemovePushProxy:input_type -> global.RequestWithId 41, // 97: global.api.UpdatePullProxy:input_type -> global.PullProxyInfo
42, // 98: global.api.UpdatePushProxy:input_type -> global.PushProxyInfo 79, // 98: global.api.GetPushProxyList:input_type -> google.protobuf.Empty
76, // 99: global.api.GetRecording:input_type -> google.protobuf.Empty 42, // 99: global.api.AddPushProxy:input_type -> global.PushProxyInfo
76, // 100: global.api.GetTransformList:input_type -> google.protobuf.Empty 33, // 100: global.api.RemovePushProxy:input_type -> global.RequestWithId
56, // 101: global.api.GetRecordList:input_type -> global.ReqRecordList 42, // 101: global.api.UpdatePushProxy:input_type -> global.PushProxyInfo
56, // 102: global.api.GetEventRecordList:input_type -> global.ReqRecordList 79, // 102: global.api.GetRecording:input_type -> google.protobuf.Empty
65, // 103: global.api.GetRecordCatalog:input_type -> global.ReqRecordCatalog 79, // 103: global.api.GetTransformList:input_type -> google.protobuf.Empty
63, // 104: global.api.DeleteRecord:input_type -> global.ReqRecordDelete 56, // 104: global.api.GetRecordList:input_type -> global.ReqRecordList
14, // 105: global.api.SysInfo:output_type -> global.SysInfoResponse 56, // 105: global.api.GetEventRecordList:input_type -> global.ReqRecordList
0, // 106: global.api.DisabledPlugins:output_type -> global.DisabledPluginsResponse 65, // 106: global.api.GetRecordCatalog:input_type -> global.ReqRecordCatalog
11, // 107: global.api.Summary:output_type -> global.SummaryResponse 63, // 107: global.api.DeleteRecord:input_type -> global.ReqRecordDelete
32, // 108: global.api.Shutdown:output_type -> global.SuccessResponse 67, // 108: global.api.GetAlarmList:input_type -> global.AlarmListRequest
32, // 109: global.api.Restart:output_type -> global.SuccessResponse 14, // 109: global.api.SysInfo:output_type -> global.SysInfoResponse
16, // 110: global.api.TaskTree:output_type -> global.TaskTreeResponse 0, // 110: global.api.DisabledPlugins:output_type -> global.DisabledPluginsResponse
32, // 111: global.api.StopTask:output_type -> global.SuccessResponse 11, // 111: global.api.Summary:output_type -> global.SummaryResponse
32, // 112: global.api.RestartTask:output_type -> global.SuccessResponse 32, // 112: global.api.Shutdown:output_type -> global.SuccessResponse
18, // 113: global.api.StreamList:output_type -> global.StreamListResponse 32, // 113: global.api.Restart:output_type -> global.SuccessResponse
19, // 114: global.api.WaitList:output_type -> global.StreamWaitListResponse 16, // 114: global.api.TaskTree:output_type -> global.TaskTreeResponse
21, // 115: global.api.StreamInfo:output_type -> global.StreamInfoResponse 32, // 115: global.api.StopTask:output_type -> global.SuccessResponse
32, // 116: global.api.PauseStream:output_type -> global.SuccessResponse 32, // 116: global.api.RestartTask:output_type -> global.SuccessResponse
32, // 117: global.api.ResumeStream:output_type -> global.SuccessResponse 18, // 117: global.api.StreamList:output_type -> global.StreamListResponse
32, // 118: global.api.SetStreamSpeed:output_type -> global.SuccessResponse 19, // 118: global.api.WaitList:output_type -> global.StreamWaitListResponse
32, // 119: global.api.SeekStream:output_type -> global.SuccessResponse 21, // 119: global.api.StreamInfo:output_type -> global.StreamInfoResponse
39, // 120: global.api.GetSubscribers:output_type -> global.SubscribersResponse 32, // 120: global.api.PauseStream:output_type -> global.SuccessResponse
30, // 121: global.api.AudioTrackSnap:output_type -> global.TrackSnapShotResponse 32, // 121: global.api.ResumeStream:output_type -> global.SuccessResponse
30, // 122: global.api.VideoTrackSnap:output_type -> global.TrackSnapShotResponse 32, // 122: global.api.SetStreamSpeed:output_type -> global.SuccessResponse
32, // 123: global.api.ChangeSubscribe:output_type -> global.SuccessResponse 32, // 123: global.api.SeekStream:output_type -> global.SuccessResponse
46, // 124: global.api.GetStreamAlias:output_type -> global.StreamAliasListResponse 39, // 124: global.api.GetSubscribers:output_type -> global.SubscribersResponse
32, // 125: global.api.SetStreamAlias:output_type -> global.SuccessResponse 30, // 125: global.api.AudioTrackSnap:output_type -> global.TrackSnapShotResponse
32, // 126: global.api.StopPublish:output_type -> global.SuccessResponse 30, // 126: global.api.VideoTrackSnap:output_type -> global.TrackSnapShotResponse
32, // 127: global.api.StopSubscribe:output_type -> global.SuccessResponse 32, // 127: global.api.ChangeSubscribe:output_type -> global.SuccessResponse
5, // 128: global.api.GetConfigFile:output_type -> global.GetConfigFileResponse 46, // 128: global.api.GetStreamAlias:output_type -> global.StreamAliasListResponse
32, // 129: global.api.UpdateConfigFile:output_type -> global.SuccessResponse 32, // 129: global.api.SetStreamAlias:output_type -> global.SuccessResponse
6, // 130: global.api.GetConfig:output_type -> global.GetConfigResponse 32, // 130: global.api.StopPublish:output_type -> global.SuccessResponse
6, // 131: global.api.GetFormily:output_type -> global.GetConfigResponse 32, // 131: global.api.StopSubscribe:output_type -> global.SuccessResponse
40, // 132: global.api.GetPullProxyList:output_type -> global.PullProxyListResponse 5, // 132: global.api.GetConfigFile:output_type -> global.GetConfigFileResponse
32, // 133: global.api.AddPullProxy:output_type -> global.SuccessResponse 32, // 133: global.api.UpdateConfigFile:output_type -> global.SuccessResponse
32, // 134: global.api.RemovePullProxy:output_type -> global.SuccessResponse 6, // 134: global.api.GetConfig:output_type -> global.GetConfigResponse
32, // 135: global.api.UpdatePullProxy:output_type -> global.SuccessResponse 6, // 135: global.api.GetFormily:output_type -> global.GetConfigResponse
43, // 136: global.api.GetPushProxyList:output_type -> global.PushProxyListResponse 40, // 136: global.api.GetPullProxyList:output_type -> global.PullProxyListResponse
32, // 137: global.api.AddPushProxy:output_type -> global.SuccessResponse 32, // 137: global.api.AddPullProxy:output_type -> global.SuccessResponse
32, // 138: global.api.RemovePushProxy:output_type -> global.SuccessResponse 32, // 138: global.api.RemovePullProxy:output_type -> global.SuccessResponse
32, // 139: global.api.UpdatePushProxy:output_type -> global.SuccessResponse 32, // 139: global.api.UpdatePullProxy:output_type -> global.SuccessResponse
50, // 140: global.api.GetRecording:output_type -> global.RecordingListResponse 43, // 140: global.api.GetPushProxyList:output_type -> global.PushProxyListResponse
55, // 141: global.api.GetTransformList:output_type -> global.TransformListResponse 32, // 141: global.api.AddPushProxy:output_type -> global.SuccessResponse
59, // 142: global.api.GetRecordList:output_type -> global.RecordResponseList 32, // 142: global.api.RemovePushProxy:output_type -> global.SuccessResponse
60, // 143: global.api.GetEventRecordList:output_type -> global.EventRecordResponseList 32, // 143: global.api.UpdatePushProxy:output_type -> global.SuccessResponse
62, // 144: global.api.GetRecordCatalog:output_type -> global.ResponseCatalog 50, // 144: global.api.GetRecording:output_type -> global.RecordingListResponse
64, // 145: global.api.DeleteRecord:output_type -> global.ResponseDelete 55, // 145: global.api.GetTransformList:output_type -> global.TransformListResponse
105, // [105:146] is the sub-list for method output_type 59, // 146: global.api.GetRecordList:output_type -> global.RecordResponseList
64, // [64:105] is the sub-list for method input_type 60, // 147: global.api.GetEventRecordList:output_type -> global.EventRecordResponseList
64, // [64:64] is the sub-list for extension type_name 62, // 148: global.api.GetRecordCatalog:output_type -> global.ResponseCatalog
64, // [64:64] is the sub-list for extension extendee 64, // 149: global.api.DeleteRecord:output_type -> global.ResponseDelete
0, // [0:64] is the sub-list for field type_name 68, // 150: global.api.GetAlarmList:output_type -> global.AlarmListResponse
109, // [109:151] is the sub-list for method output_type
67, // [67:109] is the sub-list for method input_type
67, // [67:67] is the sub-list for extension type_name
67, // [67:67] is the sub-list for extension extendee
0, // [0:67] is the sub-list for field type_name
} }
func init() { file_global_proto_init() } func init() { file_global_proto_init() }
@@ -5556,7 +5903,7 @@ func file_global_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_global_proto_rawDesc), len(file_global_proto_rawDesc)), RawDescriptor: unsafe.Slice(unsafe.StringData(file_global_proto_rawDesc), len(file_global_proto_rawDesc)),
NumEnums: 0, NumEnums: 0,
NumMessages: 73, NumMessages: 76,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },

File diff suppressed because it is too large Load Diff

View File

@@ -245,6 +245,11 @@ service api {
body: "*" body: "*"
}; };
} }
rpc GetAlarmList (AlarmListRequest) returns (AlarmListResponse) {
option (google.api.http) = {
get: "/api/alarm/list"
};
}
} }
message DisabledPluginsResponse { message DisabledPluginsResponse {
@@ -742,3 +747,36 @@ message ResponseDelete {
message ReqRecordCatalog { message ReqRecordCatalog {
string type = 1; string type = 1;
} }
message AlarmInfo {
uint32 id = 1;
string serverInfo = 2;
string streamName = 3;
string streamPath = 4;
string alarmDesc = 5;
int32 alarmType = 6;
bool isSent = 7;
string filePath = 8;
google.protobuf.Timestamp createdAt = 9;
google.protobuf.Timestamp updatedAt = 10;
}
message AlarmListRequest {
int32 pageNum = 1;
int32 pageSize = 2;
string range = 3;
string start = 4;
string end = 5;
int32 alarmType = 6;
string streamPath = 7;
string streamName = 8;
}
message AlarmListResponse {
int32 code = 1;
string message = 2;
int32 total = 3;
int32 pageNum = 4;
int32 pageSize = 5;
repeated AlarmInfo data = 6;
}

View File

@@ -61,6 +61,7 @@ const (
Api_GetEventRecordList_FullMethodName = "/global.api/GetEventRecordList" Api_GetEventRecordList_FullMethodName = "/global.api/GetEventRecordList"
Api_GetRecordCatalog_FullMethodName = "/global.api/GetRecordCatalog" Api_GetRecordCatalog_FullMethodName = "/global.api/GetRecordCatalog"
Api_DeleteRecord_FullMethodName = "/global.api/DeleteRecord" Api_DeleteRecord_FullMethodName = "/global.api/DeleteRecord"
Api_GetAlarmList_FullMethodName = "/global.api/GetAlarmList"
) )
// ApiClient is the client API for Api service. // ApiClient is the client API for Api service.
@@ -108,6 +109,7 @@ type ApiClient interface {
GetEventRecordList(ctx context.Context, in *ReqRecordList, opts ...grpc.CallOption) (*EventRecordResponseList, error) GetEventRecordList(ctx context.Context, in *ReqRecordList, opts ...grpc.CallOption) (*EventRecordResponseList, error)
GetRecordCatalog(ctx context.Context, in *ReqRecordCatalog, opts ...grpc.CallOption) (*ResponseCatalog, error) GetRecordCatalog(ctx context.Context, in *ReqRecordCatalog, opts ...grpc.CallOption) (*ResponseCatalog, error)
DeleteRecord(ctx context.Context, in *ReqRecordDelete, opts ...grpc.CallOption) (*ResponseDelete, error) DeleteRecord(ctx context.Context, in *ReqRecordDelete, opts ...grpc.CallOption) (*ResponseDelete, error)
GetAlarmList(ctx context.Context, in *AlarmListRequest, opts ...grpc.CallOption) (*AlarmListResponse, error)
} }
type apiClient struct { type apiClient struct {
@@ -528,6 +530,16 @@ func (c *apiClient) DeleteRecord(ctx context.Context, in *ReqRecordDelete, opts
return out, nil return out, nil
} }
func (c *apiClient) GetAlarmList(ctx context.Context, in *AlarmListRequest, opts ...grpc.CallOption) (*AlarmListResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AlarmListResponse)
err := c.cc.Invoke(ctx, Api_GetAlarmList_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// ApiServer is the server API for Api service. // ApiServer is the server API for Api service.
// All implementations must embed UnimplementedApiServer // All implementations must embed UnimplementedApiServer
// for forward compatibility. // for forward compatibility.
@@ -573,6 +585,7 @@ type ApiServer interface {
GetEventRecordList(context.Context, *ReqRecordList) (*EventRecordResponseList, error) GetEventRecordList(context.Context, *ReqRecordList) (*EventRecordResponseList, error)
GetRecordCatalog(context.Context, *ReqRecordCatalog) (*ResponseCatalog, error) GetRecordCatalog(context.Context, *ReqRecordCatalog) (*ResponseCatalog, error)
DeleteRecord(context.Context, *ReqRecordDelete) (*ResponseDelete, error) DeleteRecord(context.Context, *ReqRecordDelete) (*ResponseDelete, error)
GetAlarmList(context.Context, *AlarmListRequest) (*AlarmListResponse, error)
mustEmbedUnimplementedApiServer() mustEmbedUnimplementedApiServer()
} }
@@ -706,6 +719,9 @@ func (UnimplementedApiServer) GetRecordCatalog(context.Context, *ReqRecordCatalo
func (UnimplementedApiServer) DeleteRecord(context.Context, *ReqRecordDelete) (*ResponseDelete, error) { func (UnimplementedApiServer) DeleteRecord(context.Context, *ReqRecordDelete) (*ResponseDelete, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteRecord not implemented") return nil, status.Errorf(codes.Unimplemented, "method DeleteRecord not implemented")
} }
func (UnimplementedApiServer) GetAlarmList(context.Context, *AlarmListRequest) (*AlarmListResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetAlarmList not implemented")
}
func (UnimplementedApiServer) mustEmbedUnimplementedApiServer() {} func (UnimplementedApiServer) mustEmbedUnimplementedApiServer() {}
func (UnimplementedApiServer) testEmbeddedByValue() {} func (UnimplementedApiServer) testEmbeddedByValue() {}
@@ -1465,6 +1481,24 @@ func _Api_DeleteRecord_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Api_GetAlarmList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AlarmListRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ApiServer).GetAlarmList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Api_GetAlarmList_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ApiServer).GetAlarmList(ctx, req.(*AlarmListRequest))
}
return interceptor(ctx, in, info, handler)
}
// Api_ServiceDesc is the grpc.ServiceDesc for Api service. // Api_ServiceDesc is the grpc.ServiceDesc for Api service.
// It's only intended for direct use with grpc.RegisterService, // It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy) // and not to be introspected or modified (even as a copy)
@@ -1636,6 +1670,10 @@ var Api_ServiceDesc = grpc.ServiceDesc{
MethodName: "DeleteRecord", MethodName: "DeleteRecord",
Handler: _Api_DeleteRecord_Handler, Handler: _Api_DeleteRecord_Handler,
}, },
{
MethodName: "GetAlarmList",
Handler: _Api_GetAlarmList_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "global.proto", Metadata: "global.proto",

View File

@@ -44,6 +44,15 @@ const (
AlarmPullRecover = 0x10013 // 拉流恢复 AlarmPullRecover = 0x10013 // 拉流恢复
AlarmDiskSpaceFull = 0x10014 // 磁盘空间满,磁盘占有率,超出最大磁盘空间使用率,触发报警。 AlarmDiskSpaceFull = 0x10014 // 磁盘空间满,磁盘占有率,超出最大磁盘空间使用率,触发报警。
AlarmStartupRunning = 0x10015 // 启动运行 AlarmStartupRunning = 0x10015 // 启动运行
AlarmPublishOffline = 0x10016 // 发布者异常,触发一次报警。
AlarmPublishRecover = 0x10017 // 发布者恢复
AlarmSubscribeOffline = 0x10018 // 订阅者异常,触发一次报警。
AlarmSubscribeRecover = 0x10019 // 订阅者恢复
AlarmPushOffline = 0x10020 // 推流异常,触发一次报警。
AlarmPushRecover = 0x10021 // 推流恢复
AlarmTransformOffline = 0x10022 // 转换异常,触发一次报警。
AlarmTransformRecover = 0x10023 // 转换恢复
AlarmKeepAliveOnline = 0x10024 // 保活正常,触发一次报警。
) )
type ( type (

134
plugin.go
View File

@@ -7,6 +7,7 @@ import (
"encoding/hex" "encoding/hex"
"encoding/json" "encoding/json"
"fmt" "fmt"
"gopkg.in/yaml.v3"
"net" "net"
"net/http" "net/http"
"net/url" "net/url"
@@ -25,7 +26,6 @@ import (
gatewayRuntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" gatewayRuntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
myip "github.com/husanpao/ip" myip "github.com/husanpao/ip"
"google.golang.org/grpc" "google.golang.org/grpc"
"gopkg.in/yaml.v3"
"gorm.io/gorm" "gorm.io/gorm"
. "m7s.live/v5/pkg" . "m7s.live/v5/pkg"
@@ -395,16 +395,8 @@ func (t *WebHookTask) Start() error {
return task.ErrTaskComplete return task.ErrTaskComplete
} }
// 将t.data转换为AlarmInfo格式的JSON // 处理AlarmInfo数据
var alarmInfo AlarmInfo
if t.data != nil { if t.data != nil {
// 先转成JSON再转成AlarmInfo结构体
jsonData, err := json.Marshal(t.data)
if err != nil {
return fmt.Errorf("marshal data to json: %w", err)
}
// 获取主机名和IP地址 // 获取主机名和IP地址
hostname, err := os.Hostname() hostname, err := os.Hostname()
if err != nil { if err != nil {
@@ -428,26 +420,32 @@ func (t *WebHookTask) Start() error {
ipAddr = "unknown" ipAddr = "unknown"
} }
// 将jsonData反序列化为map添加ServerInfo字段然后重新序列化 // 直接使用t.data作为AlarmInfo
var dataMap map[string]interface{} alarmInfo, ok := t.data.(AlarmInfo)
if err := json.Unmarshal(jsonData, &dataMap); err == nil { if !ok {
dataMap["server_info"] = fmt.Sprintf("%s (%s)", hostname, ipAddr) return fmt.Errorf("data is not of type AlarmInfo")
// 添加ISO格式的createAt字段
dataMap["createAt"] = time.Now().UTC().Format(time.RFC3339)
if newJsonData, err := json.Marshal(dataMap); err == nil {
jsonData = newJsonData
} }
// 更新服务器信息
if alarmInfo.ServerInfo == "" {
alarmInfo.ServerInfo = fmt.Sprintf("%s (%s)", hostname, ipAddr)
}
// 确保时间戳已设置
if alarmInfo.CreatedAt.IsZero() {
alarmInfo.CreatedAt = time.Now()
}
if alarmInfo.UpdatedAt.IsZero() {
alarmInfo.UpdatedAt = time.Now()
}
// 将AlarmInfo序列化为JSON
jsonData, err := json.Marshal(alarmInfo)
if err != nil {
return fmt.Errorf("marshal AlarmInfo to json: %w", err)
} }
t.jsonData = jsonData t.jsonData = jsonData
err = json.Unmarshal(jsonData, &alarmInfo)
if err != nil {
return fmt.Errorf("unmarshal json to AlarmInfo: %w", err)
}
alarmInfo.CreatedAt = time.Now()
alarmInfo.UpdatedAt = time.Now()
t.alarm = alarmInfo t.alarm = alarmInfo
} }
@@ -635,27 +633,22 @@ func (p *Plugin) PublishWithConfig(ctx context.Context, streamPath string, conf
if err == nil { if err == nil {
if sender, webhook := p.getHookSender(config.HookOnPublishEnd); sender != nil { if sender, webhook := p.getHookSender(config.HookOnPublishEnd); sender != nil {
publisher.OnDispose(func() { publisher.OnDispose(func() {
webhookData := map[string]interface{}{ alarmInfo := AlarmInfo{
"alarmType": config.AlarmPullOffline, AlarmName: string(config.HookOnPublishEnd),
"streamPath": publisher.StreamPath, AlarmDesc: publisher.StopReason().Error(),
"publishId": publisher.ID, AlarmType: config.AlarmPublishOffline,
"alarmDesc": publisher.StopReason().Error(), StreamPath: publisher.StreamPath,
} }
sender(webhook, webhookData) sender(webhook, alarmInfo)
}) })
} }
if sender, webhook := p.getHookSender(config.HookOnPublishStart); sender != nil { if sender, webhook := p.getHookSender(config.HookOnPublishStart); sender != nil {
webhookData := map[string]interface{}{ alarmInfo := AlarmInfo{
"alarmType": config.AlarmPullRecover, AlarmName: string(config.HookOnPublishStart),
"alarmDesc": config.HookOnPublishStart, AlarmType: config.AlarmPublishRecover,
"streamPath": publisher.StreamPath, StreamPath: publisher.StreamPath,
"args": publisher.Args,
"publishId": publisher.ID,
"remoteAddr": publisher.RemoteAddr,
"type": publisher.Type,
"pluginName": p.Meta.Name,
} }
sender(webhook, webhookData) sender(webhook, alarmInfo)
} }
} }
return return
@@ -698,31 +691,22 @@ func (p *Plugin) SubscribeWithConfig(ctx context.Context, streamPath string, con
if err == nil { if err == nil {
if sender, webhook := p.getHookSender(config.HookOnSubscribeEnd); sender != nil { if sender, webhook := p.getHookSender(config.HookOnSubscribeEnd); sender != nil {
subscriber.OnDispose(func() { subscriber.OnDispose(func() {
webhookData := map[string]interface{}{ alarmInfo := AlarmInfo{
"event": config.HookOnSubscribeEnd, AlarmName: string(config.HookOnSubscribeEnd),
"streamPath": subscriber.StreamPath, AlarmDesc: subscriber.StopReason().Error(),
"subscriberId": subscriber.ID, AlarmType: config.AlarmSubscribeOffline,
"reason": subscriber.StopReason().Error(), StreamPath: subscriber.StreamPath,
"timestamp": time.Now().Unix(),
} }
if subscriber.Publisher != nil { sender(webhook, alarmInfo)
webhookData["publishId"] = subscriber.Publisher.ID
}
sender(webhook, webhookData)
}) })
} }
if sender, webhook := p.getHookSender(config.HookOnSubscribeStart); sender != nil { if sender, webhook := p.getHookSender(config.HookOnSubscribeStart); sender != nil {
webhookData := map[string]interface{}{ alarmInfo := AlarmInfo{
"event": config.HookOnSubscribeStart, AlarmName: string(config.HookOnSubscribeStart),
"streamPath": subscriber.StreamPath, AlarmType: config.AlarmSubscribeRecover,
"publishId": subscriber.Publisher.ID, StreamPath: subscriber.StreamPath,
"subscriberId": subscriber.ID,
"remoteAddr": subscriber.RemoteAddr,
"type": subscriber.Type,
"args": subscriber.Args,
"timestamp": time.Now().Unix(),
} }
sender(webhook, webhookData) sender(webhook, alarmInfo)
} }
} }
return return
@@ -870,15 +854,21 @@ func (t *ServerKeepAliveTask) Tick(now any) {
if sender == nil { if sender == nil {
return return
} }
s := t.plugin.Server //s := t.plugin.Server
webhookData := map[string]interface{}{ alarmInfo := AlarmInfo{
"event": config.HookOnServerKeepAlive, AlarmName: string(config.HookOnServerKeepAlive),
"timestamp": time.Now().Unix(), AlarmType: config.AlarmKeepAliveOnline,
"streams": s.Streams.Length, StreamPath: "",
"subscribers": s.Subscribers.Length,
"publisherCount": s.Streams.Length,
"subscriberCount": s.Subscribers.Length,
"uptime": time.Since(s.StartTime).Seconds(),
} }
sender(webhook, webhookData) sender(webhook, alarmInfo)
//webhookData := map[string]interface{}{
// "event": config.HookOnServerKeepAlive,
// "timestamp": time.Now().Unix(),
// "streams": s.Streams.Length,
// "subscribers": s.Subscribers.Length,
// "publisherCount": s.Streams.Length,
// "subscriberCount": s.Subscribers.Length,
// "uptime": time.Since(s.StartTime).Seconds(),
//}
//sender(webhook, webhookData)
} }

View File

@@ -123,31 +123,24 @@ func (p *PullJob) Init(puller IPuller, plugin *Plugin, streamPath string, conf c
if sender, webhook := plugin.getHookSender(config.HookOnPullStart); sender != nil { if sender, webhook := plugin.getHookSender(config.HookOnPullStart); sender != nil {
puller.OnStart(func() { puller.OnStart(func() {
webhookData := map[string]interface{}{ alarmInfo := AlarmInfo{
"alarmDesc": config.HookOnPullStart, AlarmName: string(config.HookOnPullStart),
"event": config.HookOnPullStart, StreamPath: streamPath,
"streamPath": streamPath, AlarmType: config.AlarmPullRecover,
"url": conf.URL,
"args": conf.Args,
"pluginName": plugin.Meta.Name,
"timestamp": time.Now().Unix(),
"alarmType": config.AlarmPullRecover,
} }
sender(webhook, webhookData) sender(webhook, alarmInfo)
}) })
} }
if sender, webhook := plugin.getHookSender(config.HookOnPullEnd); sender != nil { if sender, webhook := plugin.getHookSender(config.HookOnPullEnd); sender != nil {
puller.OnDispose(func() { puller.OnDispose(func() {
webhookData := map[string]interface{}{ alarmInfo := AlarmInfo{
"alarmDesc": puller.StopReason().Error(), AlarmName: string(config.HookOnPullEnd),
"event": config.HookOnPullEnd, AlarmDesc: puller.StopReason().Error(),
"streamPath": streamPath, StreamPath: streamPath,
"reason": puller.StopReason().Error(), AlarmType: config.AlarmPullOffline,
"timestamp": time.Now().Unix(),
"alarmType": config.AlarmPullOffline,
} }
sender(webhook, webhookData) sender(webhook, alarmInfo)
}) })
} }

View File

@@ -1,8 +1,6 @@
package m7s package m7s
import ( import (
"time"
"m7s.live/v5/pkg" "m7s.live/v5/pkg"
"m7s.live/v5/pkg/task" "m7s.live/v5/pkg/task"
@@ -45,26 +43,25 @@ func (p *PushJob) Init(pusher IPusher, plugin *Plugin, streamPath string, conf c
pusher.SetRetry(conf.MaxRetry, conf.RetryInterval) pusher.SetRetry(conf.MaxRetry, conf.RetryInterval)
if sender, webhook := plugin.getHookSender(config.HookOnPushStart); sender != nil { if sender, webhook := plugin.getHookSender(config.HookOnPushStart); sender != nil {
pusher.OnStart(func() { pusher.OnStart(func() {
webhookData := map[string]interface{}{ alarmInfo := AlarmInfo{
"event": config.HookOnPushStart, AlarmName: string(config.HookOnPushStart),
"streamPath": streamPath, AlarmDesc: "start push",
"url": conf.URL, AlarmType: config.AlarmPushRecover,
"pluginName": plugin.Meta.Name, StreamPath: streamPath,
"timestamp": time.Now().Unix(),
} }
sender(webhook, webhookData) sender(webhook, alarmInfo)
}) })
} }
if sender, webhook := plugin.getHookSender(config.HookOnPushEnd); sender != nil { if sender, webhook := plugin.getHookSender(config.HookOnPushEnd); sender != nil {
pusher.OnDispose(func() { pusher.OnDispose(func() {
webhookData := map[string]interface{}{ alarmInfo := AlarmInfo{
"event": config.HookOnPullEnd, AlarmName: string(config.HookOnPushEnd),
"streamPath": streamPath, AlarmDesc: pusher.StopReason().Error(),
"reason": pusher.StopReason().Error(), AlarmType: config.AlarmPushOffline,
"timestamp": time.Now().Unix(), StreamPath: streamPath,
} }
sender(webhook, webhookData) sender(webhook, alarmInfo)
}) })
} }
plugin.Server.Pushs.Add(p, plugin.Logger.With("pushURL", conf.URL, "streamPath", streamPath)) plugin.Server.Pushs.Add(p, plugin.Logger.With("pushURL", conf.URL, "streamPath", streamPath))

View File

@@ -142,27 +142,26 @@ func (p *RecordJob) Init(recorder IRecorder, plugin *Plugin, streamPath string,
recorder.SetRetry(-1, time.Second) recorder.SetRetry(-1, time.Second)
if sender, webhook := plugin.getHookSender(config.HookOnRecordStart); sender != nil { if sender, webhook := plugin.getHookSender(config.HookOnRecordStart); sender != nil {
recorder.OnStart(func() { recorder.OnStart(func() {
webhookData := map[string]interface{}{ alarmInfo := AlarmInfo{
"event": config.HookOnRecordStart, AlarmName: string(config.HookOnRecordStart),
"streamPath": streamPath, AlarmType: config.AlarmStorageExceptionRecover,
"filePath": conf.FilePath, StreamPath: streamPath,
"pluginName": plugin.Meta.Name, FilePath: conf.FilePath,
"timestamp": time.Now().Unix(),
} }
sender(webhook, webhookData) sender(webhook, alarmInfo)
}) })
} }
if sender, webhook := plugin.getHookSender(config.HookOnRecordEnd); sender != nil { if sender, webhook := plugin.getHookSender(config.HookOnRecordEnd); sender != nil {
recorder.OnDispose(func() { recorder.OnDispose(func() {
webhookData := map[string]interface{}{ alarmInfo := AlarmInfo{
"event": config.HookOnRecordEnd, AlarmType: config.AlarmStorageException,
"streamPath": streamPath, AlarmDesc: recorder.StopReason().Error(),
"filePath": conf.FilePath, AlarmName: string(config.HookOnRecordEnd),
"reason": recorder.StopReason().Error(), StreamPath: streamPath,
"timestamp": time.Now().Unix(), FilePath: conf.FilePath,
} }
sender(webhook, webhookData) sender(webhook, alarmInfo)
}) })
} }

View File

@@ -439,12 +439,11 @@ func (s *Server) Start() (err error) {
return nil return nil
}, "serverStart") }, "serverStart")
if sender, webhook := s.getHookSender(config.HookOnSystemStart); sender != nil { if sender, webhook := s.getHookSender(config.HookOnSystemStart); sender != nil {
webhookData := map[string]interface{}{ alarmInfo := AlarmInfo{
"alarmDesc": config.HookOnSystemStart, AlarmName: string(config.HookOnSystemStart),
"streamPath": "", AlarmType: config.AlarmStartupRunning,
"alarmType": config.AlarmStartupRunning,
} }
sender(webhook, webhookData) sender(webhook, alarmInfo)
} }
return return
} }

View File

@@ -107,24 +107,23 @@ func (p *TransformJob) Init(transformer ITransformer, plugin *Plugin, pub *Publi
transformer.SetRetry(-1, time.Second*2) transformer.SetRetry(-1, time.Second*2)
if sender, webhook := plugin.getHookSender(config.HookOnTransformStart); sender != nil { if sender, webhook := plugin.getHookSender(config.HookOnTransformStart); sender != nil {
transformer.OnStart(func() { transformer.OnStart(func() {
webhookData := map[string]interface{}{ alarmInfo := AlarmInfo{
"event": config.HookOnTransformStart, AlarmName: string(config.HookOnTransformStart),
"streamPath": pub.StreamPath, AlarmType: config.AlarmTransformRecover,
"pluginName": plugin.Meta.Name, StreamPath: pub.StreamPath,
"timestamp": time.Now().Unix(),
} }
sender(webhook, webhookData) sender(webhook, alarmInfo)
}) })
} }
if sender, webhook := plugin.getHookSender(config.HookOnTransformEnd); sender != nil { if sender, webhook := plugin.getHookSender(config.HookOnTransformEnd); sender != nil {
transformer.OnDispose(func() { transformer.OnDispose(func() {
webhookData := map[string]interface{}{ alarmInfo := AlarmInfo{
"event": config.HookOnTransformEnd, AlarmName: string(config.HookOnTransformEnd),
"streamPath": pub.StreamPath, AlarmType: config.AlarmTransformOffline,
"reason": transformer.StopReason().Error(), StreamPath: pub.StreamPath,
"timestamp": time.Now().Unix(), AlarmDesc: transformer.StopReason().Error(),
} }
sender(webhook, webhookData) sender(webhook, alarmInfo)
}) })
} }
plugin.Server.Transforms.AddTask(p, plugin.Logger.With("streamPath", pub.StreamPath)) plugin.Server.Transforms.AddTask(p, plugin.Logger.With("streamPath", pub.StreamPath))