add chmod

This commit is contained in:
2023-07-26 23:58:36 +02:00
parent c441281337
commit 496faa38b2
5 changed files with 401 additions and 116 deletions

View File

@@ -3,8 +3,10 @@ package cli
import (
"context"
"crypto/tls"
"errors"
"net"
"os"
"strconv"
"strings"
"time"
@@ -34,15 +36,24 @@ var readCmd = &cobra.Command{
var cpCmd = &cobra.Command{
Use: "cp <src> <dst>",
Short: "Copy a file",
Example: " speedrun file cp myfile /tmp/myfile",
Args: cobra.MinimumNArgs(1),
Example: " speedrun file cp myfile :/tmp/myfile\n speedrun file cp :/tmp/myfile myfile\n speedrun file cp :/tmp/myfile :/tmp/mynewfile",
Args: cobra.MinimumNArgs(2),
RunE: cp,
}
var chmodCmd = &cobra.Command{
Use: "chmod <path> <filemode>",
Short: "Chmod a file",
Example: " speedrun file chmod /tmp/myfile 0644",
Args: cobra.MinimumNArgs(2),
RunE: chmod,
}
func init() {
fileCmd.SetUsageTemplate(usage)
fileCmd.AddCommand(readCmd)
fileCmd.AddCommand(cpCmd)
fileCmd.AddCommand(chmodCmd)
}
func read(cmd *cobra.Command, args []string) error {
@@ -118,6 +129,10 @@ func cp(cmd *cobra.Command, args []string) error {
remoteSrc := strings.HasPrefix(args[0], ":")
remoteDst := strings.HasPrefix(args[1], ":")
if !remoteDst && !remoteSrc {
return errors.New("src and dst cannot be both local to your machine")
}
var content []byte
if !remoteSrc {
content, err = os.ReadFile(args[0])
@@ -155,14 +170,12 @@ func cp(cmd *cobra.Command, args []string) error {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()
var r *portalpb.FileCpResponse
r, err = c.FileCp(ctx, &portalpb.FileCpRequest{Src: strings.TrimPrefix(args[0], ":"), Dst: strings.TrimPrefix(args[1], ":"), Content: content, RemoteSrc: remoteSrc, RemoteDst: remoteDst})
r, err := c.FileCp(ctx, &portalpb.FileCpRequest{Src: strings.TrimPrefix(args[0], ":"), Dst: strings.TrimPrefix(args[1], ":"), Content: content, RemoteSrc: remoteSrc, RemoteDst: remoteDst})
if err != nil {
log.Error(err.Error())
return
}
if len(r.GetContent()) > 0 {
if !remoteDst {
err := os.WriteFile(args[1], r.GetContent(), 0644)
if err != nil {
log.Error(err.Error())
@@ -176,3 +189,63 @@ func cp(cmd *cobra.Command, args []string) error {
pool.StopAndWait()
return nil
}
func chmod(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
}
filemode, err := strconv.Atoi(args[1])
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.FileChmod(ctx, &portalpb.FileChmodRequest{Path: args[0], Filemode: uint32(filemode)})
if err != nil {
log.Error(err.Error())
return
}
log.WithField("state", r.GetState()).Infof("Done")
})
}
pool.StopAndWait()
return nil
}

View File

@@ -2,6 +2,7 @@ package portal
import (
"context"
"io/fs"
"os"
"github.com/apex/log"
@@ -64,3 +65,21 @@ func (s *Server) FileCp(ctx context.Context, file *portal.FileCpRequest) (*porta
}
return &portal.FileCpResponse{State: portal.State_UNKNOWN}, nil
}
func (s *Server) FileChmod(ctx context.Context, file *portal.FileChmodRequest) (*portal.FileChmodResponse, error) {
fields := log.Fields{
"context": "file",
"command": "read",
"name": file.GetPath(),
}
log := log.WithFields(fields)
log.Debug("Received file chmod request")
err := os.Chmod(file.GetPath(), fs.FileMode(file.GetFilemode()))
if err != nil {
log.Error(err.Error())
return nil, err
}
return &portal.FileChmodResponse{State: portal.State_UNKNOWN}, nil
}

View File

@@ -689,6 +689,108 @@ func (x *FileCpResponse) GetContent() []byte {
return nil
}
type FileChmodRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
Filemode uint32 `protobuf:"varint,2,opt,name=filemode,proto3" json:"filemode,omitempty"`
}
func (x *FileChmodRequest) Reset() {
*x = FileChmodRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_portal_portal_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FileChmodRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FileChmodRequest) ProtoMessage() {}
func (x *FileChmodRequest) ProtoReflect() protoreflect.Message {
mi := &file_portal_portal_proto_msgTypes[11]
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 FileChmodRequest.ProtoReflect.Descriptor instead.
func (*FileChmodRequest) Descriptor() ([]byte, []int) {
return file_portal_portal_proto_rawDescGZIP(), []int{11}
}
func (x *FileChmodRequest) GetPath() string {
if x != nil {
return x.Path
}
return ""
}
func (x *FileChmodRequest) GetFilemode() uint32 {
if x != nil {
return x.Filemode
}
return 0
}
type FileChmodResponse 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 *FileChmodResponse) Reset() {
*x = FileChmodResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_portal_portal_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FileChmodResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FileChmodResponse) ProtoMessage() {}
func (x *FileChmodResponse) ProtoReflect() protoreflect.Message {
mi := &file_portal_portal_proto_msgTypes[12]
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 FileChmodResponse.ProtoReflect.Descriptor instead.
func (*FileChmodResponse) Descriptor() ([]byte, []int) {
return file_portal_portal_proto_rawDescGZIP(), []int{12}
}
func (x *FileChmodResponse) GetState() State {
if x != nil {
return x.State
}
return State_UNKNOWN
}
type SystemRebootRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -698,7 +800,7 @@ type SystemRebootRequest struct {
func (x *SystemRebootRequest) Reset() {
*x = SystemRebootRequest{}
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)
}
@@ -711,7 +813,7 @@ func (x *SystemRebootRequest) String() string {
func (*SystemRebootRequest) ProtoMessage() {}
func (x *SystemRebootRequest) 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 {
@@ -724,7 +826,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{11}
return file_portal_portal_proto_rawDescGZIP(), []int{13}
}
type SystemRebootResponse struct {
@@ -739,7 +841,7 @@ type SystemRebootResponse struct {
func (x *SystemRebootResponse) Reset() {
*x = SystemRebootResponse{}
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)
}
@@ -752,7 +854,7 @@ func (x *SystemRebootResponse) String() string {
func (*SystemRebootResponse) ProtoMessage() {}
func (x *SystemRebootResponse) 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 {
@@ -765,7 +867,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{12}
return file_portal_portal_proto_rawDescGZIP(), []int{14}
}
func (x *SystemRebootResponse) GetState() State {
@@ -791,7 +893,7 @@ type SystemShutdownRequest struct {
func (x *SystemShutdownRequest) Reset() {
*x = SystemShutdownRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_portal_portal_proto_msgTypes[13]
mi := &file_portal_portal_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -804,7 +906,7 @@ func (x *SystemShutdownRequest) String() string {
func (*SystemShutdownRequest) ProtoMessage() {}
func (x *SystemShutdownRequest) ProtoReflect() protoreflect.Message {
mi := &file_portal_portal_proto_msgTypes[13]
mi := &file_portal_portal_proto_msgTypes[15]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -817,7 +919,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{13}
return file_portal_portal_proto_rawDescGZIP(), []int{15}
}
type SystemShutdownResponse struct {
@@ -832,7 +934,7 @@ type SystemShutdownResponse struct {
func (x *SystemShutdownResponse) Reset() {
*x = SystemShutdownResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_portal_portal_proto_msgTypes[14]
mi := &file_portal_portal_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -845,7 +947,7 @@ func (x *SystemShutdownResponse) String() string {
func (*SystemShutdownResponse) ProtoMessage() {}
func (x *SystemShutdownResponse) ProtoReflect() protoreflect.Message {
mi := &file_portal_portal_proto_msgTypes[14]
mi := &file_portal_portal_proto_msgTypes[16]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -858,7 +960,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{14}
return file_portal_portal_proto_rawDescGZIP(), []int{16}
}
func (x *SystemShutdownResponse) GetState() State {
@@ -935,71 +1037,83 @@ var file_portal_portal_proto_rawDesc = []byte{
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, 0x0c, 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,
0x22, 0x42, 0x0a, 0x10, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x6d, 0x6f, 0x64, 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, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65,
0x6d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65,
0x6d, 0x6f, 0x64, 0x65, 0x22, 0x38, 0x0a, 0x11, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x6d, 0x6f,
0x64, 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, 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, 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,
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, 0xfe, 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, 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, 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, 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,
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, 0x42, 0x0a,
0x09, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x6d, 0x6f, 0x64, 0x12, 0x18, 0x2e, 0x70, 0x6f, 0x72,
0x74, 0x61, 0x6c, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x6d, 0x6f, 0x64, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x46, 0x69,
0x6c, 0x65, 0x43, 0x68, 0x6d, 0x6f, 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, 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,
}
var (
@@ -1015,7 +1129,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, 15)
var file_portal_portal_proto_msgTypes = make([]protoimpl.MessageInfo, 17)
var file_portal_portal_proto_goTypes = []interface{}{
(State)(0), // 0: portal.State
(*CommandRequest)(nil), // 1: portal.CommandRequest
@@ -1029,10 +1143,12 @@ var file_portal_portal_proto_goTypes = []interface{}{
(*FileReadResponse)(nil), // 9: portal.FileReadResponse
(*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
(*FileChmodRequest)(nil), // 12: portal.FileChmodRequest
(*FileChmodResponse)(nil), // 13: portal.FileChmodResponse
(*SystemRebootRequest)(nil), // 14: portal.SystemRebootRequest
(*SystemRebootResponse)(nil), // 15: portal.SystemRebootResponse
(*SystemShutdownRequest)(nil), // 16: portal.SystemShutdownRequest
(*SystemShutdownResponse)(nil), // 17: portal.SystemShutdownResponse
}
var file_portal_portal_proto_depIdxs = []int32{
0, // 0: portal.CommandResponse.state:type_name -> portal.State
@@ -1040,33 +1156,36 @@ var file_portal_portal_proto_depIdxs = []int32{
0, // 2: portal.ServiceStatusResponse.state:type_name -> portal.State
0, // 3: portal.FileReadResponse.state:type_name -> portal.State
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
0, // 5: portal.FileChmodResponse.state:type_name -> portal.State
0, // 6: portal.SystemRebootResponse.state:type_name -> portal.State
0, // 7: portal.SystemShutdownResponse.state:type_name -> portal.State
3, // 8: portal.Portal.ServiceRestart:input_type -> portal.ServiceRequest
3, // 9: portal.Portal.ServiceStart:input_type -> portal.ServiceRequest
3, // 10: portal.Portal.ServiceStop:input_type -> portal.ServiceRequest
3, // 11: portal.Portal.ServiceStatus:input_type -> portal.ServiceRequest
1, // 12: portal.Portal.RunCommand:input_type -> portal.CommandRequest
6, // 13: portal.Portal.CPUusage:input_type -> portal.CPUusageRequest
8, // 14: portal.Portal.FileRead:input_type -> portal.FileReadRequest
10, // 15: portal.Portal.FileCp:input_type -> portal.FileCpRequest
12, // 16: portal.Portal.FileChmod:input_type -> portal.FileChmodRequest
14, // 17: portal.Portal.SystemReboot:input_type -> portal.SystemRebootRequest
16, // 18: portal.Portal.SystemShutdown:input_type -> portal.SystemShutdownRequest
4, // 19: portal.Portal.ServiceRestart:output_type -> portal.ServiceResponse
4, // 20: portal.Portal.ServiceStart:output_type -> portal.ServiceResponse
4, // 21: portal.Portal.ServiceStop:output_type -> portal.ServiceResponse
5, // 22: portal.Portal.ServiceStatus:output_type -> portal.ServiceStatusResponse
2, // 23: portal.Portal.RunCommand:output_type -> portal.CommandResponse
7, // 24: portal.Portal.CPUusage:output_type -> portal.CPUusageResponse
9, // 25: portal.Portal.FileRead:output_type -> portal.FileReadResponse
11, // 26: portal.Portal.FileCp:output_type -> portal.FileCpResponse
13, // 27: portal.Portal.FileChmod:output_type -> portal.FileChmodResponse
15, // 28: portal.Portal.SystemReboot:output_type -> portal.SystemRebootResponse
17, // 29: portal.Portal.SystemShutdown:output_type -> portal.SystemShutdownResponse
19, // [19:30] is the sub-list for method output_type
8, // [8:19] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
}
func init() { file_portal_portal_proto_init() }
@@ -1208,7 +1327,7 @@ func file_portal_portal_proto_init() {
}
}
file_portal_portal_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SystemRebootRequest); i {
switch v := v.(*FileChmodRequest); i {
case 0:
return &v.state
case 1:
@@ -1220,7 +1339,7 @@ func file_portal_portal_proto_init() {
}
}
file_portal_portal_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SystemRebootResponse); i {
switch v := v.(*FileChmodResponse); i {
case 0:
return &v.state
case 1:
@@ -1232,7 +1351,7 @@ func file_portal_portal_proto_init() {
}
}
file_portal_portal_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SystemShutdownRequest); i {
switch v := v.(*SystemRebootRequest); i {
case 0:
return &v.state
case 1:
@@ -1244,6 +1363,30 @@ func file_portal_portal_proto_init() {
}
}
file_portal_portal_proto_msgTypes[14].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[15].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[16].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SystemShutdownResponse); i {
case 0:
return &v.state
@@ -1262,7 +1405,7 @@ func file_portal_portal_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_portal_portal_proto_rawDesc,
NumEnums: 1,
NumMessages: 15,
NumMessages: 17,
NumExtensions: 0,
NumServices: 1,
},

View File

@@ -64,6 +64,15 @@ message FileCpResponse {
bytes content = 2;
}
message FileChmodRequest {
string path = 1;
uint32 filemode = 2;
}
message FileChmodResponse {
State state = 1;
}
message SystemRebootRequest {}
message SystemRebootResponse {
@@ -87,6 +96,7 @@ service Portal {
rpc CPUusage(CPUusageRequest) returns (CPUusageResponse) {}
rpc FileRead(FileReadRequest) returns (FileReadResponse) {}
rpc FileCp(FileCpRequest) returns (FileCpResponse) {}
rpc FileChmod(FileChmodRequest) returns (FileChmodResponse) {}
rpc SystemReboot(SystemRebootRequest) returns (SystemRebootResponse) {}
rpc SystemShutdown(SystemShutdownRequest) returns (SystemShutdownResponse) {}
// --target group1 --target group2

View File

@@ -46,6 +46,7 @@ type DRPCPortalClient interface {
CPUusage(ctx context.Context, in *CPUusageRequest) (*CPUusageResponse, error)
FileRead(ctx context.Context, in *FileReadRequest) (*FileReadResponse, error)
FileCp(ctx context.Context, in *FileCpRequest) (*FileCpResponse, error)
FileChmod(ctx context.Context, in *FileChmodRequest) (*FileChmodResponse, error)
SystemReboot(ctx context.Context, in *SystemRebootRequest) (*SystemRebootResponse, error)
SystemShutdown(ctx context.Context, in *SystemShutdownRequest) (*SystemShutdownResponse, error)
}
@@ -132,6 +133,15 @@ func (c *drpcPortalClient) FileCp(ctx context.Context, in *FileCpRequest) (*File
return out, nil
}
func (c *drpcPortalClient) FileChmod(ctx context.Context, in *FileChmodRequest) (*FileChmodResponse, error) {
out := new(FileChmodResponse)
err := c.cc.Invoke(ctx, "/portal.Portal/FileChmod", 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)
@@ -159,6 +169,7 @@ type DRPCPortalServer interface {
CPUusage(context.Context, *CPUusageRequest) (*CPUusageResponse, error)
FileRead(context.Context, *FileReadRequest) (*FileReadResponse, error)
FileCp(context.Context, *FileCpRequest) (*FileCpResponse, error)
FileChmod(context.Context, *FileChmodRequest) (*FileChmodResponse, error)
SystemReboot(context.Context, *SystemRebootRequest) (*SystemRebootResponse, error)
SystemShutdown(context.Context, *SystemShutdownRequest) (*SystemShutdownResponse, error)
}
@@ -197,6 +208,10 @@ func (s *DRPCPortalUnimplementedServer) FileCp(context.Context, *FileCpRequest)
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
func (s *DRPCPortalUnimplementedServer) FileChmod(context.Context, *FileChmodRequest) (*FileChmodResponse, 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)
}
@@ -207,7 +222,7 @@ func (s *DRPCPortalUnimplementedServer) SystemShutdown(context.Context, *SystemS
type DRPCPortalDescription struct{}
func (DRPCPortalDescription) NumMethods() int { return 10 }
func (DRPCPortalDescription) NumMethods() int { return 11 }
func (DRPCPortalDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
switch n {
@@ -284,6 +299,15 @@ func (DRPCPortalDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver
)
}, DRPCPortalServer.FileCp, true
case 8:
return "/portal.Portal/FileChmod", drpcEncoding_File_portal_portal_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPortalServer).
FileChmod(
ctx,
in1.(*FileChmodRequest),
)
}, DRPCPortalServer.FileChmod, true
case 9:
return "/portal.Portal/SystemReboot", drpcEncoding_File_portal_portal_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPortalServer).
@@ -292,7 +316,7 @@ func (DRPCPortalDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver
in1.(*SystemRebootRequest),
)
}, DRPCPortalServer.SystemReboot, true
case 9:
case 10:
return "/portal.Portal/SystemShutdown", drpcEncoding_File_portal_portal_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCPortalServer).
@@ -438,6 +462,22 @@ func (x *drpcPortal_FileCpStream) SendAndClose(m *FileCpResponse) error {
return x.CloseSend()
}
type DRPCPortal_FileChmodStream interface {
drpc.Stream
SendAndClose(*FileChmodResponse) error
}
type drpcPortal_FileChmodStream struct {
drpc.Stream
}
func (x *drpcPortal_FileChmodStream) SendAndClose(m *FileChmodResponse) 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