mirror of
https://github.com/langhuihui/monibuca.git
synced 2025-09-27 01:15:52 +08:00
feat: update pull or push proxy with optional args
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc v5.29.3
|
||||
// protoc v6.31.1
|
||||
// source: auth.proto
|
||||
|
||||
package pb
|
||||
|
@@ -43,6 +43,9 @@ func request_Auth_Login_0(ctx context.Context, marshaler runtime.Marshaler, clie
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.Login(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -67,6 +70,9 @@ func request_Auth_Logout_0(ctx context.Context, marshaler runtime.Marshaler, cli
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.Logout(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -90,7 +96,9 @@ func request_Auth_GetUserInfo_0(ctx context.Context, marshaler runtime.Marshaler
|
||||
protoReq UserInfoRequest
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v5.29.3
|
||||
// - protoc v6.31.1
|
||||
// source: auth.proto
|
||||
|
||||
package pb
|
||||
|
842
pb/global.pb.go
842
pb/global.pb.go
File diff suppressed because it is too large
Load Diff
@@ -41,7 +41,9 @@ func request_Api_SysInfo_0(ctx context.Context, marshaler runtime.Marshaler, cli
|
||||
protoReq emptypb.Empty
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.SysInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -60,7 +62,9 @@ func request_Api_DisabledPlugins_0(ctx context.Context, marshaler runtime.Marsha
|
||||
protoReq emptypb.Empty
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.DisabledPlugins(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -79,7 +83,9 @@ func request_Api_Summary_0(ctx context.Context, marshaler runtime.Marshaler, cli
|
||||
protoReq emptypb.Empty
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.Summary(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -100,7 +106,9 @@ func request_Api_Shutdown_0(ctx context.Context, marshaler runtime.Marshaler, cl
|
||||
protoReq RequestWithId
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
@@ -133,7 +141,9 @@ func request_Api_Restart_0(ctx context.Context, marshaler runtime.Marshaler, cli
|
||||
protoReq RequestWithId
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
@@ -164,7 +174,9 @@ func request_Api_TaskTree_0(ctx context.Context, marshaler runtime.Marshaler, cl
|
||||
protoReq emptypb.Empty
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.TaskTree(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -184,7 +196,9 @@ func request_Api_StopTask_0(ctx context.Context, marshaler runtime.Marshaler, cl
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
@@ -221,7 +235,9 @@ func request_Api_RestartTask_0(ctx context.Context, marshaler runtime.Marshaler,
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
@@ -259,7 +275,9 @@ func request_Api_StreamList_0(ctx context.Context, marshaler runtime.Marshaler,
|
||||
protoReq StreamListRequest
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
@@ -290,7 +308,9 @@ func request_Api_WaitList_0(ctx context.Context, marshaler runtime.Marshaler, cl
|
||||
protoReq emptypb.Empty
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.WaitList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -310,7 +330,9 @@ func request_Api_StreamInfo_0(ctx context.Context, marshaler runtime.Marshaler,
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["streamPath"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "streamPath")
|
||||
@@ -350,6 +372,9 @@ func request_Api_PauseStream_0(ctx context.Context, marshaler runtime.Marshaler,
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["streamPath"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "streamPath")
|
||||
@@ -392,6 +417,9 @@ func request_Api_ResumeStream_0(ctx context.Context, marshaler runtime.Marshaler
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["streamPath"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "streamPath")
|
||||
@@ -434,6 +462,9 @@ func request_Api_SetStreamSpeed_0(ctx context.Context, marshaler runtime.Marshal
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["streamPath"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "streamPath")
|
||||
@@ -476,6 +507,9 @@ func request_Api_SeekStream_0(ctx context.Context, marshaler runtime.Marshaler,
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["streamPath"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "streamPath")
|
||||
@@ -517,7 +551,9 @@ func request_Api_GetSubscribers_0(ctx context.Context, marshaler runtime.Marshal
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["streamPath"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "streamPath")
|
||||
@@ -566,7 +602,9 @@ func request_Api_AudioTrackSnap_0(ctx context.Context, marshaler runtime.Marshal
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["streamPath"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "streamPath")
|
||||
@@ -603,7 +641,9 @@ func request_Api_VideoTrackSnap_0(ctx context.Context, marshaler runtime.Marshal
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["streamPath"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "streamPath")
|
||||
@@ -643,6 +683,9 @@ func request_Api_ChangeSubscribe_0(ctx context.Context, marshaler runtime.Marsha
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
@@ -697,7 +740,9 @@ func request_Api_GetStreamAlias_0(ctx context.Context, marshaler runtime.Marshal
|
||||
protoReq emptypb.Empty
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.GetStreamAlias(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -719,6 +764,9 @@ func request_Api_SetStreamAlias_0(ctx context.Context, marshaler runtime.Marshal
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.SetStreamAlias(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -744,6 +792,9 @@ func request_Api_StopPublish_0(ctx context.Context, marshaler runtime.Marshaler,
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["streamPath"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "streamPath")
|
||||
@@ -786,6 +837,9 @@ func request_Api_StopSubscribe_0(ctx context.Context, marshaler runtime.Marshale
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
@@ -824,7 +878,9 @@ func request_Api_GetConfigFile_0(ctx context.Context, marshaler runtime.Marshale
|
||||
protoReq emptypb.Empty
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.GetConfigFile(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -846,6 +902,9 @@ func request_Api_UpdateConfigFile_0(ctx context.Context, marshaler runtime.Marsh
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Content); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.UpdateConfigFile(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -868,7 +927,9 @@ func request_Api_GetConfig_0(ctx context.Context, marshaler runtime.Marshaler, c
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["name"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
|
||||
@@ -905,7 +966,9 @@ func request_Api_GetFormily_0(ctx context.Context, marshaler runtime.Marshaler,
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["name"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
|
||||
@@ -941,7 +1004,9 @@ func request_Api_GetPullProxyList_0(ctx context.Context, marshaler runtime.Marsh
|
||||
protoReq emptypb.Empty
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.GetPullProxyList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -960,7 +1025,9 @@ func request_Api_GetPullProxyList_1(ctx context.Context, marshaler runtime.Marsh
|
||||
protoReq emptypb.Empty
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.GetPullProxyList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -982,6 +1049,9 @@ func request_Api_AddPullProxy_0(ctx context.Context, marshaler runtime.Marshaler
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.AddPullProxy(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -1006,6 +1076,9 @@ func request_Api_AddPullProxy_1(ctx context.Context, marshaler runtime.Marshaler
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.AddPullProxy(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -1031,6 +1104,9 @@ func request_Api_RemovePullProxy_0(ctx context.Context, marshaler runtime.Marsha
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
@@ -1073,6 +1149,9 @@ func request_Api_RemovePullProxy_1(ctx context.Context, marshaler runtime.Marsha
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
@@ -1108,19 +1187,22 @@ func local_request_Api_RemovePullProxy_1(ctx context.Context, marshaler runtime.
|
||||
|
||||
func request_Api_UpdatePullProxy_0(ctx context.Context, marshaler runtime.Marshaler, client ApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq PullProxyInfo
|
||||
protoReq UpdatePullProxyRequest
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.UpdatePullProxy(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_Api_UpdatePullProxy_0(ctx context.Context, marshaler runtime.Marshaler, server ApiServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq PullProxyInfo
|
||||
protoReq UpdatePullProxyRequest
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
@@ -1132,19 +1214,22 @@ func local_request_Api_UpdatePullProxy_0(ctx context.Context, marshaler runtime.
|
||||
|
||||
func request_Api_UpdatePullProxy_1(ctx context.Context, marshaler runtime.Marshaler, client ApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq PullProxyInfo
|
||||
protoReq UpdatePullProxyRequest
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.UpdatePullProxy(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_Api_UpdatePullProxy_1(ctx context.Context, marshaler runtime.Marshaler, server ApiServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq PullProxyInfo
|
||||
protoReq UpdatePullProxyRequest
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
@@ -1159,7 +1244,9 @@ func request_Api_GetPushProxyList_0(ctx context.Context, marshaler runtime.Marsh
|
||||
protoReq emptypb.Empty
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.GetPushProxyList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -1181,6 +1268,9 @@ func request_Api_AddPushProxy_0(ctx context.Context, marshaler runtime.Marshaler
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.AddPushProxy(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -1206,6 +1296,9 @@ func request_Api_RemovePushProxy_0(ctx context.Context, marshaler runtime.Marsha
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
@@ -1241,19 +1334,22 @@ func local_request_Api_RemovePushProxy_0(ctx context.Context, marshaler runtime.
|
||||
|
||||
func request_Api_UpdatePushProxy_0(ctx context.Context, marshaler runtime.Marshaler, client ApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq PushProxyInfo
|
||||
protoReq UpdatePushProxyRequest
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.UpdatePushProxy(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_Api_UpdatePushProxy_0(ctx context.Context, marshaler runtime.Marshaler, server ApiServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq PushProxyInfo
|
||||
protoReq UpdatePushProxyRequest
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
@@ -1268,7 +1364,9 @@ func request_Api_GetRecording_0(ctx context.Context, marshaler runtime.Marshaler
|
||||
protoReq emptypb.Empty
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.GetRecording(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -1287,7 +1385,9 @@ func request_Api_GetTransformList_0(ctx context.Context, marshaler runtime.Marsh
|
||||
protoReq emptypb.Empty
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
msg, err := client.GetTransformList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
@@ -1309,7 +1409,9 @@ func request_Api_GetRecordList_0(ctx context.Context, marshaler runtime.Marshale
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["type"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "type")
|
||||
@@ -1376,7 +1478,9 @@ func request_Api_GetEventRecordList_0(ctx context.Context, marshaler runtime.Mar
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["type"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "type")
|
||||
@@ -1441,7 +1545,9 @@ func request_Api_GetRecordCatalog_0(ctx context.Context, marshaler runtime.Marsh
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["type"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "type")
|
||||
@@ -1481,6 +1587,9 @@ func request_Api_DeleteRecord_0(ctx context.Context, marshaler runtime.Marshaler
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["type"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "type")
|
||||
@@ -1537,7 +1646,9 @@ func request_Api_GetAlarmList_0(ctx context.Context, marshaler runtime.Marshaler
|
||||
protoReq AlarmListRequest
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
@@ -181,7 +181,7 @@ service api {
|
||||
}
|
||||
};
|
||||
}
|
||||
rpc UpdatePullProxy (PullProxyInfo) returns (SuccessResponse) {
|
||||
rpc UpdatePullProxy (UpdatePullProxyRequest) returns (SuccessResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/proxy/pull/update"
|
||||
body: "*"
|
||||
@@ -208,7 +208,7 @@ service api {
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc UpdatePushProxy (PushProxyInfo) returns (SuccessResponse) {
|
||||
rpc UpdatePushProxy (UpdatePushProxyRequest) returns (SuccessResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/proxy/push/update"
|
||||
body: "*"
|
||||
@@ -571,6 +571,22 @@ message PullProxyInfo {
|
||||
string streamPath = 16; // 流路径
|
||||
}
|
||||
|
||||
message UpdatePullProxyRequest {
|
||||
uint32 ID = 1;
|
||||
optional uint32 parentID = 2; // 父设备ID
|
||||
optional string name = 3; // 设备名称
|
||||
optional string type = 4; // 设备类型
|
||||
optional uint32 status = 5; // 设备状态
|
||||
optional string pullURL = 6; // 拉流地址
|
||||
optional bool pullOnStart = 7; // 启动时拉流
|
||||
optional bool stopOnIdle = 8; // 空闲时停止拉流
|
||||
optional bool audio = 9; // 是否拉取音频
|
||||
optional string description = 10; // 设备描述
|
||||
optional string recordPath = 11; // 录制路径
|
||||
optional google.protobuf.Duration recordFragment = 12; // 录制片段长度
|
||||
optional string streamPath = 13; // 流路径
|
||||
}
|
||||
|
||||
message PushProxyInfo {
|
||||
uint32 ID = 1;
|
||||
google.protobuf.Timestamp createTime = 2;
|
||||
@@ -587,6 +603,20 @@ message PushProxyInfo {
|
||||
string streamPath = 13; // 流路径
|
||||
}
|
||||
|
||||
message UpdatePushProxyRequest {
|
||||
uint32 ID = 1;
|
||||
optional uint32 parentID = 2; // 父设备ID
|
||||
optional string name = 3; // 设备名称
|
||||
optional string type = 4; // 设备类型
|
||||
optional uint32 status = 5; // 设备状态
|
||||
optional string pushURL = 6; // 推流地址
|
||||
optional bool pushOnStart = 7; // 启动时推流
|
||||
optional bool audio = 8; // 是否推音频
|
||||
optional string description = 9; // 设备描述
|
||||
optional uint32 rtt = 10; // 平均RTT
|
||||
optional string streamPath = 11; // 流路径
|
||||
}
|
||||
|
||||
message PushProxyListResponse {
|
||||
int32 code = 1;
|
||||
string message = 2;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v5.29.3
|
||||
// - protoc v6.31.1
|
||||
// source: global.proto
|
||||
|
||||
package pb
|
||||
@@ -98,11 +98,11 @@ type ApiClient interface {
|
||||
GetPullProxyList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*PullProxyListResponse, error)
|
||||
AddPullProxy(ctx context.Context, in *PullProxyInfo, opts ...grpc.CallOption) (*SuccessResponse, error)
|
||||
RemovePullProxy(ctx context.Context, in *RequestWithId, opts ...grpc.CallOption) (*SuccessResponse, error)
|
||||
UpdatePullProxy(ctx context.Context, in *PullProxyInfo, opts ...grpc.CallOption) (*SuccessResponse, error)
|
||||
UpdatePullProxy(ctx context.Context, in *UpdatePullProxyRequest, opts ...grpc.CallOption) (*SuccessResponse, error)
|
||||
GetPushProxyList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*PushProxyListResponse, error)
|
||||
AddPushProxy(ctx context.Context, in *PushProxyInfo, opts ...grpc.CallOption) (*SuccessResponse, error)
|
||||
RemovePushProxy(ctx context.Context, in *RequestWithId, opts ...grpc.CallOption) (*SuccessResponse, error)
|
||||
UpdatePushProxy(ctx context.Context, in *PushProxyInfo, opts ...grpc.CallOption) (*SuccessResponse, error)
|
||||
UpdatePushProxy(ctx context.Context, in *UpdatePushProxyRequest, opts ...grpc.CallOption) (*SuccessResponse, error)
|
||||
GetRecording(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*RecordingListResponse, error)
|
||||
GetTransformList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*TransformListResponse, error)
|
||||
GetRecordList(ctx context.Context, in *ReqRecordList, opts ...grpc.CallOption) (*RecordResponseList, error)
|
||||
@@ -420,7 +420,7 @@ func (c *apiClient) RemovePullProxy(ctx context.Context, in *RequestWithId, opts
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *apiClient) UpdatePullProxy(ctx context.Context, in *PullProxyInfo, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
func (c *apiClient) UpdatePullProxy(ctx context.Context, in *UpdatePullProxyRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_UpdatePullProxy_FullMethodName, in, out, cOpts...)
|
||||
@@ -460,7 +460,7 @@ func (c *apiClient) RemovePushProxy(ctx context.Context, in *RequestWithId, opts
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *apiClient) UpdatePushProxy(ctx context.Context, in *PushProxyInfo, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
func (c *apiClient) UpdatePushProxy(ctx context.Context, in *UpdatePushProxyRequest, opts ...grpc.CallOption) (*SuccessResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SuccessResponse)
|
||||
err := c.cc.Invoke(ctx, Api_UpdatePushProxy_FullMethodName, in, out, cOpts...)
|
||||
@@ -574,11 +574,11 @@ type ApiServer interface {
|
||||
GetPullProxyList(context.Context, *emptypb.Empty) (*PullProxyListResponse, error)
|
||||
AddPullProxy(context.Context, *PullProxyInfo) (*SuccessResponse, error)
|
||||
RemovePullProxy(context.Context, *RequestWithId) (*SuccessResponse, error)
|
||||
UpdatePullProxy(context.Context, *PullProxyInfo) (*SuccessResponse, error)
|
||||
UpdatePullProxy(context.Context, *UpdatePullProxyRequest) (*SuccessResponse, error)
|
||||
GetPushProxyList(context.Context, *emptypb.Empty) (*PushProxyListResponse, error)
|
||||
AddPushProxy(context.Context, *PushProxyInfo) (*SuccessResponse, error)
|
||||
RemovePushProxy(context.Context, *RequestWithId) (*SuccessResponse, error)
|
||||
UpdatePushProxy(context.Context, *PushProxyInfo) (*SuccessResponse, error)
|
||||
UpdatePushProxy(context.Context, *UpdatePushProxyRequest) (*SuccessResponse, error)
|
||||
GetRecording(context.Context, *emptypb.Empty) (*RecordingListResponse, error)
|
||||
GetTransformList(context.Context, *emptypb.Empty) (*TransformListResponse, error)
|
||||
GetRecordList(context.Context, *ReqRecordList) (*RecordResponseList, error)
|
||||
@@ -686,7 +686,7 @@ func (UnimplementedApiServer) AddPullProxy(context.Context, *PullProxyInfo) (*Su
|
||||
func (UnimplementedApiServer) RemovePullProxy(context.Context, *RequestWithId) (*SuccessResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RemovePullProxy not implemented")
|
||||
}
|
||||
func (UnimplementedApiServer) UpdatePullProxy(context.Context, *PullProxyInfo) (*SuccessResponse, error) {
|
||||
func (UnimplementedApiServer) UpdatePullProxy(context.Context, *UpdatePullProxyRequest) (*SuccessResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdatePullProxy not implemented")
|
||||
}
|
||||
func (UnimplementedApiServer) GetPushProxyList(context.Context, *emptypb.Empty) (*PushProxyListResponse, error) {
|
||||
@@ -698,7 +698,7 @@ func (UnimplementedApiServer) AddPushProxy(context.Context, *PushProxyInfo) (*Su
|
||||
func (UnimplementedApiServer) RemovePushProxy(context.Context, *RequestWithId) (*SuccessResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RemovePushProxy not implemented")
|
||||
}
|
||||
func (UnimplementedApiServer) UpdatePushProxy(context.Context, *PushProxyInfo) (*SuccessResponse, error) {
|
||||
func (UnimplementedApiServer) UpdatePushProxy(context.Context, *UpdatePushProxyRequest) (*SuccessResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdatePushProxy not implemented")
|
||||
}
|
||||
func (UnimplementedApiServer) GetRecording(context.Context, *emptypb.Empty) (*RecordingListResponse, error) {
|
||||
@@ -1284,7 +1284,7 @@ func _Api_RemovePullProxy_Handler(srv interface{}, ctx context.Context, dec func
|
||||
}
|
||||
|
||||
func _Api_UpdatePullProxy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PullProxyInfo)
|
||||
in := new(UpdatePullProxyRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -1296,7 +1296,7 @@ func _Api_UpdatePullProxy_Handler(srv interface{}, ctx context.Context, dec func
|
||||
FullMethod: Api_UpdatePullProxy_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).UpdatePullProxy(ctx, req.(*PullProxyInfo))
|
||||
return srv.(ApiServer).UpdatePullProxy(ctx, req.(*UpdatePullProxyRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -1356,7 +1356,7 @@ func _Api_RemovePushProxy_Handler(srv interface{}, ctx context.Context, dec func
|
||||
}
|
||||
|
||||
func _Api_UpdatePushProxy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PushProxyInfo)
|
||||
in := new(UpdatePushProxyRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -1368,7 +1368,7 @@ func _Api_UpdatePushProxy_Handler(srv interface{}, ctx context.Context, dec func
|
||||
FullMethod: Api_UpdatePushProxy_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ApiServer).UpdatePushProxy(ctx, req.(*PushProxyInfo))
|
||||
return srv.(ApiServer).UpdatePushProxy(ctx, req.(*UpdatePushProxyRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
101
pull_proxy.go
101
pull_proxy.go
@@ -332,7 +332,7 @@ func (s *Server) AddPullProxy(ctx context.Context, req *pb.PullProxyInfo) (res *
|
||||
return
|
||||
}
|
||||
|
||||
func (s *Server) UpdatePullProxy(ctx context.Context, req *pb.PullProxyInfo) (res *pb.SuccessResponse, err error) {
|
||||
func (s *Server) UpdatePullProxy(ctx context.Context, req *pb.UpdatePullProxyRequest) (res *pb.SuccessResponse, err error) {
|
||||
if s.DB == nil {
|
||||
err = pkg.ErrNoDB
|
||||
return
|
||||
@@ -346,43 +346,76 @@ func (s *Server) UpdatePullProxy(ctx context.Context, req *pb.PullProxyInfo) (re
|
||||
// 记录原始状态,用于后续判断状态变化
|
||||
originalStatus := target.Status
|
||||
|
||||
target.Name = req.Name
|
||||
target.URL = req.PullURL
|
||||
target.ParentID = uint(req.ParentID)
|
||||
target.Type = req.Type
|
||||
if target.Type == "" {
|
||||
var u *url.URL
|
||||
u, err = url.Parse(req.PullURL)
|
||||
if err != nil {
|
||||
s.Error("parse pull url failed", "error", err)
|
||||
return
|
||||
// 只有当字段有值时才进行赋值
|
||||
if req.Name != nil {
|
||||
target.Name = *req.Name
|
||||
}
|
||||
if req.PullURL != nil {
|
||||
target.URL = *req.PullURL
|
||||
}
|
||||
if req.ParentID != nil {
|
||||
target.ParentID = uint(*req.ParentID)
|
||||
}
|
||||
if req.Type != nil {
|
||||
target.Type = *req.Type
|
||||
}
|
||||
|
||||
// 如果Type字段被更新或者原来为空,则尝试从URL推导类型
|
||||
if (req.Type != nil && *req.Type == "") || (req.PullURL != nil && target.Type == "") {
|
||||
var urlToParse string
|
||||
if req.PullURL != nil {
|
||||
urlToParse = *req.PullURL
|
||||
} else {
|
||||
urlToParse = target.URL
|
||||
}
|
||||
switch u.Scheme {
|
||||
case "srt", "rtsp", "rtmp":
|
||||
target.Type = u.Scheme
|
||||
default:
|
||||
ext := filepath.Ext(u.Path)
|
||||
switch ext {
|
||||
case ".m3u8":
|
||||
target.Type = "hls"
|
||||
case ".flv":
|
||||
target.Type = "flv"
|
||||
case ".mp4":
|
||||
target.Type = "mp4"
|
||||
|
||||
if urlToParse != "" {
|
||||
var u *url.URL
|
||||
u, err = url.Parse(urlToParse)
|
||||
if err != nil {
|
||||
s.Error("parse pull url failed", "error", err)
|
||||
return
|
||||
}
|
||||
switch u.Scheme {
|
||||
case "srt", "rtsp", "rtmp":
|
||||
target.Type = u.Scheme
|
||||
default:
|
||||
ext := filepath.Ext(u.Path)
|
||||
switch ext {
|
||||
case ".m3u8":
|
||||
target.Type = "hls"
|
||||
case ".flv":
|
||||
target.Type = "flv"
|
||||
case ".mp4":
|
||||
target.Type = "mp4"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
target.PullOnStart = req.PullOnStart
|
||||
target.StopOnIdle = req.StopOnIdle
|
||||
target.Audio = req.Audio
|
||||
target.Description = req.Description
|
||||
target.Record.FilePath = req.RecordPath
|
||||
target.Record.Fragment = req.RecordFragment.AsDuration()
|
||||
target.RTT = time.Duration(int(req.Rtt)) * time.Millisecond
|
||||
target.StreamPath = req.StreamPath
|
||||
|
||||
if req.PullOnStart != nil {
|
||||
target.PullOnStart = *req.PullOnStart
|
||||
}
|
||||
if req.StopOnIdle != nil {
|
||||
target.StopOnIdle = *req.StopOnIdle
|
||||
}
|
||||
if req.Audio != nil {
|
||||
target.Audio = *req.Audio
|
||||
}
|
||||
if req.Description != nil {
|
||||
target.Description = *req.Description
|
||||
}
|
||||
if req.RecordPath != nil {
|
||||
target.Record.FilePath = *req.RecordPath
|
||||
}
|
||||
if req.RecordFragment != nil {
|
||||
target.Record.Fragment = req.RecordFragment.AsDuration()
|
||||
}
|
||||
if req.StreamPath != nil {
|
||||
target.StreamPath = *req.StreamPath
|
||||
}
|
||||
// 如果设置状态为非 disable,需要检查是否有相同 streamPath 的其他非 disable 代理
|
||||
if req.Status != uint32(PullProxyStatusDisabled) {
|
||||
if req.Status != nil && *req.Status != uint32(PullProxyStatusDisabled) {
|
||||
var existingCount int64
|
||||
streamPath := target.StreamPath
|
||||
if streamPath == "" {
|
||||
@@ -395,8 +428,8 @@ func (s *Server) UpdatePullProxy(ctx context.Context, req *pb.PullProxyInfo) (re
|
||||
err = fmt.Errorf("已存在相同 streamPath [%s] 的非禁用代理,更新失败", streamPath)
|
||||
return
|
||||
}
|
||||
target.Status = byte(req.Status)
|
||||
} else {
|
||||
target.Status = byte(*req.Status)
|
||||
} else if req.Status != nil {
|
||||
target.Status = PullProxyStatusDisabled
|
||||
}
|
||||
|
||||
|
@@ -285,7 +285,7 @@ func (s *Server) AddPushProxy(ctx context.Context, req *pb.PushProxyInfo) (res *
|
||||
return
|
||||
}
|
||||
|
||||
func (s *Server) UpdatePushProxy(ctx context.Context, req *pb.PushProxyInfo) (res *pb.SuccessResponse, err error) {
|
||||
func (s *Server) UpdatePushProxy(ctx context.Context, req *pb.UpdatePushProxyRequest) (res *pb.SuccessResponse, err error) {
|
||||
if s.DB == nil {
|
||||
err = pkg.ErrNoDB
|
||||
return
|
||||
@@ -295,37 +295,56 @@ func (s *Server) UpdatePushProxy(ctx context.Context, req *pb.PushProxyInfo) (re
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
target.Name = req.Name
|
||||
target.URL = req.PushURL
|
||||
target.ParentID = uint(req.ParentID)
|
||||
target.Type = req.Type
|
||||
|
||||
// Update only if the field is provided (optional fields)
|
||||
if req.Name != nil {
|
||||
target.Name = *req.Name
|
||||
}
|
||||
if req.PushURL != nil {
|
||||
target.URL = *req.PushURL
|
||||
}
|
||||
if req.ParentID != nil {
|
||||
target.ParentID = uint(*req.ParentID)
|
||||
}
|
||||
if req.Type != nil {
|
||||
target.Type = *req.Type
|
||||
}
|
||||
if target.Type == "" {
|
||||
var u *url.URL
|
||||
u, err = url.Parse(req.PushURL)
|
||||
if err != nil {
|
||||
s.Error("parse pull url failed", "error", err)
|
||||
return
|
||||
}
|
||||
switch u.Scheme {
|
||||
case "srt", "rtsp", "rtmp":
|
||||
target.Type = u.Scheme
|
||||
default:
|
||||
ext := filepath.Ext(u.Path)
|
||||
switch ext {
|
||||
case ".m3u8":
|
||||
target.Type = "hls"
|
||||
case ".flv":
|
||||
target.Type = "flv"
|
||||
case ".mp4":
|
||||
target.Type = "mp4"
|
||||
if req.PushURL != nil {
|
||||
u, err = url.Parse(*req.PushURL)
|
||||
if err != nil {
|
||||
s.Error("parse push url failed", "error", err)
|
||||
return
|
||||
}
|
||||
switch u.Scheme {
|
||||
case "srt", "rtsp", "rtmp":
|
||||
target.Type = u.Scheme
|
||||
default:
|
||||
ext := filepath.Ext(u.Path)
|
||||
switch ext {
|
||||
case ".m3u8":
|
||||
target.Type = "hls"
|
||||
case ".flv":
|
||||
target.Type = "flv"
|
||||
case ".mp4":
|
||||
target.Type = "mp4"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
target.PushOnStart = req.PushOnStart
|
||||
target.Audio = req.Audio
|
||||
target.Description = req.Description
|
||||
target.RTT = time.Duration(int(req.Rtt)) * time.Millisecond
|
||||
target.StreamPath = req.StreamPath
|
||||
if req.PushOnStart != nil {
|
||||
target.PushOnStart = *req.PushOnStart
|
||||
}
|
||||
if req.Audio != nil {
|
||||
target.Audio = *req.Audio
|
||||
}
|
||||
if req.Description != nil {
|
||||
target.Description = *req.Description
|
||||
}
|
||||
if req.StreamPath != nil {
|
||||
target.StreamPath = *req.StreamPath
|
||||
}
|
||||
s.DB.Save(target)
|
||||
|
||||
// Stop the old proxy if needed
|
||||
|
Reference in New Issue
Block a user