From 06a67978ed5da408cf296203adb762074a968b12 Mon Sep 17 00:00:00 2001 From: lwch Date: Wed, 27 Oct 2021 18:06:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3pb=E5=AE=9A=E4=B9=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/client/tunnel/vnc/core/process.go | 6 +- .../client/tunnel/vnc/core/process_windows.go | 6 +- .../vnc/core/{msg.pb.go => vncmsg.pb.go} | 306 +++++++++--------- .../vnc/core/{msg.proto => vncmsg.proto} | 2 +- contrib/build/build | 9 +- 5 files changed, 161 insertions(+), 168 deletions(-) rename code/client/tunnel/vnc/core/{msg.pb.go => vncmsg.pb.go} (51%) rename code/client/tunnel/vnc/core/{msg.proto => vncmsg.proto} (97%) diff --git a/code/client/tunnel/vnc/core/process.go b/code/client/tunnel/vnc/core/process.go index 7aff928..69a5624 100644 --- a/code/client/tunnel/vnc/core/process.go +++ b/code/client/tunnel/vnc/core/process.go @@ -23,7 +23,7 @@ const ( type Process struct { pid int srv *http.Server - chWrite chan *Msg + chWrite chan *VncMsg chImage chan *ImageData } @@ -70,13 +70,13 @@ func (p *Process) ws(w http.ResponseWriter, r *http.Request) { logging.Error("read message: %v", err) return } - var msg Msg + var msg VncMsg err = proto.Unmarshal(data, &msg) if err != nil { continue } switch msg.GetXType() { - case Msg_capture_data: + case VncMsg_capture_data: p.chImage <- msg.GetData() default: } diff --git a/code/client/tunnel/vnc/core/process_windows.go b/code/client/tunnel/vnc/core/process_windows.go index a40cdbd..a69311f 100644 --- a/code/client/tunnel/vnc/core/process_windows.go +++ b/code/client/tunnel/vnc/core/process_windows.go @@ -90,7 +90,7 @@ func createWorker(tk windows.Token) (*Process, error) { return nil, err } var p Process - p.chWrite = make(chan *Msg) + p.chWrite = make(chan *VncMsg) p.chImage = make(chan *ImageData) port, err := p.listenAndServe() if err != nil { @@ -129,8 +129,8 @@ func (p *Process) Close() { } func (p *Process) Capture(timeout time.Duration) (*image.RGBA, error) { - var msg Msg - msg.XType = Msg_capture_req + var msg VncMsg + msg.XType = VncMsg_capture_req p.chWrite <- &msg trans := func(data *ImageData) *image.RGBA { img := image.NewRGBA(image.Rect(0, 0, int(data.GetWidth()), int(data.GetHeight()))) diff --git a/code/client/tunnel/vnc/core/msg.pb.go b/code/client/tunnel/vnc/core/vncmsg.pb.go similarity index 51% rename from code/client/tunnel/vnc/core/msg.pb.go rename to code/client/tunnel/vnc/core/vncmsg.pb.go index 1a2e35c..0c197b5 100644 --- a/code/client/tunnel/vnc/core/msg.pb.go +++ b/code/client/tunnel/vnc/core/vncmsg.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.16.0 -// source: msg.proto +// source: vncmsg.proto package core @@ -53,11 +53,11 @@ func (x Status) String() string { } func (Status) Descriptor() protoreflect.EnumDescriptor { - return file_msg_proto_enumTypes[0].Descriptor() + return file_vncmsg_proto_enumTypes[0].Descriptor() } func (Status) Type() protoreflect.EnumType { - return &file_msg_proto_enumTypes[0] + return &file_vncmsg_proto_enumTypes[0] } func (x Status) Number() protoreflect.EnumNumber { @@ -66,7 +66,7 @@ func (x Status) Number() protoreflect.EnumNumber { // Deprecated: Use Status.Descriptor instead. func (Status) EnumDescriptor() ([]byte, []int) { - return file_msg_proto_rawDescGZIP(), []int{0} + return file_vncmsg_proto_rawDescGZIP(), []int{0} } type MouseDataButton int32 @@ -105,11 +105,11 @@ func (x MouseDataButton) String() string { } func (MouseDataButton) Descriptor() protoreflect.EnumDescriptor { - return file_msg_proto_enumTypes[1].Descriptor() + return file_vncmsg_proto_enumTypes[1].Descriptor() } func (MouseDataButton) Type() protoreflect.EnumType { - return &file_msg_proto_enumTypes[1] + return &file_vncmsg_proto_enumTypes[1] } func (x MouseDataButton) Number() protoreflect.EnumNumber { @@ -118,29 +118,29 @@ func (x MouseDataButton) Number() protoreflect.EnumNumber { // Deprecated: Use MouseDataButton.Descriptor instead. func (MouseDataButton) EnumDescriptor() ([]byte, []int) { - return file_msg_proto_rawDescGZIP(), []int{1, 0} + return file_vncmsg_proto_rawDescGZIP(), []int{1, 0} } -type MsgType int32 +type VncMsgType int32 const ( - Msg_capture_req MsgType = 0 - Msg_capture_data MsgType = 1 - Msg_mouse_event MsgType = 2 - Msg_keyboard_event MsgType = 3 - Msg_cad_event MsgType = 4 + VncMsg_capture_req VncMsgType = 0 + VncMsg_capture_data VncMsgType = 1 + VncMsg_mouse_event VncMsgType = 2 + VncMsg_keyboard_event VncMsgType = 3 + VncMsg_cad_event VncMsgType = 4 ) -// Enum value maps for MsgType. +// Enum value maps for VncMsgType. var ( - MsgType_name = map[int32]string{ + VncMsgType_name = map[int32]string{ 0: "capture_req", 1: "capture_data", 2: "mouse_event", 3: "keyboard_event", 4: "cad_event", } - MsgType_value = map[string]int32{ + VncMsgType_value = map[string]int32{ "capture_req": 0, "capture_data": 1, "mouse_event": 2, @@ -149,31 +149,31 @@ var ( } ) -func (x MsgType) Enum() *MsgType { - p := new(MsgType) +func (x VncMsgType) Enum() *VncMsgType { + p := new(VncMsgType) *p = x return p } -func (x MsgType) String() string { +func (x VncMsgType) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (MsgType) Descriptor() protoreflect.EnumDescriptor { - return file_msg_proto_enumTypes[2].Descriptor() +func (VncMsgType) Descriptor() protoreflect.EnumDescriptor { + return file_vncmsg_proto_enumTypes[2].Descriptor() } -func (MsgType) Type() protoreflect.EnumType { - return &file_msg_proto_enumTypes[2] +func (VncMsgType) Type() protoreflect.EnumType { + return &file_vncmsg_proto_enumTypes[2] } -func (x MsgType) Number() protoreflect.EnumNumber { +func (x VncMsgType) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } -// Deprecated: Use MsgType.Descriptor instead. -func (MsgType) EnumDescriptor() ([]byte, []int) { - return file_msg_proto_rawDescGZIP(), []int{3, 0} +// Deprecated: Use VncMsgType.Descriptor instead. +func (VncMsgType) EnumDescriptor() ([]byte, []int) { + return file_vncmsg_proto_rawDescGZIP(), []int{3, 0} } type ImageData struct { @@ -190,7 +190,7 @@ type ImageData struct { func (x *ImageData) Reset() { *x = ImageData{} if protoimpl.UnsafeEnabled { - mi := &file_msg_proto_msgTypes[0] + mi := &file_vncmsg_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -203,7 +203,7 @@ func (x *ImageData) String() string { func (*ImageData) ProtoMessage() {} func (x *ImageData) ProtoReflect() protoreflect.Message { - mi := &file_msg_proto_msgTypes[0] + mi := &file_vncmsg_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -216,7 +216,7 @@ func (x *ImageData) ProtoReflect() protoreflect.Message { // Deprecated: Use ImageData.ProtoReflect.Descriptor instead. func (*ImageData) Descriptor() ([]byte, []int) { - return file_msg_proto_rawDescGZIP(), []int{0} + return file_vncmsg_proto_rawDescGZIP(), []int{0} } func (x *ImageData) GetBits() uint32 { @@ -261,7 +261,7 @@ type MouseData struct { func (x *MouseData) Reset() { *x = MouseData{} if protoimpl.UnsafeEnabled { - mi := &file_msg_proto_msgTypes[1] + mi := &file_vncmsg_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -274,7 +274,7 @@ func (x *MouseData) String() string { func (*MouseData) ProtoMessage() {} func (x *MouseData) ProtoReflect() protoreflect.Message { - mi := &file_msg_proto_msgTypes[1] + mi := &file_vncmsg_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -287,7 +287,7 @@ func (x *MouseData) ProtoReflect() protoreflect.Message { // Deprecated: Use MouseData.ProtoReflect.Descriptor instead. func (*MouseData) Descriptor() ([]byte, []int) { - return file_msg_proto_rawDescGZIP(), []int{1} + return file_vncmsg_proto_rawDescGZIP(), []int{1} } func (x *MouseData) GetType() Status { @@ -330,7 +330,7 @@ type KeyboardData struct { func (x *KeyboardData) Reset() { *x = KeyboardData{} if protoimpl.UnsafeEnabled { - mi := &file_msg_proto_msgTypes[2] + mi := &file_vncmsg_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -343,7 +343,7 @@ func (x *KeyboardData) String() string { func (*KeyboardData) ProtoMessage() {} func (x *KeyboardData) ProtoReflect() protoreflect.Message { - mi := &file_msg_proto_msgTypes[2] + mi := &file_vncmsg_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -356,7 +356,7 @@ func (x *KeyboardData) ProtoReflect() protoreflect.Message { // Deprecated: Use KeyboardData.ProtoReflect.Descriptor instead. func (*KeyboardData) Descriptor() ([]byte, []int) { - return file_msg_proto_rawDescGZIP(), []int{2} + return file_vncmsg_proto_rawDescGZIP(), []int{2} } func (x *KeyboardData) GetType() Status { @@ -373,36 +373,36 @@ func (x *KeyboardData) GetKey() string { return "" } -type Msg struct { +type VncMsg struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - XType MsgType `protobuf:"varint,1,opt,name=_type,json=Type,proto3,enum=core.MsgType" json:"_type,omitempty"` + XType VncMsgType `protobuf:"varint,1,opt,name=_type,json=Type,proto3,enum=core.VncMsgType" json:"_type,omitempty"` // Types that are assignable to Payload: - // *Msg_Data - // *Msg_Mouse - // *Msg_Keyboard - Payload isMsg_Payload `protobuf_oneof:"payload"` + // *VncMsg_Data + // *VncMsg_Mouse + // *VncMsg_Keyboard + Payload isVncMsg_Payload `protobuf_oneof:"payload"` } -func (x *Msg) Reset() { - *x = Msg{} +func (x *VncMsg) Reset() { + *x = VncMsg{} if protoimpl.UnsafeEnabled { - mi := &file_msg_proto_msgTypes[3] + mi := &file_vncmsg_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *Msg) String() string { +func (x *VncMsg) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Msg) ProtoMessage() {} +func (*VncMsg) ProtoMessage() {} -func (x *Msg) ProtoReflect() protoreflect.Message { - mi := &file_msg_proto_msgTypes[3] +func (x *VncMsg) ProtoReflect() protoreflect.Message { + mi := &file_vncmsg_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -413,149 +413,149 @@ func (x *Msg) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Msg.ProtoReflect.Descriptor instead. -func (*Msg) Descriptor() ([]byte, []int) { - return file_msg_proto_rawDescGZIP(), []int{3} +// Deprecated: Use VncMsg.ProtoReflect.Descriptor instead. +func (*VncMsg) Descriptor() ([]byte, []int) { + return file_vncmsg_proto_rawDescGZIP(), []int{3} } -func (x *Msg) GetXType() MsgType { +func (x *VncMsg) GetXType() VncMsgType { if x != nil { return x.XType } - return Msg_capture_req + return VncMsg_capture_req } -func (m *Msg) GetPayload() isMsg_Payload { +func (m *VncMsg) GetPayload() isVncMsg_Payload { if m != nil { return m.Payload } return nil } -func (x *Msg) GetData() *ImageData { - if x, ok := x.GetPayload().(*Msg_Data); ok { +func (x *VncMsg) GetData() *ImageData { + if x, ok := x.GetPayload().(*VncMsg_Data); ok { return x.Data } return nil } -func (x *Msg) GetMouse() *MouseData { - if x, ok := x.GetPayload().(*Msg_Mouse); ok { +func (x *VncMsg) GetMouse() *MouseData { + if x, ok := x.GetPayload().(*VncMsg_Mouse); ok { return x.Mouse } return nil } -func (x *Msg) GetKeyboard() *KeyboardData { - if x, ok := x.GetPayload().(*Msg_Keyboard); ok { +func (x *VncMsg) GetKeyboard() *KeyboardData { + if x, ok := x.GetPayload().(*VncMsg_Keyboard); ok { return x.Keyboard } return nil } -type isMsg_Payload interface { - isMsg_Payload() +type isVncMsg_Payload interface { + isVncMsg_Payload() } -type Msg_Data struct { +type VncMsg_Data struct { Data *ImageData `protobuf:"bytes,2,opt,name=data,proto3,oneof"` } -type Msg_Mouse struct { +type VncMsg_Mouse struct { Mouse *MouseData `protobuf:"bytes,3,opt,name=mouse,proto3,oneof"` } -type Msg_Keyboard struct { +type VncMsg_Keyboard struct { Keyboard *KeyboardData `protobuf:"bytes,4,opt,name=keyboard,proto3,oneof"` } -func (*Msg_Data) isMsg_Payload() {} +func (*VncMsg_Data) isVncMsg_Payload() {} -func (*Msg_Mouse) isMsg_Payload() {} +func (*VncMsg_Mouse) isVncMsg_Payload() {} -func (*Msg_Keyboard) isMsg_Payload() {} +func (*VncMsg_Keyboard) isVncMsg_Payload() {} -var File_msg_proto protoreflect.FileDescriptor +var File_vncmsg_proto protoreflect.FileDescriptor -var file_msg_proto_rawDesc = []byte{ - 0x0a, 0x09, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x63, 0x6f, 0x72, - 0x65, 0x22, 0x62, 0x0a, 0x0a, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x12, - 0x12, 0x0a, 0x04, 0x62, 0x69, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x62, - 0x69, 0x74, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, - 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, - 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xaf, 0x01, 0x0a, 0x0a, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x5f, - 0x64, 0x61, 0x74, 0x61, 0x12, 0x20, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x03, 0x62, 0x74, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, - 0x5f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x52, 0x03, 0x62, 0x74, - 0x6e, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x01, 0x78, 0x12, - 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x01, 0x79, 0x22, 0x38, 0x0a, - 0x06, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x12, 0x0d, 0x0a, 0x09, 0x75, 0x6e, 0x73, 0x65, 0x74, - 0x5f, 0x62, 0x74, 0x6e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x6c, 0x65, 0x66, 0x74, 0x10, 0x01, - 0x12, 0x0a, 0x0a, 0x06, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, - 0x72, 0x69, 0x67, 0x68, 0x74, 0x10, 0x03, 0x22, 0x43, 0x0a, 0x0d, 0x6b, 0x65, 0x79, 0x62, 0x6f, - 0x61, 0x72, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x12, 0x20, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x73, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x99, 0x02, 0x0a, - 0x03, 0x6d, 0x73, 0x67, 0x12, 0x23, 0x0a, 0x05, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x69, - 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x12, 0x28, 0x0a, 0x05, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x5f, 0x64, 0x61, - 0x74, 0x61, 0x48, 0x00, 0x52, 0x05, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x08, 0x6b, - 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x6b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x5f, 0x64, 0x61, - 0x74, 0x61, 0x48, 0x00, 0x52, 0x08, 0x6b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x22, 0x5d, - 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, - 0x65, 0x5f, 0x72, 0x65, 0x71, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x74, 0x75, - 0x72, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x6d, 0x6f, 0x75, - 0x73, 0x65, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x6b, 0x65, - 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x10, 0x03, 0x12, 0x0d, - 0x0a, 0x09, 0x63, 0x61, 0x64, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x42, 0x09, 0x0a, - 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2a, 0x28, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x0c, 0x0a, 0x08, 0x75, 0x6e, 0x73, 0x65, 0x74, 0x5f, 0x73, 0x74, 0x10, 0x00, - 0x12, 0x08, 0x0a, 0x04, 0x64, 0x6f, 0x77, 0x6e, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x75, 0x70, - 0x10, 0x02, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x3b, 0x63, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, +var file_vncmsg_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x76, 0x6e, 0x63, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, + 0x63, 0x6f, 0x72, 0x65, 0x22, 0x62, 0x0a, 0x0a, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x64, 0x61, + 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x69, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x04, 0x62, 0x69, 0x74, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x77, 0x69, 0x64, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, + 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x68, 0x65, + 0x69, 0x67, 0x68, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xaf, 0x01, 0x0a, 0x0a, 0x6d, 0x6f, 0x75, + 0x73, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x12, 0x20, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x03, 0x62, 0x74, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x6d, 0x6f, + 0x75, 0x73, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x52, + 0x03, 0x62, 0x74, 0x6e, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x01, 0x79, + 0x22, 0x38, 0x0a, 0x06, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x12, 0x0d, 0x0a, 0x09, 0x75, 0x6e, + 0x73, 0x65, 0x74, 0x5f, 0x62, 0x74, 0x6e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x6c, 0x65, 0x66, + 0x74, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x10, 0x02, 0x12, + 0x09, 0x0a, 0x05, 0x72, 0x69, 0x67, 0x68, 0x74, 0x10, 0x03, 0x22, 0x43, 0x0a, 0x0d, 0x6b, 0x65, + 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x12, 0x20, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x63, 0x6f, 0x72, 0x65, + 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, + 0xa1, 0x02, 0x0a, 0x07, 0x76, 0x6e, 0x63, 0x5f, 0x6d, 0x73, 0x67, 0x12, 0x27, 0x0a, 0x05, 0x5f, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x63, 0x6f, 0x72, + 0x65, 0x2e, 0x76, 0x6e, 0x63, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x52, 0x04, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, + 0x64, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x28, 0x0a, 0x05, + 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, + 0x72, 0x65, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, + 0x05, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x62, 0x6f, 0x61, + 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, + 0x6b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, + 0x08, 0x6b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x22, 0x5d, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x72, 0x65, 0x71, + 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x64, 0x61, + 0x74, 0x61, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x5f, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x6b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, + 0x64, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x63, 0x61, 0x64, + 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x2a, 0x28, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0c, 0x0a, + 0x08, 0x75, 0x6e, 0x73, 0x65, 0x74, 0x5f, 0x73, 0x74, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x64, + 0x6f, 0x77, 0x6e, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x75, 0x70, 0x10, 0x02, 0x42, 0x09, 0x5a, + 0x07, 0x2e, 0x2f, 0x3b, 0x63, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_msg_proto_rawDescOnce sync.Once - file_msg_proto_rawDescData = file_msg_proto_rawDesc + file_vncmsg_proto_rawDescOnce sync.Once + file_vncmsg_proto_rawDescData = file_vncmsg_proto_rawDesc ) -func file_msg_proto_rawDescGZIP() []byte { - file_msg_proto_rawDescOnce.Do(func() { - file_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_msg_proto_rawDescData) +func file_vncmsg_proto_rawDescGZIP() []byte { + file_vncmsg_proto_rawDescOnce.Do(func() { + file_vncmsg_proto_rawDescData = protoimpl.X.CompressGZIP(file_vncmsg_proto_rawDescData) }) - return file_msg_proto_rawDescData + return file_vncmsg_proto_rawDescData } -var file_msg_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_msg_proto_goTypes = []interface{}{ +var file_vncmsg_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_vncmsg_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_vncmsg_proto_goTypes = []interface{}{ (Status)(0), // 0: core.status (MouseDataButton)(0), // 1: core.mouse_data.button - (MsgType)(0), // 2: core.msg.type + (VncMsgType)(0), // 2: core.vnc_msg.type (*ImageData)(nil), // 3: core.image_data (*MouseData)(nil), // 4: core.mouse_data (*KeyboardData)(nil), // 5: core.keyboard_data - (*Msg)(nil), // 6: core.msg + (*VncMsg)(nil), // 6: core.vnc_msg } -var file_msg_proto_depIdxs = []int32{ +var file_vncmsg_proto_depIdxs = []int32{ 0, // 0: core.mouse_data.type:type_name -> core.status 1, // 1: core.mouse_data.btn:type_name -> core.mouse_data.button 0, // 2: core.keyboard_data.type:type_name -> core.status - 2, // 3: core.msg._type:type_name -> core.msg.type - 3, // 4: core.msg.data:type_name -> core.image_data - 4, // 5: core.msg.mouse:type_name -> core.mouse_data - 5, // 6: core.msg.keyboard:type_name -> core.keyboard_data + 2, // 3: core.vnc_msg._type:type_name -> core.vnc_msg.type + 3, // 4: core.vnc_msg.data:type_name -> core.image_data + 4, // 5: core.vnc_msg.mouse:type_name -> core.mouse_data + 5, // 6: core.vnc_msg.keyboard:type_name -> core.keyboard_data 7, // [7:7] is the sub-list for method output_type 7, // [7:7] is the sub-list for method input_type 7, // [7:7] is the sub-list for extension type_name @@ -563,13 +563,13 @@ var file_msg_proto_depIdxs = []int32{ 0, // [0:7] is the sub-list for field type_name } -func init() { file_msg_proto_init() } -func file_msg_proto_init() { - if File_msg_proto != nil { +func init() { file_vncmsg_proto_init() } +func file_vncmsg_proto_init() { + if File_vncmsg_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_vncmsg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ImageData); i { case 0: return &v.state @@ -581,7 +581,7 @@ func file_msg_proto_init() { return nil } } - file_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_vncmsg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MouseData); i { case 0: return &v.state @@ -593,7 +593,7 @@ func file_msg_proto_init() { return nil } } - file_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_vncmsg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*KeyboardData); i { case 0: return &v.state @@ -605,8 +605,8 @@ func file_msg_proto_init() { return nil } } - file_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Msg); i { + file_vncmsg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VncMsg); i { case 0: return &v.state case 1: @@ -618,28 +618,28 @@ func file_msg_proto_init() { } } } - file_msg_proto_msgTypes[3].OneofWrappers = []interface{}{ - (*Msg_Data)(nil), - (*Msg_Mouse)(nil), - (*Msg_Keyboard)(nil), + file_vncmsg_proto_msgTypes[3].OneofWrappers = []interface{}{ + (*VncMsg_Data)(nil), + (*VncMsg_Mouse)(nil), + (*VncMsg_Keyboard)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_msg_proto_rawDesc, + RawDescriptor: file_vncmsg_proto_rawDesc, NumEnums: 3, NumMessages: 4, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_msg_proto_goTypes, - DependencyIndexes: file_msg_proto_depIdxs, - EnumInfos: file_msg_proto_enumTypes, - MessageInfos: file_msg_proto_msgTypes, + GoTypes: file_vncmsg_proto_goTypes, + DependencyIndexes: file_vncmsg_proto_depIdxs, + EnumInfos: file_vncmsg_proto_enumTypes, + MessageInfos: file_vncmsg_proto_msgTypes, }.Build() - File_msg_proto = out.File - file_msg_proto_rawDesc = nil - file_msg_proto_goTypes = nil - file_msg_proto_depIdxs = nil + File_vncmsg_proto = out.File + file_vncmsg_proto_rawDesc = nil + file_vncmsg_proto_goTypes = nil + file_vncmsg_proto_depIdxs = nil } diff --git a/code/client/tunnel/vnc/core/msg.proto b/code/client/tunnel/vnc/core/vncmsg.proto similarity index 97% rename from code/client/tunnel/vnc/core/msg.proto rename to code/client/tunnel/vnc/core/vncmsg.proto index 31f7f1c..f39cb0c 100644 --- a/code/client/tunnel/vnc/core/msg.proto +++ b/code/client/tunnel/vnc/core/vncmsg.proto @@ -34,7 +34,7 @@ message keyboard_data { string key = 2; } -message msg { +message vnc_msg { enum type { capture_req = 0; capture_data = 1; diff --git a/contrib/build/build b/contrib/build/build index 58ca960..f59b222 100755 --- a/contrib/build/build +++ b/contrib/build/build @@ -19,11 +19,4 @@ go run contrib/bindata/main.go -pkg dashboard -o code/client/dashboard/assets.go -prefix html/dashboard "$@" html/dashboard/... CGO_ENABLED=0 go build -ldflags "$LDFLAGS" -o bin/np-svr code/server/*.go -CGO_ENABLED=0 go build -ldflags "$LDFLAGS" -o bin/np-cli code/client/*.go - -CGO_ENABLED=0 GOOS=windows \ -CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ \ -go build -ldflags "$LDFLAGS" -o bin/np-svr.exe code/server/*.go -CGO_ENABLED=0 GOOS=windows \ -CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ \ -go build -ldflags "$LDFLAGS" -o bin/np-cli.exe code/client/*.go \ No newline at end of file +CGO_ENABLED=0 go build -ldflags "$LDFLAGS" -o bin/np-cli code/client/*.go \ No newline at end of file