add cp command

This commit is contained in:
2023-07-26 22:27:12 +02:00
parent 7522a8fb0a
commit 49cbffd46f
6 changed files with 391 additions and 110 deletions

View File

@@ -154,7 +154,7 @@ Speedrun:
## List of built-in Actions ## List of built-in Actions
* [x] run: run arbitrary shell commands * [x] run: run arbitrary shell commands
* [X] service: control systemd services * [X] service: control systemd services
* [ ] file: perform file operations such as read or tail * [X] file: perform file operations such as read or cp
* [ ] disk: perform storage operations such as listing partitions and available disk space * [ ] disk: perform storage operations such as listing partitions and available disk space
* [ ] ps: fetch process information * [ ] ps: fetch process information
* [ ] top: fetch or stream high level system stats * [ ] top: fetch or stream high level system stats

View File

@@ -4,6 +4,7 @@ import (
"context" "context"
"crypto/tls" "crypto/tls"
"net" "net"
"os"
"strings" "strings"
"time" "time"
@@ -30,9 +31,18 @@ var readCmd = &cobra.Command{
RunE: read, RunE: read,
} }
var cpCmd = &cobra.Command{
Use: "cp <src> <dst>",
Short: "Copy a file",
Example: " speedrun file cp myfile /tmp/myfile",
Args: cobra.MinimumNArgs(1),
RunE: cp,
}
func init() { func init() {
fileCmd.SetUsageTemplate(usage) fileCmd.SetUsageTemplate(usage)
fileCmd.AddCommand(readCmd) fileCmd.AddCommand(readCmd)
fileCmd.AddCommand(cpCmd)
} }
func read(cmd *cobra.Command, args []string) error { func read(cmd *cobra.Command, args []string) error {
@@ -83,10 +93,70 @@ func read(cmd *cobra.Command, args []string) error {
log.Error(err.Error()) log.Error(err.Error())
return return
} }
log.WithField("state", r.GetState()).Infof("Contents of %s:\n%s", path, r.GetContent()) log.WithField("state", r.GetState()).Infof("Contents of %s:", path)
println(r.GetContent())
}) })
} }
pool.StopAndWait() pool.StopAndWait()
return nil return nil
} }
func cp(cmd *cobra.Command, args []string) error {
usePrivateIP := viper.GetBool("portal.use-private-ip")
tlsConfig, err := cloud.SetupTLS()
if err != nil {
return err
}
target, err := cmd.Flags().GetString("target")
if err != nil {
return err
}
content, err := os.ReadFile(args[0])
if err != nil {
return err
}
portals, err := cloud.GetInstances(target)
if err != nil {
return err
}
pool := pond.New(1000, 10000)
for _, p := range portals {
portal := p
pool.Submit(func() {
fields := log.Fields{
"host": portal.Name,
"address": portal.GetAddress(usePrivateIP),
}
log := log.WithFields(fields)
addr := net.JoinHostPort(portal.GetAddress(usePrivateIP), "1337")
rawconn, err := tls.Dial("tcp", addr, tlsConfig)
if err != nil {
log.Error(err.Error())
return
}
conn := drpcconn.New(rawconn)
defer conn.Close()
c := portalpb.NewDRPCPortalClient(conn)
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()
r, err := c.FileCp(ctx, &portalpb.FileCpRequest{Path: args[1], Content: content})
if err != nil {
log.Error(err.Error())
return
}
log.WithField("state", r.GetState()).Infof("Done")
})
}
pool.StopAndWait()
return nil
}

View File

