From 0e4ff9965ef58be4baf0859fdde32bd65db5a912 Mon Sep 17 00:00:00 2001 From: vadvolo Date: Fri, 22 May 2026 13:49:52 +0200 Subject: [PATCH 1/3] telnet: adding telnet streamer support --- docs/streamer_types.md | 75 +++ go.mod | 3 +- go.sum | 1 + grpc_sdk/python/gnetclisdk/client.py | 2 + pkg/server/proto/server.pb.go | 902 ++++++++++---------------- pkg/server/proto/server.proto | 6 + pkg/server/proto/server_grpc.pb.go | 43 +- pkg/server/server.go | 136 +++- pkg/server/server_integration_test.go | 202 ++++++ pkg/streamer/telnet/telnet.go | 12 +- 10 files changed, 773 insertions(+), 609 deletions(-) create mode 100644 docs/streamer_types.md diff --git a/docs/streamer_types.md b/docs/streamer_types.md new file mode 100644 index 00000000..f13b923f --- /dev/null +++ b/docs/streamer_types.md @@ -0,0 +1,75 @@ +# Streamer Types + +`gnetcli` supports different connection types (streamers) for connecting to network equipment: SSH, Telnet. + +## Supported Types + +### SSH (StreamerType_ssh) +- **Value**: `0` +- **Description**: Connection via SSH protocol (default) +- **Default port**: 22 +- **Features**: + - SSH tunnel support (ProxyJump) + - SSH Control Files support + - SSH Agent support + - Private key authentication + - SFTP for file transfers + +### Telnet (StreamerType_telnet) +- **Value**: `1` +- **Description**: Connection via Telnet protocol +- **Default port**: 23 +- **Features**: + - Plain text connection + - Username/password authentication + - Custom port support + +## API Usage + +### Via gRPC +The streamer type is specified in host parameters: + +```protobuf +message HostParams { + string host = 1; + Credentials credentials = 2; + int32 port = 3; + string device = 4; + string ip = 5; + StreamerType streamer_type = 6; // SSH or Telnet +} +``` + +### Example Request +```json +{ + "host": "192.168.1.1", + "cmd": "show version", + "host_params": { + "streamer_type": 1, // Use Telnet + "port": 23, + "credentials": { + "login": "admin", + "password": "password" + } + } +} +``` + +## Choosing Streamer Type + +### SSH is recommended for: +- Modern network equipment +- Production environments where security is important +- Devices supporting cryptographic authentication +- Cases requiring file transfers + +### Telnet is suitable for: +- Legacy equipment without SSH support +- Lab and test environments +- Devices with limited computational resources +- Connection debugging and diagnostics + +## Default Configuration + +If `streamer_type` is not explicitly specified, SSH is used as the more secure default option. diff --git a/go.mod b/go.mod index 23edf855..b0461a3a 100644 --- a/go.mod +++ b/go.mod @@ -15,8 +15,8 @@ require ( go.uber.org/zap v1.26.0 golang.org/x/crypto v0.14.0 golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 - golang.org/x/net v0.16.0 golang.org/x/sync v0.4.0 + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 google.golang.org/grpc v1.58.2 @@ -30,6 +30,7 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/kr/fs v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/net v0.16.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 // indirect diff --git a/go.sum b/go.sum index cfb5301d..982807d2 100644 --- a/go.sum +++ b/go.sum @@ -161,6 +161,7 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= diff --git a/grpc_sdk/python/gnetclisdk/client.py b/grpc_sdk/python/gnetclisdk/client.py index 4882100f..ff79703d 100644 --- a/grpc_sdk/python/gnetclisdk/client.py +++ b/grpc_sdk/python/gnetclisdk/client.py @@ -72,6 +72,7 @@ class HostParams: hostname: Optional[str] = None credentials: Optional[Credentials] = None ip: Optional[str] = None + streamer_type: Optional[server_pb2.StreamerType] = None def make_pb(self) -> server_pb2.HostParams: creds_pb: Optional[server_pb2.Credentials] = None @@ -83,6 +84,7 @@ def make_pb(self) -> server_pb2.HostParams: credentials=creds_pb, device=self.device, ip=self.ip, + streamer_type=self.streamer_type if self.streamer_type is not None else server_pb2.StreamerType.StreamerType_ssh, ) return pbcmd diff --git a/pkg/server/proto/server.pb.go b/pkg/server/proto/server.pb.go index 6176636f..e67cc646 100644 --- a/pkg/server/proto/server.pb.go +++ b/pkg/server/proto/server.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.17.3 +// protoc-gen-go v1.36.10 +// protoc v6.33.1 // source: server.proto package gnetcli @@ -13,6 +13,7 @@ import ( emptypb "google.golang.org/protobuf/types/known/emptypb" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -123,6 +124,52 @@ func (DeviceResultStatus) EnumDescriptor() ([]byte, []int) { return file_server_proto_rawDescGZIP(), []int{1} } +type StreamerType int32 + +const ( + StreamerType_StreamerType_ssh StreamerType = 0 + StreamerType_StreamerType_telnet StreamerType = 1 +) + +// Enum value maps for StreamerType. +var ( + StreamerType_name = map[int32]string{ + 0: "StreamerType_ssh", + 1: "StreamerType_telnet", + } + StreamerType_value = map[string]int32{ + "StreamerType_ssh": 0, + "StreamerType_telnet": 1, + } +) + +func (x StreamerType) Enum() *StreamerType { + p := new(StreamerType) + *p = x + return p +} + +func (x StreamerType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (StreamerType) Descriptor() protoreflect.EnumDescriptor { + return file_server_proto_enumTypes[2].Descriptor() +} + +func (StreamerType) Type() protoreflect.EnumType { + return &file_server_proto_enumTypes[2] +} + +func (x StreamerType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use StreamerType.Descriptor instead. +func (StreamerType) EnumDescriptor() ([]byte, []int) { + return file_server_proto_rawDescGZIP(), []int{2} +} + type FileStatus int32 const ( @@ -162,11 +209,11 @@ func (x FileStatus) String() string { } func (FileStatus) Descriptor() protoreflect.EnumDescriptor { - return file_server_proto_enumTypes[2].Descriptor() + return file_server_proto_enumTypes[3].Descriptor() } func (FileStatus) Type() protoreflect.EnumType { - return &file_server_proto_enumTypes[2] + return &file_server_proto_enumTypes[3] } func (x FileStatus) Number() protoreflect.EnumNumber { @@ -175,26 +222,23 @@ func (x FileStatus) Number() protoreflect.EnumNumber { // Deprecated: Use FileStatus.Descriptor instead. func (FileStatus) EnumDescriptor() ([]byte, []int) { - return file_server_proto_rawDescGZIP(), []int{2} + return file_server_proto_rawDescGZIP(), []int{3} } type QA struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Question string `protobuf:"bytes,1,opt,name=question,proto3" json:"question,omitempty"` + Answer string `protobuf:"bytes,2,opt,name=answer,proto3" json:"answer,omitempty"` + NotSendNl bool `protobuf:"varint,3,opt,name=not_send_nl,json=notSendNl,proto3" json:"not_send_nl,omitempty"` unknownFields protoimpl.UnknownFields - - Question string `protobuf:"bytes,1,opt,name=question,proto3" json:"question,omitempty"` - Answer string `protobuf:"bytes,2,opt,name=answer,proto3" json:"answer,omitempty"` - NotSendNl bool `protobuf:"varint,3,opt,name=not_send_nl,json=notSendNl,proto3" json:"not_send_nl,omitempty"` + sizeCache protoimpl.SizeCache } func (x *QA) Reset() { *x = QA{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *QA) String() string { @@ -205,7 +249,7 @@ func (*QA) ProtoMessage() {} func (x *QA) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -242,21 +286,18 @@ func (x *QA) GetNotSendNl() bool { } type Credentials struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Login string `protobuf:"bytes,1,opt,name=login,proto3" json:"login,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` unknownFields protoimpl.UnknownFields - - Login string `protobuf:"bytes,1,opt,name=login,proto3" json:"login,omitempty"` - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Credentials) Reset() { *x = Credentials{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Credentials) String() string { @@ -267,7 +308,7 @@ func (*Credentials) ProtoMessage() {} func (x *Credentials) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -297,27 +338,24 @@ func (x *Credentials) GetPassword() string { } type CMD struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + Cmd string `protobuf:"bytes,2,opt,name=cmd,proto3" json:"cmd,omitempty"` + Trace bool `protobuf:"varint,3,opt,name=trace,proto3" json:"trace,omitempty"` + Qa []*QA `protobuf:"bytes,4,rep,name=qa,proto3" json:"qa,omitempty"` + ReadTimeout float64 `protobuf:"fixed64,5,opt,name=read_timeout,json=readTimeout,proto3" json:"read_timeout,omitempty"` + CmdTimeout float64 `protobuf:"fixed64,6,opt,name=cmd_timeout,json=cmdTimeout,proto3" json:"cmd_timeout,omitempty"` + StringResult bool `protobuf:"varint,8,opt,name=string_result,json=stringResult,proto3" json:"string_result,omitempty"` + HostParams *HostParams `protobuf:"bytes,9,opt,name=host_params,json=hostParams,proto3" json:"host_params,omitempty"` unknownFields protoimpl.UnknownFields - - Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` - Cmd string `protobuf:"bytes,2,opt,name=cmd,proto3" json:"cmd,omitempty"` - Trace bool `protobuf:"varint,3,opt,name=trace,proto3" json:"trace,omitempty"` - Qa []*QA `protobuf:"bytes,4,rep,name=qa,proto3" json:"qa,omitempty"` - ReadTimeout float64 `protobuf:"fixed64,5,opt,name=read_timeout,json=readTimeout,proto3" json:"read_timeout,omitempty"` - CmdTimeout float64 `protobuf:"fixed64,6,opt,name=cmd_timeout,json=cmdTimeout,proto3" json:"cmd_timeout,omitempty"` - StringResult bool `protobuf:"varint,8,opt,name=string_result,json=stringResult,proto3" json:"string_result,omitempty"` - HostParams *HostParams `protobuf:"bytes,9,opt,name=host_params,json=hostParams,proto3" json:"host_params,omitempty"` + sizeCache protoimpl.SizeCache } func (x *CMD) Reset() { *x = CMD{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CMD) String() string { @@ -328,7 +366,7 @@ func (*CMD) ProtoMessage() {} func (x *CMD) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -400,23 +438,20 @@ func (x *CMD) GetHostParams() *HostParams { } type Device struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - PromptExpression string `protobuf:"bytes,2,opt,name=prompt_expression,json=promptExpression,proto3" json:"prompt_expression,omitempty"` - ErrorExpression string `protobuf:"bytes,3,opt,name=error_expression,json=errorExpression,proto3" json:"error_expression,omitempty"` - PagerExpression string `protobuf:"bytes,4,opt,name=pager_expression,json=pagerExpression,proto3" json:"pager_expression,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + PromptExpression string `protobuf:"bytes,2,opt,name=prompt_expression,json=promptExpression,proto3" json:"prompt_expression,omitempty"` + ErrorExpression string `protobuf:"bytes,3,opt,name=error_expression,json=errorExpression,proto3" json:"error_expression,omitempty"` + PagerExpression string `protobuf:"bytes,4,opt,name=pager_expression,json=pagerExpression,proto3" json:"pager_expression,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Device) Reset() { *x = Device{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Device) String() string { @@ -427,7 +462,7 @@ func (*Device) ProtoMessage() {} func (x *Device) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -471,24 +506,21 @@ func (x *Device) GetPagerExpression() string { } type CMDNetconf struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + Cmd string `protobuf:"bytes,2,opt,name=cmd,proto3" json:"cmd,omitempty"` + Json bool `protobuf:"varint,3,opt,name=json,proto3" json:"json,omitempty"` + ReadTimeout float64 `protobuf:"fixed64,4,opt,name=read_timeout,json=readTimeout,proto3" json:"read_timeout,omitempty"` // read timeout in seconds + CmdTimeout float64 `protobuf:"fixed64,5,opt,name=cmd_timeout,json=cmdTimeout,proto3" json:"cmd_timeout,omitempty"` // command execution timeout in seconds unknownFields protoimpl.UnknownFields - - Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` - Cmd string `protobuf:"bytes,2,opt,name=cmd,proto3" json:"cmd,omitempty"` - Json bool `protobuf:"varint,3,opt,name=json,proto3" json:"json,omitempty"` - ReadTimeout float64 `protobuf:"fixed64,4,opt,name=read_timeout,json=readTimeout,proto3" json:"read_timeout,omitempty"` // read timeout in seconds - CmdTimeout float64 `protobuf:"fixed64,5,opt,name=cmd_timeout,json=cmdTimeout,proto3" json:"cmd_timeout,omitempty"` // command execution timeout in seconds + sizeCache protoimpl.SizeCache } func (x *CMDNetconf) Reset() { *x = CMDNetconf{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CMDNetconf) String() string { @@ -499,7 +531,7 @@ func (*CMDNetconf) ProtoMessage() {} func (x *CMDNetconf) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -550,21 +582,18 @@ func (x *CMDNetconf) GetCmdTimeout() float64 { } type CMDTraceItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Operation TraceOperation `protobuf:"varint,1,opt,name=operation,proto3,enum=gnetcli.TraceOperation" json:"operation,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` unknownFields protoimpl.UnknownFields - - Operation TraceOperation `protobuf:"varint,1,opt,name=operation,proto3,enum=gnetcli.TraceOperation" json:"operation,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + sizeCache protoimpl.SizeCache } func (x *CMDTraceItem) Reset() { *x = CMDTraceItem{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CMDTraceItem) String() string { @@ -575,7 +604,7 @@ func (*CMDTraceItem) ProtoMessage() {} func (x *CMDTraceItem) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -605,24 +634,22 @@ func (x *CMDTraceItem) GetData() []byte { } type HostParams struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + Credentials *Credentials `protobuf:"bytes,2,opt,name=credentials,proto3" json:"credentials,omitempty"` + Port int32 `protobuf:"varint,3,opt,name=port,proto3" json:"port,omitempty"` + Device string `protobuf:"bytes,4,opt,name=device,proto3" json:"device,omitempty"` + Ip string `protobuf:"bytes,5,opt,name=ip,proto3" json:"ip,omitempty"` + StreamerType StreamerType `protobuf:"varint,6,opt,name=streamer_type,json=streamerType,proto3,enum=gnetcli.StreamerType" json:"streamer_type,omitempty"` unknownFields protoimpl.UnknownFields - - Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` - Credentials *Credentials `protobuf:"bytes,2,opt,name=credentials,proto3" json:"credentials,omitempty"` - Port int32 `protobuf:"varint,3,opt,name=port,proto3" json:"port,omitempty"` - Device string `protobuf:"bytes,4,opt,name=device,proto3" json:"device,omitempty"` - Ip string `protobuf:"bytes,5,opt,name=ip,proto3" json:"ip,omitempty"` + sizeCache protoimpl.SizeCache } func (x *HostParams) Reset() { *x = HostParams{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *HostParams) String() string { @@ -633,7 +660,7 @@ func (*HostParams) ProtoMessage() {} func (x *HostParams) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -683,26 +710,30 @@ func (x *HostParams) GetIp() string { return "" } +func (x *HostParams) GetStreamerType() StreamerType { + if x != nil { + return x.StreamerType + } + return StreamerType_StreamerType_ssh +} + type CMDResult struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Out []byte `protobuf:"bytes,1,opt,name=out,proto3" json:"out,omitempty"` + OutStr string `protobuf:"bytes,2,opt,name=out_str,json=outStr,proto3" json:"out_str,omitempty"` + Error []byte `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` + ErrorStr string `protobuf:"bytes,4,opt,name=error_str,json=errorStr,proto3" json:"error_str,omitempty"` + Trace []*CMDTraceItem `protobuf:"bytes,5,rep,name=trace,proto3" json:"trace,omitempty"` + Status int32 `protobuf:"varint,6,opt,name=status,proto3" json:"status,omitempty"` unknownFields protoimpl.UnknownFields - - Out []byte `protobuf:"bytes,1,opt,name=out,proto3" json:"out,omitempty"` - OutStr string `protobuf:"bytes,2,opt,name=out_str,json=outStr,proto3" json:"out_str,omitempty"` - Error []byte `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` - ErrorStr string `protobuf:"bytes,4,opt,name=error_str,json=errorStr,proto3" json:"error_str,omitempty"` - Trace []*CMDTraceItem `protobuf:"bytes,5,rep,name=trace,proto3" json:"trace,omitempty"` - Status int32 `protobuf:"varint,6,opt,name=status,proto3" json:"status,omitempty"` + sizeCache protoimpl.SizeCache } func (x *CMDResult) Reset() { *x = CMDResult{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CMDResult) String() string { @@ -713,7 +744,7 @@ func (*CMDResult) ProtoMessage() {} func (x *CMDResult) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -771,21 +802,18 @@ func (x *CMDResult) GetStatus() int32 { } type DeviceResult struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Res DeviceResultStatus `protobuf:"varint,1,opt,name=res,proto3,enum=gnetcli.DeviceResultStatus" json:"res,omitempty"` + Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` unknownFields protoimpl.UnknownFields - - Res DeviceResultStatus `protobuf:"varint,1,opt,name=res,proto3,enum=gnetcli.DeviceResultStatus" json:"res,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` + sizeCache protoimpl.SizeCache } func (x *DeviceResult) Reset() { *x = DeviceResult{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeviceResult) String() string { @@ -796,7 +824,7 @@ func (*DeviceResult) ProtoMessage() {} func (x *DeviceResult) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -826,23 +854,20 @@ func (x *DeviceResult) GetError() string { } type FileDownloadRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + Paths []string `protobuf:"bytes,2,rep,name=paths,proto3" json:"paths,omitempty"` + Device string `protobuf:"bytes,3,opt,name=device,proto3" json:"device,omitempty"` + HostParams *HostParams `protobuf:"bytes,5,opt,name=host_params,json=hostParams,proto3" json:"host_params,omitempty"` unknownFields protoimpl.UnknownFields - - Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` - Paths []string `protobuf:"bytes,2,rep,name=paths,proto3" json:"paths,omitempty"` - Device string `protobuf:"bytes,3,opt,name=device,proto3" json:"device,omitempty"` - HostParams *HostParams `protobuf:"bytes,5,opt,name=host_params,json=hostParams,proto3" json:"host_params,omitempty"` + sizeCache protoimpl.SizeCache } func (x *FileDownloadRequest) Reset() { *x = FileDownloadRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FileDownloadRequest) String() string { @@ -853,7 +878,7 @@ func (*FileDownloadRequest) ProtoMessage() {} func (x *FileDownloadRequest) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -897,22 +922,19 @@ func (x *FileDownloadRequest) GetHostParams() *HostParams { } type FileData struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + Status FileStatus `protobuf:"varint,3,opt,name=status,proto3,enum=gnetcli.FileStatus" json:"status,omitempty"` unknownFields protoimpl.UnknownFields - - Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` - Status FileStatus `protobuf:"varint,3,opt,name=status,proto3,enum=gnetcli.FileStatus" json:"status,omitempty"` + sizeCache protoimpl.SizeCache } func (x *FileData) Reset() { *x = FileData{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FileData) String() string { @@ -923,7 +945,7 @@ func (*FileData) ProtoMessage() {} func (x *FileData) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -960,23 +982,20 @@ func (x *FileData) GetStatus() FileStatus { } type FileUploadRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + Device string `protobuf:"bytes,4,opt,name=device,proto3" json:"device,omitempty"` + Files []*FileData `protobuf:"bytes,3,rep,name=files,proto3" json:"files,omitempty"` + HostParams *HostParams `protobuf:"bytes,6,opt,name=host_params,json=hostParams,proto3" json:"host_params,omitempty"` unknownFields protoimpl.UnknownFields - - Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` - Device string `protobuf:"bytes,4,opt,name=device,proto3" json:"device,omitempty"` - Files []*FileData `protobuf:"bytes,3,rep,name=files,proto3" json:"files,omitempty"` - HostParams *HostParams `protobuf:"bytes,6,opt,name=host_params,json=hostParams,proto3" json:"host_params,omitempty"` + sizeCache protoimpl.SizeCache } func (x *FileUploadRequest) Reset() { *x = FileUploadRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FileUploadRequest) String() string { @@ -987,7 +1006,7 @@ func (*FileUploadRequest) ProtoMessage() {} func (x *FileUploadRequest) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1031,20 +1050,17 @@ func (x *FileUploadRequest) GetHostParams() *HostParams { } type FilesResult struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Files []*FileData `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"` unknownFields protoimpl.UnknownFields - - Files []*FileData `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"` + sizeCache protoimpl.SizeCache } func (x *FilesResult) Reset() { *x = FilesResult{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FilesResult) String() string { @@ -1055,7 +1071,7 @@ func (*FilesResult) ProtoMessage() {} func (x *FilesResult) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1079,249 +1095,176 @@ func (x *FilesResult) GetFiles() []*FileData { var File_server_proto protoreflect.FileDescriptor -var file_server_proto_rawDesc = []byte{ - 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, - 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x58, 0x0a, 0x02, 0x51, 0x41, 0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0b, - 0x6e, 0x6f, 0x74, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x6e, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x09, 0x6e, 0x6f, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4e, 0x6c, 0x22, 0x3f, 0x0a, 0x0b, - 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, - 0x6f, 0x67, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x6f, 0x67, 0x69, - 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0xfd, 0x01, - 0x0a, 0x03, 0x43, 0x4d, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, - 0x72, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x74, 0x72, 0x61, 0x63, - 0x65, 0x12, 0x1b, 0x0a, 0x02, 0x71, 0x61, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, - 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x51, 0x41, 0x52, 0x02, 0x71, 0x61, 0x12, 0x21, - 0x0a, 0x0c, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x72, 0x65, 0x61, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, - 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6d, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x63, 0x6d, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x6f, - 0x75, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x34, 0x0a, 0x0b, 0x68, 0x6f, 0x73, 0x74, 0x5f, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x67, - 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x52, 0x0a, 0x68, 0x6f, 0x73, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x9f, 0x01, - 0x0a, 0x06, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x11, - 0x70, 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x45, - 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x72, 0x72, - 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x70, 0x61, 0x67, 0x65, 0x72, 0x5f, 0x65, 0x78, - 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, - 0x70, 0x61, 0x67, 0x65, 0x72, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, - 0x8a, 0x01, 0x0a, 0x0a, 0x43, 0x4d, 0x44, 0x4e, 0x65, 0x74, 0x63, 0x6f, 0x6e, 0x66, 0x12, 0x12, - 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, - 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x63, 0x6d, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6a, 0x73, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x04, 0x6a, 0x73, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x61, 0x64, - 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, - 0x72, 0x65, 0x61, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x63, - 0x6d, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x0a, 0x63, 0x6d, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x59, 0x0a, 0x0c, - 0x43, 0x4d, 0x44, 0x54, 0x72, 0x61, 0x63, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x35, 0x0a, 0x09, - 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x17, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x4f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x94, 0x01, 0x0a, 0x0a, 0x48, 0x6f, 0x73, 0x74, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x0b, 0x63, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x73, 0x52, 0x0b, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, - 0x6c, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x22, 0xae, - 0x01, 0x0a, 0x09, 0x43, 0x4d, 0x44, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x10, 0x0a, 0x03, - 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6f, 0x75, 0x74, 0x12, 0x17, - 0x0a, 0x07, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x6f, 0x75, 0x74, 0x53, 0x74, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x1b, 0x0a, - 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x53, 0x74, 0x72, 0x12, 0x2b, 0x0a, 0x05, 0x74, 0x72, - 0x61, 0x63, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x67, 0x6e, 0x65, 0x74, - 0x63, 0x6c, 0x69, 0x2e, 0x43, 0x4d, 0x44, 0x54, 0x72, 0x61, 0x63, 0x65, 0x49, 0x74, 0x65, 0x6d, - 0x52, 0x05, 0x74, 0x72, 0x61, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, - 0x53, 0x0a, 0x0c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, - 0x2d, 0x0a, 0x03, 0x72, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x67, - 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x03, 0x72, 0x65, 0x73, 0x12, 0x14, - 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x22, 0x8d, 0x01, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x6f, 0x77, - 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, - 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, - 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x34, - 0x0a, 0x0b, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x48, 0x6f, - 0x73, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x0a, 0x68, 0x6f, 0x73, 0x74, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x22, 0x5f, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x61, 0x74, 0x61, - 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x70, 0x61, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2b, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, - 0x6c, 0x69, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x9e, 0x01, 0x0a, 0x11, 0x46, 0x69, 0x6c, 0x65, 0x55, 0x70, - 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x68, - 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, - 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x27, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, - 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, - 0x12, 0x34, 0x0a, 0x0b, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, - 0x48, 0x6f, 0x73, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x0a, 0x68, 0x6f, 0x73, 0x74, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x36, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x52, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x27, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x46, - 0x69, 0x6c, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2a, 0x66, - 0x0a, 0x0e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x14, 0x0a, 0x10, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x6f, - 0x74, 0x73, 0x65, 0x74, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x01, 0x12, 0x13, 0x0a, - 0x0f, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, - 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x72, 0x65, 0x61, 0x64, 0x10, 0x03, 0x2a, 0x48, 0x0a, 0x12, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x11, 0x0a, 0x0d, - 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x6f, 0x74, 0x73, 0x65, 0x74, 0x10, 0x00, 0x12, - 0x0d, 0x0a, 0x09, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6f, 0x6b, 0x10, 0x01, 0x12, 0x10, - 0x0a, 0x0c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x02, - 0x2a, 0x7d, 0x0a, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x15, - 0x0a, 0x11, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x6e, 0x6f, 0x74, - 0x73, 0x65, 0x74, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x5f, 0x6f, 0x6b, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x46, 0x69, 0x6c, 0x65, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x02, 0x12, 0x18, - 0x0a, 0x14, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x6e, 0x6f, 0x74, - 0x5f, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x46, 0x69, 0x6c, 0x65, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x69, 0x73, 0x5f, 0x64, 0x69, 0x72, 0x10, 0x04, 0x32, - 0x8c, 0x05, 0x0a, 0x07, 0x47, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x12, 0x64, 0x0a, 0x0f, 0x53, - 0x65, 0x74, 0x75, 0x70, 0x48, 0x6f, 0x73, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x13, - 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x24, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x1e, 0x22, 0x19, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x74, - 0x75, 0x70, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x01, - 0x2a, 0x12, 0x41, 0x0a, 0x04, 0x45, 0x78, 0x65, 0x63, 0x12, 0x0c, 0x2e, 0x67, 0x6e, 0x65, 0x74, - 0x63, 0x6c, 0x69, 0x2e, 0x43, 0x4d, 0x44, 0x1a, 0x12, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, - 0x69, 0x2e, 0x43, 0x4d, 0x44, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x17, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x11, 0x22, 0x0c, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x65, - 0x63, 0x3a, 0x01, 0x2a, 0x12, 0x32, 0x0a, 0x08, 0x45, 0x78, 0x65, 0x63, 0x43, 0x68, 0x61, 0x74, - 0x12, 0x0c, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x43, 0x4d, 0x44, 0x1a, 0x12, - 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x43, 0x4d, 0x44, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x52, 0x0a, 0x09, 0x41, 0x64, 0x64, 0x44, - 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x0f, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, - 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x15, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, - 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x1d, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x22, 0x12, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x61, - 0x64, 0x64, 0x5f, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x57, 0x0a, 0x0b, - 0x45, 0x78, 0x65, 0x63, 0x4e, 0x65, 0x74, 0x63, 0x6f, 0x6e, 0x66, 0x12, 0x13, 0x2e, 0x67, 0x6e, - 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x43, 0x4d, 0x44, 0x4e, 0x65, 0x74, 0x63, 0x6f, 0x6e, 0x66, - 0x1a, 0x12, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x43, 0x4d, 0x44, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x22, 0x14, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x65, 0x63, 0x5f, 0x6e, 0x65, 0x74, 0x63, 0x6f, - 0x6e, 0x66, 0x3a, 0x01, 0x2a, 0x12, 0x40, 0x0a, 0x0f, 0x45, 0x78, 0x65, 0x63, 0x4e, 0x65, 0x74, - 0x63, 0x6f, 0x6e, 0x66, 0x43, 0x68, 0x61, 0x74, 0x12, 0x13, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, - 0x6c, 0x69, 0x2e, 0x43, 0x4d, 0x44, 0x4e, 0x65, 0x74, 0x63, 0x6f, 0x6e, 0x66, 0x1a, 0x12, 0x2e, - 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x43, 0x4d, 0x44, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x5c, 0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, - 0x6f, 0x61, 0x64, 0x12, 0x1c, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x46, 0x69, - 0x6c, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x14, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x46, 0x69, 0x6c, 0x65, - 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x22, - 0x11, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, - 0x64, 0x73, 0x3a, 0x01, 0x2a, 0x12, 0x57, 0x0a, 0x06, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x12, - 0x1a, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x55, 0x70, - 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x22, 0x0e, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x3a, 0x01, 0x2a, 0x42, 0x37, - 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x6e, 0x6e, - 0x65, 0x74, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2f, 0x70, - 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, - 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} +const file_server_proto_rawDesc = "" + + "\n" + + "\fserver.proto\x12\agnetcli\x1a\x1cgoogle/api/annotations.proto\x1a\x1bgoogle/protobuf/empty.proto\"X\n" + + "\x02QA\x12\x1a\n" + + "\bquestion\x18\x01 \x01(\tR\bquestion\x12\x16\n" + + "\x06answer\x18\x02 \x01(\tR\x06answer\x12\x1e\n" + + "\vnot_send_nl\x18\x03 \x01(\bR\tnotSendNl\"?\n" + + "\vCredentials\x12\x14\n" + + "\x05login\x18\x01 \x01(\tR\x05login\x12\x1a\n" + + "\bpassword\x18\x02 \x01(\tR\bpassword\"\xfd\x01\n" + + "\x03CMD\x12\x12\n" + + "\x04host\x18\x01 \x01(\tR\x04host\x12\x10\n" + + "\x03cmd\x18\x02 \x01(\tR\x03cmd\x12\x14\n" + + "\x05trace\x18\x03 \x01(\bR\x05trace\x12\x1b\n" + + "\x02qa\x18\x04 \x03(\v2\v.gnetcli.QAR\x02qa\x12!\n" + + "\fread_timeout\x18\x05 \x01(\x01R\vreadTimeout\x12\x1f\n" + + "\vcmd_timeout\x18\x06 \x01(\x01R\n" + + "cmdTimeout\x12#\n" + + "\rstring_result\x18\b \x01(\bR\fstringResult\x124\n" + + "\vhost_params\x18\t \x01(\v2\x13.gnetcli.HostParamsR\n" + + "hostParams\"\x9f\x01\n" + + "\x06Device\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12+\n" + + "\x11prompt_expression\x18\x02 \x01(\tR\x10promptExpression\x12)\n" + + "\x10error_expression\x18\x03 \x01(\tR\x0ferrorExpression\x12)\n" + + "\x10pager_expression\x18\x04 \x01(\tR\x0fpagerExpression\"\x8a\x01\n" + + "\n" + + "CMDNetconf\x12\x12\n" + + "\x04host\x18\x01 \x01(\tR\x04host\x12\x10\n" + + "\x03cmd\x18\x02 \x01(\tR\x03cmd\x12\x12\n" + + "\x04json\x18\x03 \x01(\bR\x04json\x12!\n" + + "\fread_timeout\x18\x04 \x01(\x01R\vreadTimeout\x12\x1f\n" + + "\vcmd_timeout\x18\x05 \x01(\x01R\n" + + "cmdTimeout\"Y\n" + + "\fCMDTraceItem\x125\n" + + "\toperation\x18\x01 \x01(\x0e2\x17.gnetcli.TraceOperationR\toperation\x12\x12\n" + + "\x04data\x18\x02 \x01(\fR\x04data\"\xd0\x01\n" + + "\n" + + "HostParams\x12\x12\n" + + "\x04host\x18\x01 \x01(\tR\x04host\x126\n" + + "\vcredentials\x18\x02 \x01(\v2\x14.gnetcli.CredentialsR\vcredentials\x12\x12\n" + + "\x04port\x18\x03 \x01(\x05R\x04port\x12\x16\n" + + "\x06device\x18\x04 \x01(\tR\x06device\x12\x0e\n" + + "\x02ip\x18\x05 \x01(\tR\x02ip\x12:\n" + + "\rstreamer_type\x18\x06 \x01(\x0e2\x15.gnetcli.StreamerTypeR\fstreamerType\"\xae\x01\n" + + "\tCMDResult\x12\x10\n" + + "\x03out\x18\x01 \x01(\fR\x03out\x12\x17\n" + + "\aout_str\x18\x02 \x01(\tR\x06outStr\x12\x14\n" + + "\x05error\x18\x03 \x01(\fR\x05error\x12\x1b\n" + + "\terror_str\x18\x04 \x01(\tR\berrorStr\x12+\n" + + "\x05trace\x18\x05 \x03(\v2\x15.gnetcli.CMDTraceItemR\x05trace\x12\x16\n" + + "\x06status\x18\x06 \x01(\x05R\x06status\"S\n" + + "\fDeviceResult\x12-\n" + + "\x03res\x18\x01 \x01(\x0e2\x1b.gnetcli.DeviceResultStatusR\x03res\x12\x14\n" + + "\x05error\x18\x02 \x01(\tR\x05error\"\x8d\x01\n" + + "\x13FileDownloadRequest\x12\x12\n" + + "\x04host\x18\x01 \x01(\tR\x04host\x12\x14\n" + + "\x05paths\x18\x02 \x03(\tR\x05paths\x12\x16\n" + + "\x06device\x18\x03 \x01(\tR\x06device\x124\n" + + "\vhost_params\x18\x05 \x01(\v2\x13.gnetcli.HostParamsR\n" + + "hostParams\"_\n" + + "\bFileData\x12\x12\n" + + "\x04path\x18\x01 \x01(\tR\x04path\x12\x12\n" + + "\x04data\x18\x02 \x01(\fR\x04data\x12+\n" + + "\x06status\x18\x03 \x01(\x0e2\x13.gnetcli.FileStatusR\x06status\"\x9e\x01\n" + + "\x11FileUploadRequest\x12\x12\n" + + "\x04host\x18\x01 \x01(\tR\x04host\x12\x16\n" + + "\x06device\x18\x04 \x01(\tR\x06device\x12'\n" + + "\x05files\x18\x03 \x03(\v2\x11.gnetcli.FileDataR\x05files\x124\n" + + "\vhost_params\x18\x06 \x01(\v2\x13.gnetcli.HostParamsR\n" + + "hostParams\"6\n" + + "\vFilesResult\x12'\n" + + "\x05files\x18\x01 \x03(\v2\x11.gnetcli.FileDataR\x05files*f\n" + + "\x0eTraceOperation\x12\x14\n" + + "\x10Operation_notset\x10\x00\x12\x15\n" + + "\x11Operation_unknown\x10\x01\x12\x13\n" + + "\x0fOperation_write\x10\x02\x12\x12\n" + + "\x0eOperation_read\x10\x03*H\n" + + "\x12DeviceResultStatus\x12\x11\n" + + "\rDevice_notset\x10\x00\x12\r\n" + + "\tDevice_ok\x10\x01\x12\x10\n" + + "\fDevice_error\x10\x02*=\n" + + "\fStreamerType\x12\x14\n" + + "\x10StreamerType_ssh\x10\x00\x12\x17\n" + + "\x13StreamerType_telnet\x10\x01*}\n" + + "\n" + + "FileStatus\x12\x15\n" + + "\x11FileStatus_notset\x10\x00\x12\x11\n" + + "\rFileStatus_ok\x10\x01\x12\x14\n" + + "\x10FileStatus_error\x10\x02\x12\x18\n" + + "\x14FileStatus_not_found\x10\x03\x12\x15\n" + + "\x11FileStatus_is_dir\x10\x042\x8c\x05\n" + + "\aGnetcli\x12d\n" + + "\x0fSetupHostParams\x12\x13.gnetcli.HostParams\x1a\x16.google.protobuf.Empty\"$\x82\xd3\xe4\x93\x02\x1e:\x01*\"\x19/api/v1/setup_host_params\x12A\n" + + "\x04Exec\x12\f.gnetcli.CMD\x1a\x12.gnetcli.CMDResult\"\x17\x82\xd3\xe4\x93\x02\x11:\x01*\"\f/api/v1/exec\x122\n" + + "\bExecChat\x12\f.gnetcli.CMD\x1a\x12.gnetcli.CMDResult\"\x00(\x010\x01\x12R\n" + + "\tAddDevice\x12\x0f.gnetcli.Device\x1a\x15.gnetcli.DeviceResult\"\x1d\x82\xd3\xe4\x93\x02\x17:\x01*\"\x12/api/v1/add_device\x12W\n" + + "\vExecNetconf\x12\x13.gnetcli.CMDNetconf\x1a\x12.gnetcli.CMDResult\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\"\x14/api/v1/exec_netconf\x12@\n" + + "\x0fExecNetconfChat\x12\x13.gnetcli.CMDNetconf\x1a\x12.gnetcli.CMDResult\"\x00(\x010\x01\x12\\\n" + + "\bDownload\x12\x1c.gnetcli.FileDownloadRequest\x1a\x14.gnetcli.FilesResult\"\x1c\x82\xd3\xe4\x93\x02\x16:\x01*\"\x11/api/v1/downloads\x12W\n" + + "\x06Upload\x12\x1a.gnetcli.FileUploadRequest\x1a\x16.google.protobuf.Empty\"\x19\x82\xd3\xe4\x93\x02\x13:\x01*\"\x0e/api/v1/uploadB7Z5github.com/annetutil/gnetcli/pkg/server/proto;gnetclib\x06proto3" var ( file_server_proto_rawDescOnce sync.Once - file_server_proto_rawDescData = file_server_proto_rawDesc + file_server_proto_rawDescData []byte ) func file_server_proto_rawDescGZIP() []byte { file_server_proto_rawDescOnce.Do(func() { - file_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_server_proto_rawDescData) + file_server_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_server_proto_rawDesc), len(file_server_proto_rawDesc))) }) return file_server_proto_rawDescData } -var file_server_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_server_proto_enumTypes = make([]protoimpl.EnumInfo, 4) var file_server_proto_msgTypes = make([]protoimpl.MessageInfo, 13) -var file_server_proto_goTypes = []interface{}{ +var file_server_proto_goTypes = []any{ (TraceOperation)(0), // 0: gnetcli.TraceOperation (DeviceResultStatus)(0), // 1: gnetcli.DeviceResultStatus - (FileStatus)(0), // 2: gnetcli.FileStatus - (*QA)(nil), // 3: gnetcli.QA - (*Credentials)(nil), // 4: gnetcli.Credentials - (*CMD)(nil), // 5: gnetcli.CMD - (*Device)(nil), // 6: gnetcli.Device - (*CMDNetconf)(nil), // 7: gnetcli.CMDNetconf - (*CMDTraceItem)(nil), // 8: gnetcli.CMDTraceItem - (*HostParams)(nil), // 9: gnetcli.HostParams - (*CMDResult)(nil), // 10: gnetcli.CMDResult - (*DeviceResult)(nil), // 11: gnetcli.DeviceResult - (*FileDownloadRequest)(nil), // 12: gnetcli.FileDownloadRequest - (*FileData)(nil), // 13: gnetcli.FileData - (*FileUploadRequest)(nil), // 14: gnetcli.FileUploadRequest - (*FilesResult)(nil), // 15: gnetcli.FilesResult - (*emptypb.Empty)(nil), // 16: google.protobuf.Empty + (StreamerType)(0), // 2: gnetcli.StreamerType + (FileStatus)(0), // 3: gnetcli.FileStatus + (*QA)(nil), // 4: gnetcli.QA + (*Credentials)(nil), // 5: gnetcli.Credentials + (*CMD)(nil), // 6: gnetcli.CMD + (*Device)(nil), // 7: gnetcli.Device + (*CMDNetconf)(nil), // 8: gnetcli.CMDNetconf + (*CMDTraceItem)(nil), // 9: gnetcli.CMDTraceItem + (*HostParams)(nil), // 10: gnetcli.HostParams + (*CMDResult)(nil), // 11: gnetcli.CMDResult + (*DeviceResult)(nil), // 12: gnetcli.DeviceResult + (*FileDownloadRequest)(nil), // 13: gnetcli.FileDownloadRequest + (*FileData)(nil), // 14: gnetcli.FileData + (*FileUploadRequest)(nil), // 15: gnetcli.FileUploadRequest + (*FilesResult)(nil), // 16: gnetcli.FilesResult + (*emptypb.Empty)(nil), // 17: google.protobuf.Empty } var file_server_proto_depIdxs = []int32{ - 3, // 0: gnetcli.CMD.qa:type_name -> gnetcli.QA - 9, // 1: gnetcli.CMD.host_params:type_name -> gnetcli.HostParams + 4, // 0: gnetcli.CMD.qa:type_name -> gnetcli.QA + 10, // 1: gnetcli.CMD.host_params:type_name -> gnetcli.HostParams 0, // 2: gnetcli.CMDTraceItem.operation:type_name -> gnetcli.TraceOperation - 4, // 3: gnetcli.HostParams.credentials:type_name -> gnetcli.Credentials - 8, // 4: gnetcli.CMDResult.trace:type_name -> gnetcli.CMDTraceItem - 1, // 5: gnetcli.DeviceResult.res:type_name -> gnetcli.DeviceResultStatus - 9, // 6: gnetcli.FileDownloadRequest.host_params:type_name -> gnetcli.HostParams - 2, // 7: gnetcli.FileData.status:type_name -> gnetcli.FileStatus - 13, // 8: gnetcli.FileUploadRequest.files:type_name -> gnetcli.FileData - 9, // 9: gnetcli.FileUploadRequest.host_params:type_name -> gnetcli.HostParams - 13, // 10: gnetcli.FilesResult.files:type_name -> gnetcli.FileData - 9, // 11: gnetcli.Gnetcli.SetupHostParams:input_type -> gnetcli.HostParams - 5, // 12: gnetcli.Gnetcli.Exec:input_type -> gnetcli.CMD - 5, // 13: gnetcli.Gnetcli.ExecChat:input_type -> gnetcli.CMD - 6, // 14: gnetcli.Gnetcli.AddDevice:input_type -> gnetcli.Device - 7, // 15: gnetcli.Gnetcli.ExecNetconf:input_type -> gnetcli.CMDNetconf - 7, // 16: gnetcli.Gnetcli.ExecNetconfChat:input_type -> gnetcli.CMDNetconf - 12, // 17: gnetcli.Gnetcli.Download:input_type -> gnetcli.FileDownloadRequest - 14, // 18: gnetcli.Gnetcli.Upload:input_type -> gnetcli.FileUploadRequest - 16, // 19: gnetcli.Gnetcli.SetupHostParams:output_type -> google.protobuf.Empty - 10, // 20: gnetcli.Gnetcli.Exec:output_type -> gnetcli.CMDResult - 10, // 21: gnetcli.Gnetcli.ExecChat:output_type -> gnetcli.CMDResult - 11, // 22: gnetcli.Gnetcli.AddDevice:output_type -> gnetcli.DeviceResult - 10, // 23: gnetcli.Gnetcli.ExecNetconf:output_type -> gnetcli.CMDResult - 10, // 24: gnetcli.Gnetcli.ExecNetconfChat:output_type -> gnetcli.CMDResult - 15, // 25: gnetcli.Gnetcli.Download:output_type -> gnetcli.FilesResult - 16, // 26: gnetcli.Gnetcli.Upload:output_type -> google.protobuf.Empty - 19, // [19:27] is the sub-list for method output_type - 11, // [11:19] is the sub-list for method input_type - 11, // [11:11] is the sub-list for extension type_name - 11, // [11:11] is the sub-list for extension extendee - 0, // [0:11] is the sub-list for field type_name + 5, // 3: gnetcli.HostParams.credentials:type_name -> gnetcli.Credentials + 2, // 4: gnetcli.HostParams.streamer_type:type_name -> gnetcli.StreamerType + 9, // 5: gnetcli.CMDResult.trace:type_name -> gnetcli.CMDTraceItem + 1, // 6: gnetcli.DeviceResult.res:type_name -> gnetcli.DeviceResultStatus + 10, // 7: gnetcli.FileDownloadRequest.host_params:type_name -> gnetcli.HostParams + 3, // 8: gnetcli.FileData.status:type_name -> gnetcli.FileStatus + 14, // 9: gnetcli.FileUploadRequest.files:type_name -> gnetcli.FileData + 10, // 10: gnetcli.FileUploadRequest.host_params:type_name -> gnetcli.HostParams + 14, // 11: gnetcli.FilesResult.files:type_name -> gnetcli.FileData + 10, // 12: gnetcli.Gnetcli.SetupHostParams:input_type -> gnetcli.HostParams + 6, // 13: gnetcli.Gnetcli.Exec:input_type -> gnetcli.CMD + 6, // 14: gnetcli.Gnetcli.ExecChat:input_type -> gnetcli.CMD + 7, // 15: gnetcli.Gnetcli.AddDevice:input_type -> gnetcli.Device + 8, // 16: gnetcli.Gnetcli.ExecNetconf:input_type -> gnetcli.CMDNetconf + 8, // 17: gnetcli.Gnetcli.ExecNetconfChat:input_type -> gnetcli.CMDNetconf + 13, // 18: gnetcli.Gnetcli.Download:input_type -> gnetcli.FileDownloadRequest + 15, // 19: gnetcli.Gnetcli.Upload:input_type -> gnetcli.FileUploadRequest + 17, // 20: gnetcli.Gnetcli.SetupHostParams:output_type -> google.protobuf.Empty + 11, // 21: gnetcli.Gnetcli.Exec:output_type -> gnetcli.CMDResult + 11, // 22: gnetcli.Gnetcli.ExecChat:output_type -> gnetcli.CMDResult + 12, // 23: gnetcli.Gnetcli.AddDevice:output_type -> gnetcli.DeviceResult + 11, // 24: gnetcli.Gnetcli.ExecNetconf:output_type -> gnetcli.CMDResult + 11, // 25: gnetcli.Gnetcli.ExecNetconfChat:output_type -> gnetcli.CMDResult + 16, // 26: gnetcli.Gnetcli.Download:output_type -> gnetcli.FilesResult + 17, // 27: gnetcli.Gnetcli.Upload:output_type -> google.protobuf.Empty + 20, // [20:28] is the sub-list for method output_type + 12, // [12:20] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name } func init() { file_server_proto_init() } @@ -1329,170 +1272,12 @@ func file_server_proto_init() { if File_server_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QA); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Credentials); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CMD); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Device); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CMDNetconf); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CMDTraceItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HostParams); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CMDResult); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeviceResult); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileDownloadRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileData); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileUploadRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FilesResult); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_server_proto_rawDesc, - NumEnums: 3, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_server_proto_rawDesc), len(file_server_proto_rawDesc)), + NumEnums: 4, NumMessages: 13, NumExtensions: 0, NumServices: 1, @@ -1503,7 +1288,6 @@ func file_server_proto_init() { MessageInfos: file_server_proto_msgTypes, }.Build() File_server_proto = out.File - file_server_proto_rawDesc = nil file_server_proto_goTypes = nil file_server_proto_depIdxs = nil } diff --git a/pkg/server/proto/server.proto b/pkg/server/proto/server.proto index 6a905df0..0566eeec 100644 --- a/pkg/server/proto/server.proto +++ b/pkg/server/proto/server.proto @@ -61,12 +61,18 @@ message CMDTraceItem { bytes data = 2; } +enum StreamerType { + StreamerType_ssh = 0; + StreamerType_telnet = 1; +} + message HostParams { string host = 1; Credentials credentials = 2; int32 port = 3; string device = 4; string ip = 5; + StreamerType streamer_type = 6; } message CMDResult { diff --git a/pkg/server/proto/server_grpc.pb.go b/pkg/server/proto/server_grpc.pb.go index c2518c70..ef120916 100644 --- a/pkg/server/proto/server_grpc.pb.go +++ b/pkg/server/proto/server_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v6.33.1 +// source: server.proto package gnetcli @@ -15,6 +19,17 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + Gnetcli_SetupHostParams_FullMethodName = "/gnetcli.Gnetcli/SetupHostParams" + Gnetcli_Exec_FullMethodName = "/gnetcli.Gnetcli/Exec" + Gnetcli_ExecChat_FullMethodName = "/gnetcli.Gnetcli/ExecChat" + Gnetcli_AddDevice_FullMethodName = "/gnetcli.Gnetcli/AddDevice" + Gnetcli_ExecNetconf_FullMethodName = "/gnetcli.Gnetcli/ExecNetconf" + Gnetcli_ExecNetconfChat_FullMethodName = "/gnetcli.Gnetcli/ExecNetconfChat" + Gnetcli_Download_FullMethodName = "/gnetcli.Gnetcli/Download" + Gnetcli_Upload_FullMethodName = "/gnetcli.Gnetcli/Upload" +) + // GnetcliClient is the client API for Gnetcli service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -39,7 +54,7 @@ func NewGnetcliClient(cc grpc.ClientConnInterface) GnetcliClient { func (c *gnetcliClient) SetupHostParams(ctx context.Context, in *HostParams, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/gnetcli.Gnetcli/SetupHostParams", in, out, opts...) + err := c.cc.Invoke(ctx, Gnetcli_SetupHostParams_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -48,7 +63,7 @@ func (c *gnetcliClient) SetupHostParams(ctx context.Context, in *HostParams, opt func (c *gnetcliClient) Exec(ctx context.Context, in *CMD, opts ...grpc.CallOption) (*CMDResult, error) { out := new(CMDResult) - err := c.cc.Invoke(ctx, "/gnetcli.Gnetcli/Exec", in, out, opts...) + err := c.cc.Invoke(ctx, Gnetcli_Exec_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -56,7 +71,7 @@ func (c *gnetcliClient) Exec(ctx context.Context, in *CMD, opts ...grpc.CallOpti } func (c *gnetcliClient) ExecChat(ctx context.Context, opts ...grpc.CallOption) (Gnetcli_ExecChatClient, error) { - stream, err := c.cc.NewStream(ctx, &Gnetcli_ServiceDesc.Streams[0], "/gnetcli.Gnetcli/ExecChat", opts...) + stream, err := c.cc.NewStream(ctx, &Gnetcli_ServiceDesc.Streams[0], Gnetcli_ExecChat_FullMethodName, opts...) if err != nil { return nil, err } @@ -88,7 +103,7 @@ func (x *gnetcliExecChatClient) Recv() (*CMDResult, error) { func (c *gnetcliClient) AddDevice(ctx context.Context, in *Device, opts ...grpc.CallOption) (*DeviceResult, error) { out := new(DeviceResult) - err := c.cc.Invoke(ctx, "/gnetcli.Gnetcli/AddDevice", in, out, opts...) + err := c.cc.Invoke(ctx, Gnetcli_AddDevice_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -97,7 +112,7 @@ func (c *gnetcliClient) AddDevice(ctx context.Context, in *Device, opts ...grpc. func (c *gnetcliClient) ExecNetconf(ctx context.Context, in *CMDNetconf, opts ...grpc.CallOption) (*CMDResult, error) { out := new(CMDResult) - err := c.cc.Invoke(ctx, "/gnetcli.Gnetcli/ExecNetconf", in, out, opts...) + err := c.cc.Invoke(ctx, Gnetcli_ExecNetconf_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -105,7 +120,7 @@ func (c *gnetcliClient) ExecNetconf(ctx context.Context, in *CMDNetconf, opts .. } func (c *gnetcliClient) ExecNetconfChat(ctx context.Context, opts ...grpc.CallOption) (Gnetcli_ExecNetconfChatClient, error) { - stream, err := c.cc.NewStream(ctx, &Gnetcli_ServiceDesc.Streams[1], "/gnetcli.Gnetcli/ExecNetconfChat", opts...) + stream, err := c.cc.NewStream(ctx, &Gnetcli_ServiceDesc.Streams[1], Gnetcli_ExecNetconfChat_FullMethodName, opts...) if err != nil { return nil, err } @@ -137,7 +152,7 @@ func (x *gnetcliExecNetconfChatClient) Recv() (*CMDResult, error) { func (c *gnetcliClient) Download(ctx context.Context, in *FileDownloadRequest, opts ...grpc.CallOption) (*FilesResult, error) { out := new(FilesResult) - err := c.cc.Invoke(ctx, "/gnetcli.Gnetcli/Download", in, out, opts...) + err := c.cc.Invoke(ctx, Gnetcli_Download_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -146,7 +161,7 @@ func (c *gnetcliClient) Download(ctx context.Context, in *FileDownloadRequest, o func (c *gnetcliClient) Upload(ctx context.Context, in *FileUploadRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/gnetcli.Gnetcli/Upload", in, out, opts...) + err := c.cc.Invoke(ctx, Gnetcli_Upload_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -219,7 +234,7 @@ func _Gnetcli_SetupHostParams_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gnetcli.Gnetcli/SetupHostParams", + FullMethod: Gnetcli_SetupHostParams_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GnetcliServer).SetupHostParams(ctx, req.(*HostParams)) @@ -237,7 +252,7 @@ func _Gnetcli_Exec_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gnetcli.Gnetcli/Exec", + FullMethod: Gnetcli_Exec_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GnetcliServer).Exec(ctx, req.(*CMD)) @@ -281,7 +296,7 @@ func _Gnetcli_AddDevice_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gnetcli.Gnetcli/AddDevice", + FullMethod: Gnetcli_AddDevice_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GnetcliServer).AddDevice(ctx, req.(*Device)) @@ -299,7 +314,7 @@ func _Gnetcli_ExecNetconf_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gnetcli.Gnetcli/ExecNetconf", + FullMethod: Gnetcli_ExecNetconf_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GnetcliServer).ExecNetconf(ctx, req.(*CMDNetconf)) @@ -343,7 +358,7 @@ func _Gnetcli_Download_Handler(srv interface{}, ctx context.Context, dec func(in } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gnetcli.Gnetcli/Download", + FullMethod: Gnetcli_Download_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GnetcliServer).Download(ctx, req.(*FileDownloadRequest)) @@ -361,7 +376,7 @@ func _Gnetcli_Upload_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gnetcli.Gnetcli/Upload", + FullMethod: Gnetcli_Upload_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GnetcliServer).Upload(ctx, req.(*FileUploadRequest)) diff --git a/pkg/server/server.go b/pkg/server/server.go index c4785752..38ae91aa 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -16,6 +16,8 @@ import ( "sync" "time" + "golang.org/x/xerrors" + "go.uber.org/zap" "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc/codes" @@ -32,6 +34,7 @@ import ( pb "github.com/annetutil/gnetcli/pkg/server/proto" "github.com/annetutil/gnetcli/pkg/streamer" "github.com/annetutil/gnetcli/pkg/streamer/ssh" + "github.com/annetutil/gnetcli/pkg/streamer/telnet" gtrace "github.com/annetutil/gnetcli/pkg/trace" ) @@ -63,13 +66,14 @@ type Server struct { } type hostParams struct { - port int - device string - creds credentials.Credentials - ip netip.Addr - proxyJump string - controlPath string - host string + port int + device string + creds credentials.Credentials + ip netip.Addr + proxyJump string + controlPath string + host string + streamerType pb.StreamerType } func makeGRPCDeviceExecError(err error) error { @@ -90,13 +94,14 @@ func makeGRPCDeviceExecError(err error) error { func NewHostParams(creds credentials.Credentials, device string, ip netip.Addr, port int, proxyJump, controlPath, host string) hostParams { return hostParams{ - port: port, - device: device, - creds: creds, - ip: ip, - proxyJump: proxyJump, - controlPath: controlPath, - host: host, + port: port, + device: device, + creds: creds, + ip: ip, + proxyJump: proxyJump, + controlPath: controlPath, + host: host, + streamerType: pb.StreamerType_StreamerType_ssh, } } @@ -161,9 +166,10 @@ func (m *Server) makeConnectArg(hostname string, params hostParams) (string, int return host, int(port) } -func (m *Server) makeDevice(hostname string, params hostParams, add func(op gtrace.Operation, data []byte), logger *zap.Logger) (device.Device, error) { +func (m *Server) resolveCredentials(hostname string, params hostParams) (credentials.Credentials, error) { var creds credentials.Credentials paramCreds := params.GetCredentials() + if paramCreds != nil { creds = paramCreds } else { @@ -173,35 +179,98 @@ func (m *Server) makeDevice(hostname string, params hostParams, add func(op gtra } creds = defcreds } - deviceType := params.GetDevice() - streamerOpts := []ssh.StreamerOption{ssh.WithLogger(logger), ssh.WithTrace(add)} - connHost, port := m.makeConnectArg(hostname, params) - if port > 0 { - streamerOpts = append(streamerOpts, ssh.WithPort(port)) + + return creds, nil +} + +type StreamerConfig struct { + params hostParams + creds credentials.Credentials + connHost string + port int + logger *zap.Logger +} + +func (m *Server) createStreamer(cfg StreamerConfig, add func(op gtrace.Operation, data []byte)) (streamer.Connector, error) { + switch cfg.params.streamerType { + case pb.StreamerType_StreamerType_telnet: + return m.createStreamerTelnet(cfg, add) + case pb.StreamerType_StreamerType_ssh: + return m.createStreamerSSH(cfg, add) + } + return nil, fmt.Errorf("unknown streamer type: %s", cfg.params.streamerType) +} + +func (m *Server) createStreamerTelnet(cfg StreamerConfig, add func(op gtrace.Operation, data []byte)) (streamer.Connector, error) { + telnetOpts := []telnet.StreamerOption{telnet.WithLogger(cfg.logger)} + if add != nil { + telnetOpts = append(telnetOpts, telnet.WithTrace(add)) + } + if cfg.port > 0 { + telnetOpts = append(telnetOpts, telnet.WithPort(cfg.port)) + } + return telnet.NewStreamer(cfg.connHost, cfg.creds, telnetOpts...), nil +} + +func (m *Server) createStreamerSSH(cfg StreamerConfig, add func(op gtrace.Operation, data []byte)) (streamer.Connector, error) { + streamerOpts := []ssh.StreamerOption{ssh.WithLogger(cfg.logger)} + if add != nil { + streamerOpts = append(streamerOpts, ssh.WithTrace(add)) } - if params.proxyJump != "" { - jumpHostParams, err := m.getHostParams(params.proxyJump, nil) + if cfg.port > 0 { + streamerOpts = append(streamerOpts, ssh.WithPort(cfg.port)) + } + connHost := cfg.connHost + if cfg.params.proxyJump != "" { + jumpHostParams, err := m.getHostParams(cfg.params.proxyJump, nil) if err != nil { - return nil, fmt.Errorf("unable to get host params for ssh tunnel to %s:%w", params.proxyJump, err) + return nil, fmt.Errorf("unable to get host params for ssh tunnel to %s:%w", cfg.params.proxyJump, err) } - opts := []ssh.SSHTunnelOption{ssh.SSHTunnelWithLogger(logger)} + + opts := []ssh.SSHTunnelOption{ssh.SSHTunnelWithLogger(cfg.logger)} if len(jumpHostParams.controlPath) > 0 { opts = append(opts, ssh.SSHTunnelWithControlFIle(jumpHostParams.controlPath)) } - connHost = params.host + + connHost = cfg.params.host tun := ssh.NewSSHTunnel(jumpHostParams.host, jumpHostParams.GetCredentials(), opts...) + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() + err = tun.CreateConnect(ctx) if err != nil { - return nil, fmt.Errorf("unable to open ssh tunnel to %s:%w", params.proxyJump, err) + return nil, fmt.Errorf("unable to open ssh tunnel to %s:%w", cfg.params.proxyJump, err) } streamerOpts = append(streamerOpts, ssh.WithSSHTunnel(tun)) } - if params.controlPath != "" { - streamerOpts = append(streamerOpts, ssh.WithSSHControlFIle(params.controlPath)) + if cfg.params.controlPath != "" { + streamerOpts = append(streamerOpts, ssh.WithSSHControlFIle(cfg.params.controlPath)) } - connector := ssh.NewStreamer(connHost, creds, streamerOpts...) + return ssh.NewStreamer(connHost, cfg.creds, streamerOpts...), nil +} + +func (m *Server) makeDevice(hostname string, params hostParams, add func(op gtrace.Operation, data []byte), logger *zap.Logger) (device.Device, error) { + creds, err := m.resolveCredentials(hostname, params) + if err != nil { + return nil, xerrors.Errorf("failed to resolve credentials: %w", err) + } + + deviceType := params.GetDevice() + connHost, port := m.makeConnectArg(hostname, params) + + var connector streamer.Connector + connector, err = m.createStreamer(StreamerConfig{ + params: params, + creds: creds, + connHost: connHost, + port: port, + logger: logger, + }, add) + if err != nil { + return nil, xerrors.Errorf("failed to create streamer: %w", err) + } + devFab, ok := m.deviceMaps[deviceType] if !ok { return nil, fmt.Errorf("unknown device %v", deviceType) @@ -471,10 +540,11 @@ func (m *Server) getHostParams(hostname string, cmdParams *pb.HostParams) (hostP credsParsed = creds } cmdHostParams = &hostParams{ - port: port, - device: cmdParams.Device, - creds: credsParsed, - ip: ip, + port: port, + device: cmdParams.Device, + creds: credsParsed, + ip: ip, + streamerType: cmdParams.GetStreamerType(), } } var res hostParams diff --git a/pkg/server/server_integration_test.go b/pkg/server/server_integration_test.go index 7934f6ef..0ee09d1c 100644 --- a/pkg/server/server_integration_test.go +++ b/pkg/server/server_integration_test.go @@ -210,3 +210,205 @@ func newSSHServerPort(t *testing.T) (net.Listener, int32) { require.NoError(t, err) return ln, int32(v) } + +func newTelnetServerPort(t *testing.T) (net.Listener, int32) { + t.Helper() + + ln, err := net.Listen("tcp", "127.0.0.1:0") + require.NoError(t, err) + t.Cleanup(func() { _ = ln.Close() }) + + _, telnetPortStr, err := net.SplitHostPort(ln.Addr().String()) + require.NoError(t, err) + v, err := strconv.Atoi(telnetPortStr) + require.NoError(t, err) + return ln, int32(v) +} + +// TestTelnetBasicExecution tests basic command execution via Telnet streamer +func TestTelnetBasicExecution(t *testing.T) { + if testing.Short() { + t.Skip("integration test") + } + + ln, telnetPort := newTelnetServerPort(t) + ctx := t.Context() + + const user = "telnetadmin" + const pass = "telnet-password" + + swLogger := zap.NewNop() + if testing.Verbose() { + swLogger = zap.Must(zap.NewDevelopmentConfig().Build()) + } + + go func() { + _ = gswitch.ServeTelnet(ctx, ln, gswitch.SSHServerOptions{ + Logger: swLogger, + Username: user, + Password: pass, + ConnectionErrorProb: 0, + }) + }() + + logger := zap.NewNop() + var devAuth server.Config + devAuth.DevAuth.Login = user + devAuth.DevAuth.Password = credentials.Secret(pass) + devAuth.DevAuth.UseAgent = false + + client := newGnetcliTestClient(t, devAuth, logger) + res, err := client.Exec(ctx, &pb.CMD{ + Host: "mock-telnet-sw", + Cmd: "show version", + HostParams: &pb.HostParams{ + Ip: "127.0.0.1", + Port: telnetPort, + Device: "cisco", + StreamerType: pb.StreamerType_StreamerType_telnet, + }, + }) + require.NoError(t, err) + require.Contains(t, string(res.GetOut()), "Cisco IOS Software") +} + +// TestTelnetCustomPort tests Telnet connection with custom port +func TestTelnetCustomPort(t *testing.T) { + if testing.Short() { + t.Skip("integration test") + } + + ln, telnetPort := newTelnetServerPort(t) + ctx := t.Context() + + const user = "telnetuser" + const pass = "custom-port-pass" + + swLogger := zap.NewNop() + if testing.Verbose() { + swLogger = zap.Must(zap.NewDevelopmentConfig().Build()) + } + + go func() { + _ = gswitch.ServeTelnet(ctx, ln, gswitch.SSHServerOptions{ + Logger: swLogger, + Username: user, + Password: pass, + ConnectionErrorProb: 0, + }) + }() + + logger := zap.NewNop() + var devAuth server.Config + devAuth.DevAuth.Login = user + devAuth.DevAuth.Password = credentials.Secret(pass) + devAuth.DevAuth.UseAgent = false + + client := newGnetcliTestClient(t, devAuth, logger) + + // Test that custom port is properly used + res, err := client.Exec(ctx, &pb.CMD{ + Host: "custom-port-device", + Cmd: "show version", + HostParams: &pb.HostParams{ + Ip: "127.0.0.1", + Port: telnetPort, // Using custom port + Device: "cisco", + StreamerType: pb.StreamerType_StreamerType_telnet, + }, + }) + require.NoError(t, err) + require.Contains(t, string(res.GetOut()), "Cisco IOS Software") +} + +// TestStreamerTypeSelection tests explicit streamer type selection between SSH and Telnet +func TestStreamerTypeSelection(t *testing.T) { + if testing.Short() { + t.Skip("integration test") + } + + // Setup SSH server + sshLn, sshPort := newSSHServerPort(t) + // Setup Telnet server + telnetLn, telnetPort := newTelnetServerPort(t) + + ctx := t.Context() + + const user = "multiuser" + const pass = "multi-pass" + + swLogger := zap.NewNop() + if testing.Verbose() { + swLogger = zap.Must(zap.NewDevelopmentConfig().Build()) + } + + // Start SSH server + go func() { + _ = gswitch.ServeSSH(ctx, sshLn, gswitch.SSHServerOptions{ + Logger: swLogger, + Username: user, + Password: pass, + ConnectionErrorProb: 0, + }) + }() + + // Start Telnet server + go func() { + _ = gswitch.ServeTelnet(ctx, telnetLn, gswitch.SSHServerOptions{ + Logger: swLogger, + Username: user, + Password: pass, + ConnectionErrorProb: 0, + }) + }() + + logger := zap.NewNop() + var devAuth server.Config + devAuth.DevAuth.Login = user + devAuth.DevAuth.Password = credentials.Secret(pass) + devAuth.DevAuth.UseAgent = false + + client := newGnetcliTestClient(t, devAuth, logger) + + // Test SSH streamer (default behavior - streamer_type not specified) + sshRes, err := client.Exec(ctx, &pb.CMD{ + Host: "ssh-device", + Cmd: "show version", + HostParams: &pb.HostParams{ + Ip: "127.0.0.1", + Port: sshPort, + Device: "cisco", + // StreamerType not specified - should default to SSH + }, + }) + require.NoError(t, err) + require.Contains(t, string(sshRes.GetOut()), "Cisco IOS Software") + + // Test explicit SSH streamer + sshExplicitRes, err := client.Exec(ctx, &pb.CMD{ + Host: "ssh-explicit-device", + Cmd: "show version", + HostParams: &pb.HostParams{ + Ip: "127.0.0.1", + Port: sshPort, + Device: "cisco", + StreamerType: pb.StreamerType_StreamerType_ssh, + }, + }) + require.NoError(t, err) + require.Contains(t, string(sshExplicitRes.GetOut()), "Cisco IOS Software") + + // Test Telnet streamer + telnetRes, err := client.Exec(ctx, &pb.CMD{ + Host: "telnet-device", + Cmd: "show version", + HostParams: &pb.HostParams{ + Ip: "127.0.0.1", + Port: telnetPort, + Device: "cisco", + StreamerType: pb.StreamerType_StreamerType_telnet, + }, + }) + require.NoError(t, err) + require.Contains(t, string(telnetRes.GetOut()), "Cisco IOS Software") +} diff --git a/pkg/streamer/telnet/telnet.go b/pkg/streamer/telnet/telnet.go index 1d31e5b2..0f586600 100644 --- a/pkg/streamer/telnet/telnet.go +++ b/pkg/streamer/telnet/telnet.go @@ -60,6 +60,7 @@ type Streamer struct { credentials credentials.Credentials logger *zap.Logger host string + port int addresses []net.IP conn net.Conn stdoutBuffer chan []byte @@ -102,10 +103,10 @@ func (m *Streamer) Init(ctx context.Context) error { if len(m.addresses) != 0 { endpoints = make([]string, 0, len(m.addresses)) for _, v := range m.addresses { - endpoints = append(endpoints, net.JoinHostPort(v.String(), strconv.Itoa(defaultPort))) + endpoints = append(endpoints, net.JoinHostPort(v.String(), strconv.Itoa(m.port))) } } else { - endpoints = []string{net.JoinHostPort(m.host, strconv.Itoa(defaultPort))} + endpoints = []string{net.JoinHostPort(m.host, strconv.Itoa(m.port))} } for i, v := range endpoints { @@ -136,6 +137,7 @@ func NewStreamer(host string, credentials credentials.Credentials, opts ...Strea credentials: credentials, logger: zap.NewNop(), host: host, + port: defaultPort, addresses: nil, conn: nil, stdoutBuffer: stdoutBuffer, @@ -207,6 +209,12 @@ func WithAddresses(addresses []net.IP) StreamerOption { } } +func WithPort(port int) StreamerOption { + return func(h *Streamer) { + h.port = port + } +} + func (m *Streamer) Close() { if m.conn != nil { _ = m.conn.Close() From eac572891f4468ebeddf2daf11bdf1e056349812 Mon Sep 17 00:00:00 2001 From: vadvolo Date: Fri, 22 May 2026 14:22:26 +0200 Subject: [PATCH 2/3] telnet: update pb --- pkg/server/proto/server_pb2.py | 76 +++++++------ pkg/server/proto/server_pb2.pyi | 16 ++- pkg/server/proto/server_pb2_grpc.py | 165 ++++++++++++++++++++++------ 3 files changed, 190 insertions(+), 67 deletions(-) diff --git a/pkg/server/proto/server_pb2.py b/pkg/server/proto/server_pb2.py index 9d0b77a4..2cd547be 100644 --- a/pkg/server/proto/server_pb2.py +++ b/pkg/server/proto/server_pb2.py @@ -1,12 +1,22 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: server.proto -# Protobuf Python Version: 4.25.1 +# Protobuf Python Version: 6.31.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion( + _runtime_version.Domain.PUBLIC, + 6, + 31, + 1, + '', + 'server.proto' +) # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -16,32 +26,34 @@ from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cserver.proto\x12\x07gnetcli\x1a\x1cgoogle/api/annotations.proto\x1a\x1bgoogle/protobuf/empty.proto\";\n\x02QA\x12\x10\n\x08question\x18\x01 \x01(\t\x12\x0e\n\x06\x61nswer\x18\x02 \x01(\t\x12\x13\n\x0bnot_send_nl\x18\x03 \x01(\x08\".\n\x0b\x43redentials\x12\r\n\x05login\x18\x01 \x01(\t\x12\x10\n\x08password\x18\x02 \x01(\t\"\xb4\x01\n\x03\x43MD\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0b\n\x03\x63md\x18\x02 \x01(\t\x12\r\n\x05trace\x18\x03 \x01(\x08\x12\x17\n\x02qa\x18\x04 \x03(\x0b\x32\x0b.gnetcli.QA\x12\x14\n\x0cread_timeout\x18\x05 \x01(\x01\x12\x13\n\x0b\x63md_timeout\x18\x06 \x01(\x01\x12\x15\n\rstring_result\x18\x08 \x01(\x08\x12(\n\x0bhost_params\x18\t \x01(\x0b\x32\x13.gnetcli.HostParams\"e\n\x06\x44\x65vice\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x19\n\x11prompt_expression\x18\x02 \x01(\t\x12\x18\n\x10\x65rror_expression\x18\x03 \x01(\t\x12\x18\n\x10pager_expression\x18\x04 \x01(\t\"`\n\nCMDNetconf\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0b\n\x03\x63md\x18\x02 \x01(\t\x12\x0c\n\x04json\x18\x03 \x01(\x08\x12\x14\n\x0cread_timeout\x18\x04 \x01(\x01\x12\x13\n\x0b\x63md_timeout\x18\x05 \x01(\x01\"H\n\x0c\x43MDTraceItem\x12*\n\toperation\x18\x01 \x01(\x0e\x32\x17.gnetcli.TraceOperation\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\"o\n\nHostParams\x12\x0c\n\x04host\x18\x01 \x01(\t\x12)\n\x0b\x63redentials\x18\x02 \x01(\x0b\x32\x14.gnetcli.Credentials\x12\x0c\n\x04port\x18\x03 \x01(\x05\x12\x0e\n\x06\x64\x65vice\x18\x04 \x01(\t\x12\n\n\x02ip\x18\x05 \x01(\t\"\x81\x01\n\tCMDResult\x12\x0b\n\x03out\x18\x01 \x01(\x0c\x12\x0f\n\x07out_str\x18\x02 \x01(\t\x12\r\n\x05\x65rror\x18\x03 \x01(\x0c\x12\x11\n\terror_str\x18\x04 \x01(\t\x12$\n\x05trace\x18\x05 \x03(\x0b\x32\x15.gnetcli.CMDTraceItem\x12\x0e\n\x06status\x18\x06 \x01(\x05\"G\n\x0c\x44\x65viceResult\x12(\n\x03res\x18\x01 \x01(\x0e\x32\x1b.gnetcli.DeviceResultStatus\x12\r\n\x05\x65rror\x18\x02 \x01(\t\"l\n\x13\x46ileDownloadRequest\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\r\n\x05paths\x18\x02 \x03(\t\x12\x0e\n\x06\x64\x65vice\x18\x03 \x01(\t\x12(\n\x0bhost_params\x18\x05 \x01(\x0b\x32\x13.gnetcli.HostParams\"K\n\x08\x46ileData\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\x12#\n\x06status\x18\x03 \x01(\x0e\x32\x13.gnetcli.FileStatus\"}\n\x11\x46ileUploadRequest\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0e\n\x06\x64\x65vice\x18\x04 \x01(\t\x12 \n\x05\x66iles\x18\x03 \x03(\x0b\x32\x11.gnetcli.FileData\x12(\n\x0bhost_params\x18\x06 \x01(\x0b\x32\x13.gnetcli.HostParams\"/\n\x0b\x46ilesResult\x12 \n\x05\x66iles\x18\x01 \x03(\x0b\x32\x11.gnetcli.FileData*f\n\x0eTraceOperation\x12\x14\n\x10Operation_notset\x10\x00\x12\x15\n\x11Operation_unknown\x10\x01\x12\x13\n\x0fOperation_write\x10\x02\x12\x12\n\x0eOperation_read\x10\x03*H\n\x12\x44\x65viceResultStatus\x12\x11\n\rDevice_notset\x10\x00\x12\r\n\tDevice_ok\x10\x01\x12\x10\n\x0c\x44\x65vice_error\x10\x02*}\n\nFileStatus\x12\x15\n\x11\x46ileStatus_notset\x10\x00\x12\x11\n\rFileStatus_ok\x10\x01\x12\x14\n\x10\x46ileStatus_error\x10\x02\x12\x18\n\x14\x46ileStatus_not_found\x10\x03\x12\x15\n\x11\x46ileStatus_is_dir\x10\x04\x32\x8c\x05\n\x07Gnetcli\x12\x64\n\x0fSetupHostParams\x12\x13.gnetcli.HostParams\x1a\x16.google.protobuf.Empty\"$\x82\xd3\xe4\x93\x02\x1e\"\x19/api/v1/setup_host_params:\x01*\x12\x41\n\x04\x45xec\x12\x0c.gnetcli.CMD\x1a\x12.gnetcli.CMDResult\"\x17\x82\xd3\xe4\x93\x02\x11\"\x0c/api/v1/exec:\x01*\x12\x32\n\x08\x45xecChat\x12\x0c.gnetcli.CMD\x1a\x12.gnetcli.CMDResult\"\x00(\x01\x30\x01\x12R\n\tAddDevice\x12\x0f.gnetcli.Device\x1a\x15.gnetcli.DeviceResult\"\x1d\x82\xd3\xe4\x93\x02\x17\"\x12/api/v1/add_device:\x01*\x12W\n\x0b\x45xecNetconf\x12\x13.gnetcli.CMDNetconf\x1a\x12.gnetcli.CMDResult\"\x1f\x82\xd3\xe4\x93\x02\x19\"\x14/api/v1/exec_netconf:\x01*\x12@\n\x0f\x45xecNetconfChat\x12\x13.gnetcli.CMDNetconf\x1a\x12.gnetcli.CMDResult\"\x00(\x01\x30\x01\x12\\\n\x08\x44ownload\x12\x1c.gnetcli.FileDownloadRequest\x1a\x14.gnetcli.FilesResult\"\x1c\x82\xd3\xe4\x93\x02\x16\"\x11/api/v1/downloads:\x01*\x12W\n\x06Upload\x12\x1a.gnetcli.FileUploadRequest\x1a\x16.google.protobuf.Empty\"\x19\x82\xd3\xe4\x93\x02\x13\"\x0e/api/v1/upload:\x01*B7Z5github.com/annetutil/gnetcli/pkg/server/proto;gnetclib\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cserver.proto\x12\x07gnetcli\x1a\x1cgoogle/api/annotations.proto\x1a\x1bgoogle/protobuf/empty.proto\";\n\x02QA\x12\x10\n\x08question\x18\x01 \x01(\t\x12\x0e\n\x06\x61nswer\x18\x02 \x01(\t\x12\x13\n\x0bnot_send_nl\x18\x03 \x01(\x08\".\n\x0b\x43redentials\x12\r\n\x05login\x18\x01 \x01(\t\x12\x10\n\x08password\x18\x02 \x01(\t\"\xb4\x01\n\x03\x43MD\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0b\n\x03\x63md\x18\x02 \x01(\t\x12\r\n\x05trace\x18\x03 \x01(\x08\x12\x17\n\x02qa\x18\x04 \x03(\x0b\x32\x0b.gnetcli.QA\x12\x14\n\x0cread_timeout\x18\x05 \x01(\x01\x12\x13\n\x0b\x63md_timeout\x18\x06 \x01(\x01\x12\x15\n\rstring_result\x18\x08 \x01(\x08\x12(\n\x0bhost_params\x18\t \x01(\x0b\x32\x13.gnetcli.HostParams\"e\n\x06\x44\x65vice\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x19\n\x11prompt_expression\x18\x02 \x01(\t\x12\x18\n\x10\x65rror_expression\x18\x03 \x01(\t\x12\x18\n\x10pager_expression\x18\x04 \x01(\t\"`\n\nCMDNetconf\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0b\n\x03\x63md\x18\x02 \x01(\t\x12\x0c\n\x04json\x18\x03 \x01(\x08\x12\x14\n\x0cread_timeout\x18\x04 \x01(\x01\x12\x13\n\x0b\x63md_timeout\x18\x05 \x01(\x01\"H\n\x0c\x43MDTraceItem\x12*\n\toperation\x18\x01 \x01(\x0e\x32\x17.gnetcli.TraceOperation\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\"\x9d\x01\n\nHostParams\x12\x0c\n\x04host\x18\x01 \x01(\t\x12)\n\x0b\x63redentials\x18\x02 \x01(\x0b\x32\x14.gnetcli.Credentials\x12\x0c\n\x04port\x18\x03 \x01(\x05\x12\x0e\n\x06\x64\x65vice\x18\x04 \x01(\t\x12\n\n\x02ip\x18\x05 \x01(\t\x12,\n\rstreamer_type\x18\x06 \x01(\x0e\x32\x15.gnetcli.StreamerType\"\x81\x01\n\tCMDResult\x12\x0b\n\x03out\x18\x01 \x01(\x0c\x12\x0f\n\x07out_str\x18\x02 \x01(\t\x12\r\n\x05\x65rror\x18\x03 \x01(\x0c\x12\x11\n\terror_str\x18\x04 \x01(\t\x12$\n\x05trace\x18\x05 \x03(\x0b\x32\x15.gnetcli.CMDTraceItem\x12\x0e\n\x06status\x18\x06 \x01(\x05\"G\n\x0c\x44\x65viceResult\x12(\n\x03res\x18\x01 \x01(\x0e\x32\x1b.gnetcli.DeviceResultStatus\x12\r\n\x05\x65rror\x18\x02 \x01(\t\"l\n\x13\x46ileDownloadRequest\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\r\n\x05paths\x18\x02 \x03(\t\x12\x0e\n\x06\x64\x65vice\x18\x03 \x01(\t\x12(\n\x0bhost_params\x18\x05 \x01(\x0b\x32\x13.gnetcli.HostParams\"K\n\x08\x46ileData\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\x12#\n\x06status\x18\x03 \x01(\x0e\x32\x13.gnetcli.FileStatus\"}\n\x11\x46ileUploadRequest\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0e\n\x06\x64\x65vice\x18\x04 \x01(\t\x12 \n\x05\x66iles\x18\x03 \x03(\x0b\x32\x11.gnetcli.FileData\x12(\n\x0bhost_params\x18\x06 \x01(\x0b\x32\x13.gnetcli.HostParams\"/\n\x0b\x46ilesResult\x12 \n\x05\x66iles\x18\x01 \x03(\x0b\x32\x11.gnetcli.FileData*f\n\x0eTraceOperation\x12\x14\n\x10Operation_notset\x10\x00\x12\x15\n\x11Operation_unknown\x10\x01\x12\x13\n\x0fOperation_write\x10\x02\x12\x12\n\x0eOperation_read\x10\x03*H\n\x12\x44\x65viceResultStatus\x12\x11\n\rDevice_notset\x10\x00\x12\r\n\tDevice_ok\x10\x01\x12\x10\n\x0c\x44\x65vice_error\x10\x02*=\n\x0cStreamerType\x12\x14\n\x10StreamerType_ssh\x10\x00\x12\x17\n\x13StreamerType_telnet\x10\x01*}\n\nFileStatus\x12\x15\n\x11\x46ileStatus_notset\x10\x00\x12\x11\n\rFileStatus_ok\x10\x01\x12\x14\n\x10\x46ileStatus_error\x10\x02\x12\x18\n\x14\x46ileStatus_not_found\x10\x03\x12\x15\n\x11\x46ileStatus_is_dir\x10\x04\x32\x8c\x05\n\x07Gnetcli\x12\x64\n\x0fSetupHostParams\x12\x13.gnetcli.HostParams\x1a\x16.google.protobuf.Empty\"$\x82\xd3\xe4\x93\x02\x1e\"\x19/api/v1/setup_host_params:\x01*\x12\x41\n\x04\x45xec\x12\x0c.gnetcli.CMD\x1a\x12.gnetcli.CMDResult\"\x17\x82\xd3\xe4\x93\x02\x11\"\x0c/api/v1/exec:\x01*\x12\x32\n\x08\x45xecChat\x12\x0c.gnetcli.CMD\x1a\x12.gnetcli.CMDResult\"\x00(\x01\x30\x01\x12R\n\tAddDevice\x12\x0f.gnetcli.Device\x1a\x15.gnetcli.DeviceResult\"\x1d\x82\xd3\xe4\x93\x02\x17\"\x12/api/v1/add_device:\x01*\x12W\n\x0b\x45xecNetconf\x12\x13.gnetcli.CMDNetconf\x1a\x12.gnetcli.CMDResult\"\x1f\x82\xd3\xe4\x93\x02\x19\"\x14/api/v1/exec_netconf:\x01*\x12@\n\x0f\x45xecNetconfChat\x12\x13.gnetcli.CMDNetconf\x1a\x12.gnetcli.CMDResult\"\x00(\x01\x30\x01\x12\\\n\x08\x44ownload\x12\x1c.gnetcli.FileDownloadRequest\x1a\x14.gnetcli.FilesResult\"\x1c\x82\xd3\xe4\x93\x02\x16\"\x11/api/v1/downloads:\x01*\x12W\n\x06Upload\x12\x1a.gnetcli.FileUploadRequest\x1a\x16.google.protobuf.Empty\"\x19\x82\xd3\xe4\x93\x02\x13\"\x0e/api/v1/upload:\x01*B7Z5github.com/annetutil/gnetcli/pkg/server/proto;gnetclib\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'server_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'Z5github.com/annetutil/gnetcli/pkg/server/proto;gnetcli' - _globals['_GNETCLI'].methods_by_name['SetupHostParams']._options = None + _globals['_GNETCLI'].methods_by_name['SetupHostParams']._loaded_options = None _globals['_GNETCLI'].methods_by_name['SetupHostParams']._serialized_options = b'\202\323\344\223\002\036\"\031/api/v1/setup_host_params:\001*' - _globals['_GNETCLI'].methods_by_name['Exec']._options = None + _globals['_GNETCLI'].methods_by_name['Exec']._loaded_options = None _globals['_GNETCLI'].methods_by_name['Exec']._serialized_options = b'\202\323\344\223\002\021\"\014/api/v1/exec:\001*' - _globals['_GNETCLI'].methods_by_name['AddDevice']._options = None + _globals['_GNETCLI'].methods_by_name['AddDevice']._loaded_options = None _globals['_GNETCLI'].methods_by_name['AddDevice']._serialized_options = b'\202\323\344\223\002\027\"\022/api/v1/add_device:\001*' - _globals['_GNETCLI'].methods_by_name['ExecNetconf']._options = None + _globals['_GNETCLI'].methods_by_name['ExecNetconf']._loaded_options = None _globals['_GNETCLI'].methods_by_name['ExecNetconf']._serialized_options = b'\202\323\344\223\002\031\"\024/api/v1/exec_netconf:\001*' - _globals['_GNETCLI'].methods_by_name['Download']._options = None + _globals['_GNETCLI'].methods_by_name['Download']._loaded_options = None _globals['_GNETCLI'].methods_by_name['Download']._serialized_options = b'\202\323\344\223\002\026\"\021/api/v1/downloads:\001*' - _globals['_GNETCLI'].methods_by_name['Upload']._options = None + _globals['_GNETCLI'].methods_by_name['Upload']._loaded_options = None _globals['_GNETCLI'].methods_by_name['Upload']._serialized_options = b'\202\323\344\223\002\023\"\016/api/v1/upload:\001*' - _globals['_TRACEOPERATION']._serialized_start=1332 - _globals['_TRACEOPERATION']._serialized_end=1434 - _globals['_DEVICERESULTSTATUS']._serialized_start=1436 - _globals['_DEVICERESULTSTATUS']._serialized_end=1508 - _globals['_FILESTATUS']._serialized_start=1510 - _globals['_FILESTATUS']._serialized_end=1635 + _globals['_TRACEOPERATION']._serialized_start=1379 + _globals['_TRACEOPERATION']._serialized_end=1481 + _globals['_DEVICERESULTSTATUS']._serialized_start=1483 + _globals['_DEVICERESULTSTATUS']._serialized_end=1555 + _globals['_STREAMERTYPE']._serialized_start=1557 + _globals['_STREAMERTYPE']._serialized_end=1618 + _globals['_FILESTATUS']._serialized_start=1620 + _globals['_FILESTATUS']._serialized_end=1745 _globals['_QA']._serialized_start=84 _globals['_QA']._serialized_end=143 _globals['_CREDENTIALS']._serialized_start=145 @@ -54,20 +66,20 @@ _globals['_CMDNETCONF']._serialized_end=575 _globals['_CMDTRACEITEM']._serialized_start=577 _globals['_CMDTRACEITEM']._serialized_end=649 - _globals['_HOSTPARAMS']._serialized_start=651 - _globals['_HOSTPARAMS']._serialized_end=762 - _globals['_CMDRESULT']._serialized_start=765 - _globals['_CMDRESULT']._serialized_end=894 - _globals['_DEVICERESULT']._serialized_start=896 - _globals['_DEVICERESULT']._serialized_end=967 - _globals['_FILEDOWNLOADREQUEST']._serialized_start=969 - _globals['_FILEDOWNLOADREQUEST']._serialized_end=1077 - _globals['_FILEDATA']._serialized_start=1079 - _globals['_FILEDATA']._serialized_end=1154 - _globals['_FILEUPLOADREQUEST']._serialized_start=1156 - _globals['_FILEUPLOADREQUEST']._serialized_end=1281 - _globals['_FILESRESULT']._serialized_start=1283 - _globals['_FILESRESULT']._serialized_end=1330 - _globals['_GNETCLI']._serialized_start=1638 - _globals['_GNETCLI']._serialized_end=2290 + _globals['_HOSTPARAMS']._serialized_start=652 + _globals['_HOSTPARAMS']._serialized_end=809 + _globals['_CMDRESULT']._serialized_start=812 + _globals['_CMDRESULT']._serialized_end=941 + _globals['_DEVICERESULT']._serialized_start=943 + _globals['_DEVICERESULT']._serialized_end=1014 + _globals['_FILEDOWNLOADREQUEST']._serialized_start=1016 + _globals['_FILEDOWNLOADREQUEST']._serialized_end=1124 + _globals['_FILEDATA']._serialized_start=1126 + _globals['_FILEDATA']._serialized_end=1201 + _globals['_FILEUPLOADREQUEST']._serialized_start=1203 + _globals['_FILEUPLOADREQUEST']._serialized_end=1328 + _globals['_FILESRESULT']._serialized_start=1330 + _globals['_FILESRESULT']._serialized_end=1377 + _globals['_GNETCLI']._serialized_start=1748 + _globals['_GNETCLI']._serialized_end=2400 # @@protoc_insertion_point(module_scope) diff --git a/pkg/server/proto/server_pb2.pyi b/pkg/server/proto/server_pb2.pyi index 2b1409cc..e147da4f 100644 --- a/pkg/server/proto/server_pb2.pyi +++ b/pkg/server/proto/server_pb2.pyi @@ -4,7 +4,8 @@ from google.protobuf.internal import containers as _containers from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message -from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union +from collections.abc import Iterable as _Iterable, Mapping as _Mapping +from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union DESCRIPTOR: _descriptor.FileDescriptor @@ -21,6 +22,11 @@ class DeviceResultStatus(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): Device_ok: _ClassVar[DeviceResultStatus] Device_error: _ClassVar[DeviceResultStatus] +class StreamerType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + StreamerType_ssh: _ClassVar[StreamerType] + StreamerType_telnet: _ClassVar[StreamerType] + class FileStatus(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): __slots__ = () FileStatus_notset: _ClassVar[FileStatus] @@ -35,6 +41,8 @@ Operation_read: TraceOperation Device_notset: DeviceResultStatus Device_ok: DeviceResultStatus Device_error: DeviceResultStatus +StreamerType_ssh: StreamerType +StreamerType_telnet: StreamerType FileStatus_notset: FileStatus FileStatus_ok: FileStatus FileStatus_error: FileStatus @@ -114,18 +122,20 @@ class CMDTraceItem(_message.Message): def __init__(self, operation: _Optional[_Union[TraceOperation, str]] = ..., data: _Optional[bytes] = ...) -> None: ... class HostParams(_message.Message): - __slots__ = ("host", "credentials", "port", "device", "ip") + __slots__ = ("host", "credentials", "port", "device", "ip", "streamer_type") HOST_FIELD_NUMBER: _ClassVar[int] CREDENTIALS_FIELD_NUMBER: _ClassVar[int] PORT_FIELD_NUMBER: _ClassVar[int] DEVICE_FIELD_NUMBER: _ClassVar[int] IP_FIELD_NUMBER: _ClassVar[int] + STREAMER_TYPE_FIELD_NUMBER: _ClassVar[int] host: str credentials: Credentials port: int device: str ip: str - def __init__(self, host: _Optional[str] = ..., credentials: _Optional[_Union[Credentials, _Mapping]] = ..., port: _Optional[int] = ..., device: _Optional[str] = ..., ip: _Optional[str] = ...) -> None: ... + streamer_type: StreamerType + def __init__(self, host: _Optional[str] = ..., credentials: _Optional[_Union[Credentials, _Mapping]] = ..., port: _Optional[int] = ..., device: _Optional[str] = ..., ip: _Optional[str] = ..., streamer_type: _Optional[_Union[StreamerType, str]] = ...) -> None: ... class CMDResult(_message.Message): __slots__ = ("out", "out_str", "error", "error_str", "trace", "status") diff --git a/pkg/server/proto/server_pb2_grpc.py b/pkg/server/proto/server_pb2_grpc.py index 489f79d9..1145f940 100644 --- a/pkg/server/proto/server_pb2_grpc.py +++ b/pkg/server/proto/server_pb2_grpc.py @@ -1,10 +1,30 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc +import warnings from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 from . import server_pb2 as server__pb2 +GRPC_GENERATED_VERSION = '1.76.0' +GRPC_VERSION = grpc.__version__ +_version_not_supported = False + +try: + from grpc._utilities import first_version_is_lower + _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION) +except ImportError: + _version_not_supported = True + +if _version_not_supported: + raise RuntimeError( + f'The grpc package installed is at version {GRPC_VERSION},' + + ' but the generated code in server_pb2_grpc.py depends on' + + f' grpcio>={GRPC_GENERATED_VERSION}.' + + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' + + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' + ) + class GnetcliStub(object): """Missing associated documentation comment in .proto file.""" @@ -19,42 +39,42 @@ def __init__(self, channel): '/gnetcli.Gnetcli/SetupHostParams', request_serializer=server__pb2.HostParams.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) + _registered_method=True) self.Exec = channel.unary_unary( '/gnetcli.Gnetcli/Exec', request_serializer=server__pb2.CMD.SerializeToString, response_deserializer=server__pb2.CMDResult.FromString, - ) + _registered_method=True) self.ExecChat = channel.stream_stream( '/gnetcli.Gnetcli/ExecChat', request_serializer=server__pb2.CMD.SerializeToString, response_deserializer=server__pb2.CMDResult.FromString, - ) + _registered_method=True) self.AddDevice = channel.unary_unary( '/gnetcli.Gnetcli/AddDevice', request_serializer=server__pb2.Device.SerializeToString, response_deserializer=server__pb2.DeviceResult.FromString, - ) + _registered_method=True) self.ExecNetconf = channel.unary_unary( '/gnetcli.Gnetcli/ExecNetconf', request_serializer=server__pb2.CMDNetconf.SerializeToString, response_deserializer=server__pb2.CMDResult.FromString, - ) + _registered_method=True) self.ExecNetconfChat = channel.stream_stream( '/gnetcli.Gnetcli/ExecNetconfChat', request_serializer=server__pb2.CMDNetconf.SerializeToString, response_deserializer=server__pb2.CMDResult.FromString, - ) + _registered_method=True) self.Download = channel.unary_unary( '/gnetcli.Gnetcli/Download', request_serializer=server__pb2.FileDownloadRequest.SerializeToString, response_deserializer=server__pb2.FilesResult.FromString, - ) + _registered_method=True) self.Upload = channel.unary_unary( '/gnetcli.Gnetcli/Upload', request_serializer=server__pb2.FileUploadRequest.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) + _registered_method=True) class GnetcliServicer(object): @@ -155,6 +175,7 @@ def add_GnetcliServicer_to_server(servicer, server): generic_handler = grpc.method_handlers_generic_handler( 'gnetcli.Gnetcli', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers('gnetcli.Gnetcli', rpc_method_handlers) # This class is part of an EXPERIMENTAL API. @@ -172,11 +193,21 @@ def SetupHostParams(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/gnetcli.Gnetcli/SetupHostParams', + return grpc.experimental.unary_unary( + request, + target, + '/gnetcli.Gnetcli/SetupHostParams', server__pb2.HostParams.SerializeToString, google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def Exec(request, @@ -189,11 +220,21 @@ def Exec(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/gnetcli.Gnetcli/Exec', + return grpc.experimental.unary_unary( + request, + target, + '/gnetcli.Gnetcli/Exec', server__pb2.CMD.SerializeToString, server__pb2.CMDResult.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def ExecChat(request_iterator, @@ -206,11 +247,21 @@ def ExecChat(request_iterator, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.stream_stream(request_iterator, target, '/gnetcli.Gnetcli/ExecChat', + return grpc.experimental.stream_stream( + request_iterator, + target, + '/gnetcli.Gnetcli/ExecChat', server__pb2.CMD.SerializeToString, server__pb2.CMDResult.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def AddDevice(request, @@ -223,11 +274,21 @@ def AddDevice(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/gnetcli.Gnetcli/AddDevice', + return grpc.experimental.unary_unary( + request, + target, + '/gnetcli.Gnetcli/AddDevice', server__pb2.Device.SerializeToString, server__pb2.DeviceResult.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def ExecNetconf(request, @@ -240,11 +301,21 @@ def ExecNetconf(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/gnetcli.Gnetcli/ExecNetconf', + return grpc.experimental.unary_unary( + request, + target, + '/gnetcli.Gnetcli/ExecNetconf', server__pb2.CMDNetconf.SerializeToString, server__pb2.CMDResult.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def ExecNetconfChat(request_iterator, @@ -257,11 +328,21 @@ def ExecNetconfChat(request_iterator, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.stream_stream(request_iterator, target, '/gnetcli.Gnetcli/ExecNetconfChat', + return grpc.experimental.stream_stream( + request_iterator, + target, + '/gnetcli.Gnetcli/ExecNetconfChat', server__pb2.CMDNetconf.SerializeToString, server__pb2.CMDResult.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def Download(request, @@ -274,11 +355,21 @@ def Download(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/gnetcli.Gnetcli/Download', + return grpc.experimental.unary_unary( + request, + target, + '/gnetcli.Gnetcli/Download', server__pb2.FileDownloadRequest.SerializeToString, server__pb2.FilesResult.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def Upload(request, @@ -291,8 +382,18 @@ def Upload(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/gnetcli.Gnetcli/Upload', + return grpc.experimental.unary_unary( + request, + target, + '/gnetcli.Gnetcli/Upload', server__pb2.FileUploadRequest.SerializeToString, google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) From 8f385dd42ae8c20d8c02970cde1dcef5689426b4 Mon Sep 17 00:00:00 2001 From: vadvolo Date: Fri, 22 May 2026 15:04:43 +0200 Subject: [PATCH 3/3] telnet: grpc_sdk client --- grpc_sdk/python/gnetclisdk/client.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/grpc_sdk/python/gnetclisdk/client.py b/grpc_sdk/python/gnetclisdk/client.py index ff79703d..5853ca6e 100644 --- a/grpc_sdk/python/gnetclisdk/client.py +++ b/grpc_sdk/python/gnetclisdk/client.py @@ -7,7 +7,7 @@ from contextlib import asynccontextmanager from dataclasses import dataclass, field from functools import partial -from typing import Any, AsyncIterator, List, Optional, Tuple, Dict, Callable +from typing import Any, AsyncIterator, List, Optional, Tuple, Dict, Callable, Union import grpc from google.protobuf.message import Message @@ -25,6 +25,9 @@ SERVER_ENV = "GNETCLI_SERVER" GRPC_MAX_MESSAGE_LENGTH = 130 * 1024**2 +STREAMER_SSH = server_pb2.StreamerType_ssh +STREAMER_TELNET = server_pb2.StreamerType_telnet + default_grpc_options: List[Tuple[str, Any]] = [ ("grpc.max_concurrent_streams", 900), ("grpc.max_send_message_length", GRPC_MAX_MESSAGE_LENGTH), @@ -72,7 +75,7 @@ class HostParams: hostname: Optional[str] = None credentials: Optional[Credentials] = None ip: Optional[str] = None - streamer_type: Optional[server_pb2.StreamerType] = None + streamer_type: Optional[int] = None def make_pb(self) -> server_pb2.HostParams: creds_pb: Optional[server_pb2.Credentials] = None @@ -84,7 +87,7 @@ def make_pb(self) -> server_pb2.HostParams: credentials=creds_pb, device=self.device, ip=self.ip, - streamer_type=self.streamer_type if self.streamer_type is not None else server_pb2.StreamerType.StreamerType_ssh, + streamer_type=self.streamer_type if self.streamer_type is not None else server_pb2.StreamerType_ssh, ) return pbcmd