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
* [x] run: run arbitrary shell commands
* [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
* [ ] ps: fetch process information
* [ ] top: fetch or stream high level system stats

View File

@@ -4,6 +4,7 @@ import (
"context"
"crypto/tls"
"net"
"os"
"strings"
"time"
@@ -30,9 +31,18 @@ var readCmd = &cobra.Command{
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() {
fileCmd.SetUsageTemplate(usage)
fileCmd.AddCommand(readCmd)
fileCmd.AddCommand(cpCmd)
}
func read(cmd *cobra.Command, args []string) error {
@@ -83,10 +93,70 @@ func read(cmd *cobra.Command, args []string) error {
log.Error(err.Error())
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()
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
}
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.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.19.4
// protoc-gen-go v1.31.0
// protoc v4.23.4
// source: portal/portal.proto
package portal
@@ -555,6 +555,108 @@ func (x *FileReadResponse) GetContent() string {
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 {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -564,7 +666,7 @@ type SystemRebootRequest struct {
func (x *SystemRebootRequest) Reset() {
*x = SystemRebootRequest{}
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.StoreMessageInfo(mi)
}
@@ -577,7 +679,7 @@ func (x *SystemRebootRequest) String() string {
func (*SystemRebootRequest) ProtoMessage() {}
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 {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -590,7 +692,7 @@ func (x *SystemRebootRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SystemRebootRequest.ProtoReflect.Descriptor instead.
func (*SystemRebootRequest) Descriptor() ([]byte, []int) {
return file_portal_portal_proto_rawDescGZIP(), []int{9}
return file_portal_portal_proto_rawDescGZIP(), []int{11}
}
type SystemRebootResponse struct {
@@ -605,7 +707,7 @@ type SystemRebootResponse struct {
func (x *SystemRebootResponse) Reset() {
*x = SystemRebootResponse{}
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.StoreMessageInfo(mi)
}
@@ -618,7 +720,7 @@ func (x *SystemRebootResponse) String() string {
func (*SystemRebootResponse) ProtoMessage() {}
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 {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -631,7 +733,7 @@ func (x *SystemRebootResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use SystemRebootResponse.ProtoReflect.Descriptor instead.
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 {
@@ -657,7 +759,7 @@ type SystemShutdownRequest struct {
func (x *SystemShutdownRequest) Reset() {
*x = SystemShutdownRequest{}
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.StoreMessageInfo(mi)
}
@@ -670,7 +772,7 @@ func (x *SystemShutdownRequest) String() string {
func (*SystemShutdownRequest) ProtoMessage() {}
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 {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -683,7 +785,7 @@ func (x *SystemShutdownRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SystemShutdownRequest.ProtoReflect.Descriptor instead.
func (*SystemShutdownRequest) Descriptor() ([]byte, []int) {
return file_portal_portal_proto_rawDescGZIP(), []int{11}
return file_portal_portal_proto_rawDescGZIP(), []int{13}
}
type SystemShutdownResponse struct {
@@ -698,7 +800,7 @@ type SystemShutdownResponse struct {
func (x *SystemShutdownResponse) Reset() {
*x = SystemShutdownResponse{}
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.StoreMessageInfo(mi)
}
@@ -711,7 +813,7 @@ func (x *SystemShutdownResponse) String() string {
func (*SystemShutdownResponse) ProtoMessage() {}
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 {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -724,7 +826,7 @@ func (x *SystemShutdownResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use SystemShutdownResponse.ProtoReflect.Descriptor instead.
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 {
@@ -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,
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,
0x65, 0x6e, 0x74, 0x22, 0x15, 0x0a, 0x13, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x62,
0x6f, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x55, 0x0a, 0x14, 0x53, 0x79,
0x73, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 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, 0x74, 0x65,
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,
0x65, 0x6e, 0x74, 0x22, 0x3d, 0x0a, 0x0d, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x70, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74,
0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65,
0x6e, 0x74, 0x22, 0x35, 0x0a, 0x0e, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x70, 0x52, 0x65, 0x73, 0x70,
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,
0x74, 0x65, 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, 0x2a, 0x30, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07,
0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x48, 0x41,
0x4e, 0x47, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x43, 0x48, 0x41, 0x4e,
0x47, 0x45, 0x44, 0x10, 0x02, 0x32, 0xff, 0x04, 0x0a, 0x06, 0x50, 0x6f, 0x72, 0x74, 0x61, 0x6c,
0x12, 0x43, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 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, 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, 0x40, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x53, 0x74, 0x6f, 0x70, 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, 0x48, 0x0a, 0x0d, 0x53, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x70, 0x6f,
0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x15, 0x0a, 0x13, 0x53, 0x79, 0x73,
0x74, 0x65, 0x6d, 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x22, 0x55, 0x0a, 0x14, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x62, 0x6f, 0x6f, 0x74,
0x52, 0x65, 0x73, 0x70, 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, 0x74, 0x65, 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, 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, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2a, 0x30, 0x0a, 0x05, 0x53, 0x74, 0x61,
0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12,
0x0b, 0x0a, 0x07, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09,
0x55, 0x4e, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x44, 0x10, 0x02, 0x32, 0xba, 0x05, 0x0a, 0x06,
0x50, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x12, 0x43, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
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,
0x65, 0x73, 0x74, 0x1a, 0x1d, 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,
0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x0a, 0x52, 0x75, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61,
0x6e, 0x64, 0x12, 0x16, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x43, 0x6f, 0x6d, 0x6d,
0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x6f, 0x72,
0x74, 0x61, 0x6c, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x08, 0x43, 0x50, 0x55, 0x75, 0x73, 0x61, 0x67,
0x65, 0x12, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x43, 0x50, 0x55, 0x75, 0x73,
0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x6f, 0x72,
0x74, 0x61, 0x6c, 0x2e, 0x43, 0x50, 0x55, 0x75, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65,
0x61, 0x64, 0x12, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 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, 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,
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, 0x40,
0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x6f, 0x70, 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, 0x48, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75,
0x73, 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, 0x1d, 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, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x0a, 0x52, 0x75,
0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x16, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61,
0x6c, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x08, 0x43,
0x50, 0x55, 0x75, 0x73, 0x61, 0x67, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c,
0x2e, 0x43, 0x50, 0x55, 0x75, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x18, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x43, 0x50, 0x55, 0x75, 0x73, 0x61,
0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x08,
0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x61, 0x64, 0x12, 0x17, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61,
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,
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, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x70, 0x6f, 0x67, 0x6f, 0x72, 0x7a, 0x65, 0x6c, 0x73,
0x6b, 0x69, 0x2f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x72, 0x75, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2f, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68,
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x70, 0x6f, 0x67, 0x6f, 0x72, 0x7a, 0x65, 0x6c,
0x73, 0x6b, 0x69, 0x2f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x72, 0x75, 0x6e, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x2f, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
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_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_portal_portal_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
var file_portal_portal_proto_goTypes = []interface{}{
(State)(0), // 0: portal.State
(*CommandRequest)(nil), // 1: portal.CommandRequest
@@ -875,41 +989,46 @@ var file_portal_portal_proto_goTypes = []interface{}{
(*CPUusageResponse)(nil), // 7: portal.CPUusageResponse
(*FileReadRequest)(nil), // 8: portal.FileReadRequest
(*FileReadResponse)(nil), // 9: portal.FileReadResponse
(*SystemRebootRequest)(nil), // 10: portal.SystemRebootRequest
(*SystemRebootResponse)(nil), // 11: portal.SystemRebootResponse
(*SystemShutdownRequest)(nil), // 12: portal.SystemShutdownRequest
(*SystemShutdownResponse)(nil), // 13: portal.SystemShutdownResponse
(*FileCpRequest)(nil), // 10: portal.FileCpRequest
(*FileCpResponse)(nil), // 11: portal.FileCpResponse
(*SystemRebootRequest)(nil), // 12: portal.SystemRebootRequest
(*SystemRebootResponse)(nil), // 13: portal.SystemRebootResponse
(*SystemShutdownRequest)(nil), // 14: portal.SystemShutdownRequest
(*SystemShutdownResponse)(nil), // 15: portal.SystemShutdownResponse
}
var file_portal_portal_proto_depIdxs = []int32{
0, // 0: portal.CommandResponse.state:type_name -> portal.State
0, // 1: portal.ServiceResponse.state:type_name -> portal.State
0, // 2: portal.ServiceStatusResponse.state:type_name -> portal.State
0, // 3: portal.FileReadResponse.state:type_name -> portal.State
0, // 4: portal.SystemRebootResponse.state:type_name -> portal.State
0, // 5: portal.SystemShutdownResponse.state:type_name -> portal.State
3, // 6: portal.Portal.ServiceRestart:input_type -> portal.ServiceRequest
3, // 7: portal.Portal.ServiceStart:input_type -> portal.ServiceRequest
3, // 8: portal.Portal.ServiceStop:input_type -> portal.ServiceRequest
3, // 9: portal.Portal.ServiceStatus:input_type -> portal.ServiceRequest
1, // 10: portal.Portal.RunCommand:input_type -> portal.CommandRequest
6, // 11: portal.Portal.CPUusage:input_type -> portal.CPUusageRequest
8, // 12: portal.Portal.FileRead:input_type -> portal.FileReadRequest
10, // 13: portal.Portal.SystemReboot:input_type -> portal.SystemRebootRequest
12, // 14: portal.Portal.SystemShutdown:input_type -> portal.SystemShutdownRequest
4, // 15: portal.Portal.ServiceRestart:output_type -> portal.ServiceResponse
4, // 16: portal.Portal.ServiceStart:output_type -> portal.ServiceResponse
4, // 17: portal.Portal.ServiceStop:output_type -> portal.ServiceResponse
5, // 18: portal.Portal.ServiceStatus:output_type -> portal.ServiceStatusResponse
2, // 19: portal.Portal.RunCommand:output_type -> portal.CommandResponse
7, // 20: portal.Portal.CPUusage:output_type -> portal.CPUusageResponse
9, // 21: portal.Portal.FileRead:output_type -> portal.FileReadResponse
11, // 22: portal.Portal.SystemReboot:output_type -> portal.SystemRebootResponse
13, // 23: portal.Portal.SystemShutdown:output_type -> portal.SystemShutdownResponse
15, // [15:24] is the sub-list for method output_type
6, // [6:15] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
0, // 4: portal.FileCpResponse.state:type_name -> portal.State
0, // 5: portal.SystemRebootResponse.state:type_name -> portal.State
0, // 6: portal.SystemShutdownResponse.state:type_name -> portal.State
3, // 7: portal.Portal.ServiceRestart:input_type -> portal.ServiceRequest
3, // 8: portal.Portal.ServiceStart:input_type -> portal.ServiceRequest
3, // 9: portal.Portal.ServiceStop:input_type -> portal.ServiceRequest
3, // 10: portal.Portal.ServiceStatus:input_type -> portal.ServiceRequest
1, // 11: portal.Portal.RunCommand:input_type -> portal.CommandRequest
6, // 12: portal.Portal.CPUusage:input_type -> portal.CPUusageRequest
8, // 13: portal.Portal.FileRead:input_type -> portal.FileReadRequest
10, // 14: portal.Portal.FileCp:input_type -> portal.FileCpRequest
12, // 15: portal.Portal.SystemReboot:input_type -> portal.SystemRebootRequest
14, // 16: portal.Portal.SystemShutdown:input_type -> portal.SystemShutdownRequest
4, // 17: portal.Portal.ServiceRestart:output_type -> portal.ServiceResponse
4, // 18: portal.Portal.ServiceStart:output_type -> portal.ServiceResponse
4, // 19: portal.Portal.ServiceStop:output_type -> portal.ServiceResponse
5, // 20: portal.Portal.ServiceStatus:output_type -> portal.ServiceStatusResponse
2, // 21: portal.Portal.RunCommand:output_type -> portal.CommandResponse
7, // 22: portal.Portal.CPUusage:output_type -> portal.CPUusageResponse
9, // 23: portal.Portal.FileRead:output_type -> portal.FileReadResponse
11, // 24: portal.Portal.FileCp:output_type -> portal.FileCpResponse
13, // 25: portal.Portal.SystemReboot:output_type -> portal.SystemRebootResponse
15, // 26: portal.Portal.SystemShutdown:output_type -> portal.SystemShutdownResponse
17, // [17:27] is the sub-list for method output_type
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() }
@@ -1027,7 +1146,7 @@ func file_portal_portal_proto_init() {
}
}
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:
return &v.state
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{} {
switch v := v.(*SystemRebootResponse); i {
switch v := v.(*FileCpResponse); i {
case 0:
return &v.state
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{} {
switch v := v.(*SystemShutdownRequest); i {
switch v := v.(*SystemRebootRequest); i {
case 0:
return &v.state
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{} {
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 {
case 0:
return &v.state
@@ -1081,7 +1224,7 @@ func file_portal_portal_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_portal_portal_proto_rawDesc,
NumEnums: 1,
NumMessages: 13,
NumMessages: 15,
NumExtensions: 0,
NumServices: 1,
},

View File

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

View File

@@ -1,5 +1,5 @@
// 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
package portal
@@ -45,6 +45,7 @@ type DRPCPortalClient interface {
RunCommand(ctx context.Context, in *CommandRequest) (*CommandResponse, error)
CPUusage(ctx context.Context, in *CPUusageRequest) (*CPUusageResponse, 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)
SystemShutdown(ctx context.Context, in *SystemShutdownRequest) (*SystemShutdownResponse, error)
}
@@ -122,6 +123,15 @@ func (c *drpcPortalClient) FileRead(ctx context.Context, in *FileReadRequest) (*
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) {
out := new(SystemRebootResponse)
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)
CPUusage(context.Context, *CPUusageRequest) (*CPUusageResponse, error)
FileRead(context.Context, *FileReadRequest) (*FileReadResponse, error)
FileCp(context.Context, *FileCpRequest) (*FileCpResponse, error)
SystemReboot(context.Context, *SystemRebootRequest) (*SystemRebootResponse, 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)
}
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) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
@@ -192,7 +207,7 @@ func (s *DRPCPortalUnimplementedServer) SystemShutdown(context.Context, *SystemS
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) {
switch n {
@@ -260,6 +275,15 @@ func (DRPCPortalDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver
)
}, DRPCPortalServer.FileRead, true
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{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPortalServer).
@@ -268,7 +292,7 @@ func (DRPCPortalDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver
in1.(*SystemRebootRequest),
)
}, DRPCPortalServer.SystemReboot, true
case 8:
case 9:
return "/portal.Portal/SystemShutdown", drpcEncoding_File_portal_portal_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPortalServer).
@@ -398,6 +422,22 @@ func (x *drpcPortal_FileReadStream) SendAndClose(m *FileReadResponse) error {
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 {
drpc.Stream
SendAndClose(*SystemRebootResponse) error