@@ -25,3 +25,21 @@ func (s *Server) FileRead(ctx context.Context, file *portal.FileReadRequest) (*p
return &portal.FileReadResponse{State: portal.State_UNKNOWN, Content: string(content)}, nil return &portal.FileReadResponse{State: portal.State_UNKNOWN, Content: string(content)}, nil
} }
func (s *Server) FileCp(ctx context.Context, file *portal.FileCpRequest) (*portal.FileCpResponse, error) {
fields := log.Fields{
"context": "file",
"command": "cp",
"name": file.GetPath(),
}
log := log.WithFields(fields)
log.Debug("Received file cp request")
err := os.WriteFile(file.GetPath(), file.GetContent(), 0644)
if err != nil {
log.Error(err.Error())
return nil, err
}
return &portal.FileCpResponse{State: portal.State_UNKNOWN}, nil
}

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.0 // protoc-gen-go v1.31.0
// protoc v3.19.4 // protoc v4.23.4
// source: portal/portal.proto // source: portal/portal.proto
package portal package portal
@@ -555,6 +555,108 @@ func (x *FileReadResponse) GetContent() string {
return "" return ""
} }
type FileCpRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
}
func (x *FileCpRequest) Reset() {
*x = FileCpRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_portal_portal_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FileCpRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FileCpRequest) ProtoMessage() {}
func (x *FileCpRequest) ProtoReflect() protoreflect.Message {
mi := &file_portal_portal_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use FileCpRequest.ProtoReflect.Descriptor instead.
func (*FileCpRequest) Descriptor() ([]byte, []int) {
return file_portal_portal_proto_rawDescGZIP(), []int{9}
}
func (x *FileCpRequest) GetPath() string {
if x != nil {
return x.Path
}
return ""
}
func (x *FileCpRequest) GetContent() []byte {
if x != nil {
return x.Content
}
return nil
}
type FileCpResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
State State `protobuf:"varint,1,opt,name=state,proto3,enum=portal.State" json:"state,omitempty"`
}
func (x *FileCpResponse) Reset() {
*x = FileCpResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_portal_portal_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FileCpResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FileCpResponse) ProtoMessage() {}
func (x *FileCpResponse) ProtoReflect() protoreflect.Message {
mi := &file_portal_portal_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use FileCpResponse.ProtoReflect.Descriptor instead.
func (*FileCpResponse) Descriptor() ([]byte, []int) {
return file_portal_portal_proto_rawDescGZIP(), []int{10}
}
func (x *FileCpResponse) GetState() State {
if x != nil {
return x.State
}
return State_UNKNOWN
}
type SystemRebootRequest struct { type SystemRebootRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@@ -564,7 +666,7 @@ type SystemRebootRequest struct {
func (x *SystemRebootRequest) Reset() { func (x *SystemRebootRequest) Reset() {
*x = SystemRebootRequest{} *x = SystemRebootRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_portal_portal_proto_msgTypes[9] mi := &file_portal_portal_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -577,7 +679,7 @@ func (x *SystemRebootRequest) String() string {
func (*SystemRebootRequest) ProtoMessage() {} func (*SystemRebootRequest) ProtoMessage() {}
func (x *SystemRebootRequest) ProtoReflect() protoreflect.Message { func (x *SystemRebootRequest) ProtoReflect() protoreflect.Message {
mi := &file_portal_portal_proto_msgTypes[9] mi := &file_portal_portal_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -590,7 +692,7 @@ func (x *SystemRebootRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SystemRebootRequest.ProtoReflect.Descriptor instead. // Deprecated: Use SystemRebootRequest.ProtoReflect.Descriptor instead.
func (*SystemRebootRequest) Descriptor() ([]byte, []int) { func (*SystemRebootRequest) Descriptor() ([]byte, []int) {
return file_portal_portal_proto_rawDescGZIP(), []int{9} return file_portal_portal_proto_rawDescGZIP(), []int{11}
} }
type SystemRebootResponse struct { type SystemRebootResponse struct {
@@ -605,7 +707,7 @@ type SystemRebootResponse struct {
func (x *SystemRebootResponse) Reset() { func (x *SystemRebootResponse) Reset() {
*x = SystemRebootResponse{} *x = SystemRebootResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_portal_portal_proto_msgTypes[10] mi := &file_portal_portal_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -618,7 +720,7 @@ func (x *SystemRebootResponse) String() string {
func (*SystemRebootResponse) ProtoMessage() {} func (*SystemRebootResponse) ProtoMessage() {}
func (x *SystemRebootResponse) ProtoReflect() protoreflect.Message { func (x *SystemRebootResponse) ProtoReflect() protoreflect.Message {
mi := &file_portal_portal_proto_msgTypes[10] mi := &file_portal_portal_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -631,7 +733,7 @@ func (x *SystemRebootResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use SystemRebootResponse.ProtoReflect.Descriptor instead. // Deprecated: Use SystemRebootResponse.ProtoReflect.Descriptor instead.
func (*SystemRebootResponse) Descriptor() ([]byte, []int) { func (*SystemRebootResponse) Descriptor() ([]byte, []int) {
return file_portal_portal_proto_rawDescGZIP(), []int{10} return file_portal_portal_proto_rawDescGZIP(), []int{12}
} }
func (x *SystemRebootResponse) GetState() State { func (x *SystemRebootResponse) GetState() State {
@@ -657,7 +759,7 @@ type SystemShutdownRequest struct {
func (x *SystemShutdownRequest) Reset() { func (x *SystemShutdownRequest) Reset() {
*x = SystemShutdownRequest{} *x = SystemShutdownRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_portal_portal_proto_msgTypes[11] mi := &file_portal_portal_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -670,7 +772,7 @@ func (x *SystemShutdownRequest) String() string {
func (*SystemShutdownRequest) ProtoMessage() {} func (*SystemShutdownRequest) ProtoMessage() {}
func (x *SystemShutdownRequest) ProtoReflect() protoreflect.Message { func (x *SystemShutdownRequest) ProtoReflect() protoreflect.Message {
mi := &file_portal_portal_proto_msgTypes[11] mi := &file_portal_portal_proto_msgTypes[13]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -683,7 +785,7 @@ func (x *SystemShutdownRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SystemShutdownRequest.ProtoReflect.Descriptor instead. // Deprecated: Use SystemShutdownRequest.ProtoReflect.Descriptor instead.
func (*SystemShutdownRequest) Descriptor() ([]byte, []int) { func (*SystemShutdownRequest) Descriptor() ([]byte, []int) {
return file_portal_portal_proto_rawDescGZIP(), []int{11} return file_portal_portal_proto_rawDescGZIP(), []int{13}
} }
type SystemShutdownResponse struct { type SystemShutdownResponse struct {
@@ -698,7 +800,7 @@ type SystemShutdownResponse struct {
func (x *SystemShutdownResponse) Reset() { func (x *SystemShutdownResponse) Reset() {
*x = SystemShutdownResponse{} *x = SystemShutdownResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_portal_portal_proto_msgTypes[12] mi := &file_portal_portal_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -711,7 +813,7 @@ func (x *SystemShutdownResponse) String() string {
func (*SystemShutdownResponse) ProtoMessage() {} func (*SystemShutdownResponse) ProtoMessage() {}
func (x *SystemShutdownResponse) ProtoReflect() protoreflect.Message { func (x *SystemShutdownResponse) ProtoReflect() protoreflect.Message {
mi := &file_portal_portal_proto_msgTypes[12] mi := &file_portal_portal_proto_msgTypes[14]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -724,7 +826,7 @@ func (x *SystemShutdownResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use SystemShutdownResponse.ProtoReflect.Descriptor instead. // Deprecated: Use SystemShutdownResponse.ProtoReflect.Descriptor instead.
func (*SystemShutdownResponse) Descriptor() ([]byte, []int) { func (*SystemShutdownResponse) Descriptor() ([]byte, []int) {
return file_portal_portal_proto_rawDescGZIP(), []int{12} return file_portal_portal_proto_rawDescGZIP(), []int{14}
} }
func (x *SystemShutdownResponse) GetState() State { func (x *SystemShutdownResponse) GetState() State {
@@ -787,67 +889,79 @@ var file_portal_portal_proto_rawDesc = []byte{
0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x74, 0x61, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x74, 0x61,
0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e,
0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74,
0x65, 0x6e, 0x74, 0x22, 0x15, 0x0a, 0x13, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x62, 0x65, 0x6e, 0x74, 0x22, 0x3d, 0x0a, 0x0d, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x70, 0x52, 0x65, 0x71,
0x6f, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x55, 0x0a, 0x14, 0x53, 0x79, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01,
0x73, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74,
0x73, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65,
0x0e, 0x32, 0x0d, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x35, 0x0a, 0x0e, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x70, 0x52, 0x65, 0x73, 0x70,
0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x22, 0x17, 0x0a, 0x15, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x68, 0x75, 0x74, 0x64,
0x6f, 0x77, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x57, 0x0a, 0x16, 0x53, 0x79,
0x73, 0x74, 0x65, 0x6d, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x74, 0x61, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x74, 0x61,
0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x15, 0x0a, 0x13, 0x53, 0x79, 0x73,
0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x61, 0x67, 0x65, 0x2a, 0x30, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x22, 0x55, 0x0a, 0x14, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74,
0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x48, 0x41, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74,
0x4e, 0x47, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x43, 0x48, 0x41, 0x4e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c,
0x47, 0x45, 0x44, 0x10, 0x02, 0x32, 0xff, 0x04, 0x0a, 0x06, 0x50, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a,
0x12, 0x43, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x74, 0x61, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x72, 0x74, 0x12, 0x16, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x17, 0x0a, 0x15, 0x53, 0x79, 0x73, 0x74, 0x65,
0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x6d, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x22, 0x57, 0x0a, 0x16, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x77, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x73, 0x74,
0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x16, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x70, 0x6f, 0x72, 0x74,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x61, 0x6c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12,
0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2a, 0x30, 0x0a, 0x05, 0x53, 0x74, 0x61,
0x69, 0x63, 0x65, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x16, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12,
0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0b, 0x0a, 0x07, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09,
0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x4e, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x44, 0x10, 0x02, 0x32, 0xba, 0x05, 0x0a, 0x06,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x0d, 0x53, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x12, 0x43, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x70, 0x6f, 0x65, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x16, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61,
0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x0c, 0x53,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x16, 0x2e, 0x70, 0x6f,
0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40,
0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x0a, 0x52, 0x75, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x16, 0x2e,
0x6e, 0x64, 0x12, 0x16, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65,
0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53,
0x74, 0x61, 0x6c, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x08, 0x43, 0x50, 0x55, 0x75, 0x73, 0x61, 0x67, 0x12, 0x48, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75,
0x65, 0x12, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x43, 0x50, 0x55, 0x75, 0x73, 0x73, 0x12, 0x16, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69,
0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x6f, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x6f, 0x72, 0x74,
0x74, 0x61, 0x6c, 0x2e, 0x43, 0x50, 0x55, 0x75, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x61, 0x6c, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x0a, 0x52, 0x75,
0x61, 0x64, 0x12, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x16, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61,
0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x6f, 0x6c, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x72, 0x74, 0x61, 0x6c, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x1a, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x0c, 0x53, 0x79, 0x73, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x08, 0x43,
0x6d, 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0x12, 0x1b, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x50, 0x55, 0x75, 0x73, 0x61, 0x67, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c,
0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x2e, 0x43, 0x50, 0x55, 0x75, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x79, 0x1a, 0x18, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x43, 0x50, 0x55, 0x75, 0x73, 0x61,
0x73, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x08,
0x73, 0x65, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x0e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x68, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x61, 0x64, 0x12, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61,
0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x1d, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x6c, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x18, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52,
0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x39, 0x0a,
0x06, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x70, 0x12, 0x15, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c,
0x2e, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16,
0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x70, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x0c, 0x53, 0x79, 0x73, 0x74,
0x65, 0x6d, 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0x12, 0x1b, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61,
0x6c, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53,
0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x0e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53,
0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x1d, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c,
0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e,
0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68,
0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x70, 0x6f, 0x67, 0x6f, 0x72, 0x7a, 0x65, 0x6c,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x73, 0x6b, 0x69, 0x2f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x72, 0x75, 0x6e, 0x2f, 0x70, 0x72, 0x6f,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x70, 0x6f, 0x67, 0x6f, 0x72, 0x7a, 0x65, 0x6c, 0x73, 0x74, 0x6f, 0x2f, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x6b, 0x69, 0x2f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x72, 0x75, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x33,
0x6f, 0x2f, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@@ -863,7 +977,7 @@ func file_portal_portal_proto_rawDescGZIP() []byte {
} }
var file_portal_portal_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_portal_portal_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_portal_portal_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_portal_portal_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
var file_portal_portal_proto_goTypes = []interface{}{ var file_portal_portal_proto_goTypes = []interface{}{
(State)(0), // 0: portal.State (State)(0), // 0: portal.State
(*CommandRequest)(nil), // 1: portal.CommandRequest (*CommandRequest)(nil), // 1: portal.CommandRequest
@@ -875,41 +989,46 @@ var file_portal_portal_proto_goTypes = []interface{}{
(*CPUusageResponse)(nil), // 7: portal.CPUusageResponse (*CPUusageResponse)(nil), // 7: portal.CPUusageResponse
(*FileReadRequest)(nil), // 8: portal.FileReadRequest (*FileReadRequest)(nil), // 8: portal.FileReadRequest
(*FileReadResponse)(nil), // 9: portal.FileReadResponse (*FileReadResponse)(nil), // 9: portal.FileReadResponse
(*SystemRebootRequest)(nil), // 10: portal.SystemRebootRequest (*FileCpRequest)(nil), // 10: portal.FileCpRequest
(*SystemRebootResponse)(nil), // 11: portal.SystemRebootResponse (*FileCpResponse)(nil), // 11: portal.FileCpResponse
(*SystemShutdownRequest)(nil), // 12: portal.SystemShutdownRequest (*SystemRebootRequest)(nil), // 12: portal.SystemRebootRequest
(*SystemShutdownResponse)(nil), // 13: portal.SystemShutdownResponse (*SystemRebootResponse)(nil), // 13: portal.SystemRebootResponse
(*SystemShutdownRequest)(nil), // 14: portal.SystemShutdownRequest
(*SystemShutdownResponse)(nil), // 15: portal.SystemShutdownResponse
} }
var file_portal_portal_proto_depIdxs = []int32{ var file_portal_portal_proto_depIdxs = []int32{
0, // 0: portal.CommandResponse.state:type_name -> portal.State 0, // 0: portal.CommandResponse.state:type_name -> portal.State
0, // 1: portal.ServiceResponse.state:type_name -> portal.State 0, // 1: portal.ServiceResponse.state:type_name -> portal.State
0, // 2: portal.ServiceStatusResponse.state:type_name -> portal.State 0, // 2: portal.ServiceStatusResponse.state:type_name -> portal.State
0, // 3: portal.FileReadResponse.state:type_name -> portal.State 0, // 3: portal.FileReadResponse.state:type_name -> portal.State
0, // 4: portal.SystemRebootResponse.state:type_name -> portal.State 0, // 4: portal.FileCpResponse.state:type_name -> portal.State
0, // 5: portal.SystemShutdownResponse.state:type_name -> portal.State 0, // 5: portal.SystemRebootResponse.state:type_name -> portal.State
3, // 6: portal.Portal.ServiceRestart:input_type -> portal.ServiceRequest 0, // 6: portal.SystemShutdownResponse.state:type_name -> portal.State
3, // 7: portal.Portal.ServiceStart:input_type -> portal.ServiceRequest 3, // 7: portal.Portal.ServiceRestart:input_type -> portal.ServiceRequest
3, // 8: portal.Portal.ServiceStop:input_type -> portal.ServiceRequest 3, // 8: portal.Portal.ServiceStart:input_type -> portal.ServiceRequest
3, // 9: portal.Portal.ServiceStatus:input_type -> portal.ServiceRequest 3, // 9: portal.Portal.ServiceStop:input_type -> portal.ServiceRequest
1, // 10: portal.Portal.RunCommand:input_type -> portal.CommandRequest 3, // 10: portal.Portal.ServiceStatus:input_type -> portal.ServiceRequest
6, // 11: portal.Portal.CPUusage:input_type -> portal.CPUusageRequest 1, // 11: portal.Portal.RunCommand:input_type -> portal.CommandRequest
8, // 12: portal.Portal.FileRead:input_type -> portal.FileReadRequest 6, // 12: portal.Portal.CPUusage:input_type -> portal.CPUusageRequest
10, // 13: portal.Portal.SystemReboot:input_type -> portal.SystemRebootRequest 8, // 13: portal.Portal.FileRead:input_type -> portal.FileReadRequest
12, // 14: portal.Portal.SystemShutdown:input_type -> portal.SystemShutdownRequest 10, // 14: portal.Portal.FileCp:input_type -> portal.FileCpRequest
4, // 15: portal.Portal.ServiceRestart:output_type -> portal.ServiceResponse 12, // 15: portal.Portal.SystemReboot:input_type -> portal.SystemRebootRequest
4, // 16: portal.Portal.ServiceStart:output_type -> portal.ServiceResponse 14, // 16: portal.Portal.SystemShutdown:input_type -> portal.SystemShutdownRequest
4, // 17: portal.Portal.ServiceStop:output_type -> portal.ServiceResponse 4, // 17: portal.Portal.ServiceRestart:output_type -> portal.ServiceResponse
5, // 18: portal.Portal.ServiceStatus:output_type -> portal.ServiceStatusResponse 4, // 18: portal.Portal.ServiceStart:output_type -> portal.ServiceResponse
2, // 19: portal.Portal.RunCommand:output_type -> portal.CommandResponse 4, // 19: portal.Portal.ServiceStop:output_type -> portal.ServiceResponse
7, // 20: portal.Portal.CPUusage:output_type -> portal.CPUusageResponse 5, // 20: portal.Portal.ServiceStatus:output_type -> portal.ServiceStatusResponse
9, // 21: portal.Portal.FileRead:output_type -> portal.FileReadResponse 2, // 21: portal.Portal.RunCommand:output_type -> portal.CommandResponse
11, // 22: portal.Portal.SystemReboot:output_type -> portal.SystemRebootResponse 7, // 22: portal.Portal.CPUusage:output_type -> portal.CPUusageResponse
13, // 23: portal.Portal.SystemShutdown:output_type -> portal.SystemShutdownResponse 9, // 23: portal.Portal.FileRead:output_type -> portal.FileReadResponse
15, // [15:24] is the sub-list for method output_type 11, // 24: portal.Portal.FileCp:output_type -> portal.FileCpResponse
6, // [6:15] is the sub-list for method input_type 13, // 25: portal.Portal.SystemReboot:output_type -> portal.SystemRebootResponse
6, // [6:6] is the sub-list for extension type_name 15, // 26: portal.Portal.SystemShutdown:output_type -> portal.SystemShutdownResponse
6, // [6:6] is the sub-list for extension extendee 17, // [17:27] is the sub-list for method output_type
0, // [0:6] is the sub-list for field type_name 7, // [7:17] is the sub-list for method input_type
7, // [7:7] is the sub-list for extension type_name
7, // [7:7] is the sub-list for extension extendee
0, // [0:7] is the sub-list for field type_name
} }
func init() { file_portal_portal_proto_init() } func init() { file_portal_portal_proto_init() }
@@ -1027,7 +1146,7 @@ func file_portal_portal_proto_init() {
} }
} }
file_portal_portal_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { file_portal_portal_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SystemRebootRequest); i { switch v := v.(*FileCpRequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@@ -1039,7 +1158,7 @@ func file_portal_portal_proto_init() {
} }
} }
file_portal_portal_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { file_portal_portal_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SystemRebootResponse); i { switch v := v.(*FileCpResponse); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@@ -1051,7 +1170,7 @@ func file_portal_portal_proto_init() {
} }
} }
file_portal_portal_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { file_portal_portal_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SystemShutdownRequest); i { switch v := v.(*SystemRebootRequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@@ -1063,6 +1182,30 @@ func file_portal_portal_proto_init() {
} }
} }
file_portal_portal_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { file_portal_portal_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SystemRebootResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_portal_portal_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SystemShutdownRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_portal_portal_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SystemShutdownResponse); i { switch v := v.(*SystemShutdownResponse); i {
case 0: case 0:
return &v.state return &v.state
@@ -1081,7 +1224,7 @@ func file_portal_portal_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_portal_portal_proto_rawDesc, RawDescriptor: file_portal_portal_proto_rawDesc,
NumEnums: 1, NumEnums: 1,
NumMessages: 13, NumMessages: 15,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },

View File

@@ -51,6 +51,15 @@ message FileReadResponse {
string content = 2; string content = 2;
} }
message FileCpRequest {
string path = 1;
bytes content = 2;
}
message FileCpResponse {
State state = 1;
}
message SystemRebootRequest {} message SystemRebootRequest {}
message SystemRebootResponse { message SystemRebootResponse {
@@ -73,6 +82,7 @@ service Portal {
rpc RunCommand(CommandRequest) returns (CommandResponse) {} rpc RunCommand(CommandRequest) returns (CommandResponse) {}
rpc CPUusage(CPUusageRequest) returns (CPUusageResponse) {} rpc CPUusage(CPUusageRequest) returns (CPUusageResponse) {}
rpc FileRead(FileReadRequest) returns (FileReadResponse) {} rpc FileRead(FileReadRequest) returns (FileReadResponse) {}
rpc FileCp(FileCpRequest) returns (FileCpResponse) {}
rpc SystemReboot(SystemRebootRequest) returns (SystemRebootResponse) {} rpc SystemReboot(SystemRebootRequest) returns (SystemRebootResponse) {}
rpc SystemShutdown(SystemShutdownRequest) returns (SystemShutdownResponse) {} rpc SystemShutdown(SystemShutdownRequest) returns (SystemShutdownResponse) {}
// --target group1 --target group2 // --target group1 --target group2

View File

@@ -1,5 +1,5 @@
// Code generated by protoc-gen-go-drpc. DO NOT EDIT. // Code generated by protoc-gen-go-drpc. DO NOT EDIT.
// protoc-gen-go-drpc version: v0.0.30 // protoc-gen-go-drpc version: v0.0.33
// source: portal/portal.proto // source: portal/portal.proto
package portal package portal
@@ -45,6 +45,7 @@ type DRPCPortalClient interface {
RunCommand(ctx context.Context, in *CommandRequest) (*CommandResponse, error) RunCommand(ctx context.Context, in *CommandRequest) (*CommandResponse, error)
CPUusage(ctx context.Context, in *CPUusageRequest) (*CPUusageResponse, error) CPUusage(ctx context.Context, in *CPUusageRequest) (*CPUusageResponse, error)
FileRead(ctx context.Context, in *FileReadRequest) (*FileReadResponse, error) FileRead(ctx context.Context, in *FileReadRequest) (*FileReadResponse, error)
FileCp(ctx context.Context, in *FileCpRequest) (*FileCpResponse, error)
SystemReboot(ctx context.Context, in *SystemRebootRequest) (*SystemRebootResponse, error) SystemReboot(ctx context.Context, in *SystemRebootRequest) (*SystemRebootResponse, error)
SystemShutdown(ctx context.Context, in *SystemShutdownRequest) (*SystemShutdownResponse, error) SystemShutdown(ctx context.Context, in *SystemShutdownRequest) (*SystemShutdownResponse, error)
} }
@@ -122,6 +123,15 @@ func (c *drpcPortalClient) FileRead(ctx context.Context, in *FileReadRequest) (*
return out, nil return out, nil
} }
func (c *drpcPortalClient) FileCp(ctx context.Context, in *FileCpRequest) (*FileCpResponse, error) {
out := new(FileCpResponse)
err := c.cc.Invoke(ctx, "/portal.Portal/FileCp", drpcEncoding_File_portal_portal_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *drpcPortalClient) SystemReboot(ctx context.Context, in *SystemRebootRequest) (*SystemRebootResponse, error) { func (c *drpcPortalClient) SystemReboot(ctx context.Context, in *SystemRebootRequest) (*SystemRebootResponse, error) {
out := new(SystemRebootResponse) out := new(SystemRebootResponse)
err := c.cc.Invoke(ctx, "/portal.Portal/SystemReboot", drpcEncoding_File_portal_portal_proto{}, in, out) err := c.cc.Invoke(ctx, "/portal.Portal/SystemReboot", drpcEncoding_File_portal_portal_proto{}, in, out)
@@ -148,6 +158,7 @@ type DRPCPortalServer interface {
RunCommand(context.Context, *CommandRequest) (*CommandResponse, error) RunCommand(context.Context, *CommandRequest) (*CommandResponse, error)
CPUusage(context.Context, *CPUusageRequest) (*CPUusageResponse, error) CPUusage(context.Context, *CPUusageRequest) (*CPUusageResponse, error)
FileRead(context.Context, *FileReadRequest) (*FileReadResponse, error) FileRead(context.Context, *FileReadRequest) (*FileReadResponse, error)
FileCp(context.Context, *FileCpRequest) (*FileCpResponse, error)
SystemReboot(context.Context, *SystemRebootRequest) (*SystemRebootResponse, error) SystemReboot(context.Context, *SystemRebootRequest) (*SystemRebootResponse, error)
SystemShutdown(context.Context, *SystemShutdownRequest) (*SystemShutdownResponse, error) SystemShutdown(context.Context, *SystemShutdownRequest) (*SystemShutdownResponse, error)
} }
@@ -182,6 +193,10 @@ func (s *DRPCPortalUnimplementedServer) FileRead(context.Context, *FileReadReque
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
} }
func (s *DRPCPortalUnimplementedServer) FileCp(context.Context, *FileCpRequest) (*FileCpResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
func (s *DRPCPortalUnimplementedServer) SystemReboot(context.Context, *SystemRebootRequest) (*SystemRebootResponse, error) { func (s *DRPCPortalUnimplementedServer) SystemReboot(context.Context, *SystemRebootRequest) (*SystemRebootResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
} }
@@ -192,7 +207,7 @@ func (s *DRPCPortalUnimplementedServer) SystemShutdown(context.Context, *SystemS
type DRPCPortalDescription struct{} type DRPCPortalDescription struct{}
func (DRPCPortalDescription) NumMethods() int { return 9 } func (DRPCPortalDescription) NumMethods() int { return 10 }
func (DRPCPortalDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { func (DRPCPortalDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
switch n { switch n {
@@ -260,6 +275,15 @@ func (DRPCPortalDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver
) )
}, DRPCPortalServer.FileRead, true }, DRPCPortalServer.FileRead, true
case 7: case 7:
return "/portal.Portal/FileCp", drpcEncoding_File_portal_portal_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPortalServer).
FileCp(
ctx,
in1.(*FileCpRequest),
)
}, DRPCPortalServer.FileCp, true
case 8:
return "/portal.Portal/SystemReboot", drpcEncoding_File_portal_portal_proto{}, return "/portal.Portal/SystemReboot", drpcEncoding_File_portal_portal_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPortalServer). return srv.(DRPCPortalServer).
@@ -268,7 +292,7 @@ func (DRPCPortalDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver
in1.(*SystemRebootRequest), in1.(*SystemRebootRequest),
) )
}, DRPCPortalServer.SystemReboot, true }, DRPCPortalServer.SystemReboot, true
case 8: case 9:
return "/portal.Portal/SystemShutdown", drpcEncoding_File_portal_portal_proto{}, return "/portal.Portal/SystemShutdown", drpcEncoding_File_portal_portal_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPortalServer). return srv.(DRPCPortalServer).
@@ -398,6 +422,22 @@ func (x *drpcPortal_FileReadStream) SendAndClose(m *FileReadResponse) error {
return x.CloseSend() return x.CloseSend()
} }
type DRPCPortal_FileCpStream interface {
drpc.Stream
SendAndClose(*FileCpResponse) error
}
type drpcPortal_FileCpStream struct {
drpc.Stream
}
func (x *drpcPortal_FileCpStream) SendAndClose(m *FileCpResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_portal_portal_proto{}); err != nil {
return err
}
return x.CloseSend()
}
type DRPCPortal_SystemRebootStream interface { type DRPCPortal_SystemRebootStream interface {
drpc.Stream drpc.Stream
SendAndClose(*SystemRebootResponse) error SendAndClose(*SystemRebootResponse) error