From 573accea030ba91ce66f586bb8d8d0f540c85a17 Mon Sep 17 00:00:00 2001 From: lwch Date: Mon, 18 Oct 2021 10:35:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E4=B9=89VNC=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/network/connect.pb.go | 20 +- code/network/connect.proto | 1 + code/network/msg.pb.go | 185 ++++++++---- code/network/msg.proto | 14 +- code/network/vnc.pb.go | 558 +++++++++++++++++++++++++++++++++++++ code/network/vnc.proto | 44 +++ conf/tunnel.d/vnc.yaml | 5 + 7 files changed, 764 insertions(+), 63 deletions(-) create mode 100644 code/network/vnc.pb.go create mode 100644 code/network/vnc.proto create mode 100644 conf/tunnel.d/vnc.yaml diff --git a/code/network/connect.pb.go b/code/network/connect.pb.go index 45e4483..d8f4ce8 100644 --- a/code/network/connect.pb.go +++ b/code/network/connect.pb.go @@ -26,6 +26,7 @@ const ( ConnectRequest_tcp ConnectRequestType = 0 ConnectRequest_udp ConnectRequestType = 1 ConnectRequest_shell ConnectRequestType = 2 + ConnectRequest_vnc ConnectRequestType = 3 ) // Enum value maps for ConnectRequestType. @@ -34,11 +35,13 @@ var ( 0: "tcp", 1: "udp", 2: "shell", + 3: "vnc", } ConnectRequestType_value = map[string]int32{ "tcp": 0, "udp": 1, "shell": 2, + "vnc": 3, } ) @@ -341,7 +344,7 @@ var file_connect_proto_rawDesc = []byte{ 0x22, 0x35, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x65, 0x78, 0x65, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x65, 0x78, 0x65, 0x63, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x76, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x03, 0x65, 0x6e, 0x76, 0x22, 0xea, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, + 0x28, 0x09, 0x52, 0x03, 0x65, 0x6e, 0x76, 0x22, 0xf3, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x32, 0x0a, 0x05, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, @@ -353,14 +356,15 @@ var file_connect_proto_rawDesc = []byte{ 0x64, 0x72, 0x12, 0x30, 0x0a, 0x06, 0x63, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x48, 0x00, 0x52, 0x06, 0x63, 0x73, - 0x68, 0x65, 0x6c, 0x6c, 0x22, 0x23, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, + 0x68, 0x65, 0x6c, 0x6c, 0x22, 0x2c, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x74, 0x63, 0x70, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x75, 0x64, 0x70, 0x10, 0x01, 0x12, 0x09, - 0x0a, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x10, 0x02, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x34, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x2f, - 0x3b, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x0a, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x76, 0x6e, 0x63, + 0x10, 0x03, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x34, 0x0a, + 0x10, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, + 0x6b, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6d, 0x73, 0x67, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x2f, 0x3b, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/code/network/connect.proto b/code/network/connect.proto index a716878..84d5cbf 100644 --- a/code/network/connect.proto +++ b/code/network/connect.proto @@ -18,6 +18,7 @@ message connect_request { tcp = 0; udp = 1; shell = 2; + vnc = 3; } string name = 1; type _type = 2; diff --git a/code/network/msg.pb.go b/code/network/msg.pb.go index fdeba8c..1bc7de9 100644 --- a/code/network/msg.pb.go +++ b/code/network/msg.pb.go @@ -33,6 +33,11 @@ const ( // shell Msg_shell_resize MsgType = 10 Msg_shell_data MsgType = 11 + // vnc + Msg_vnc_ctrl MsgType = 20 + Msg_vnc_mouse MsgType = 21 + Msg_vnc_keyboard MsgType = 22 + Msg_vnc_cad MsgType = 23 // ctrl+alt+del ) // Enum value maps for MsgType. @@ -47,6 +52,10 @@ var ( 6: "forward", 10: "shell_resize", 11: "shell_data", + 20: "vnc_ctrl", + 21: "vnc_mouse", + 22: "vnc_keyboard", + 23: "vnc_cad", } MsgType_value = map[string]int32{ "unknown": 0, @@ -58,6 +67,10 @@ var ( "forward": 6, "shell_resize": 10, "shell_data": 11, + "vnc_ctrl": 20, + "vnc_mouse": 21, + "vnc_keyboard": 22, + "vnc_cad": 23, } ) @@ -153,6 +166,9 @@ type Msg struct { // *Msg_XData // *Msg_Sresize // *Msg_Sdata + // *Msg_Vctrl + // *Msg_Vmouse + // *Msg_Vkbd Payload isMsg_Payload `protobuf_oneof:"payload"` } @@ -279,6 +295,27 @@ func (x *Msg) GetSdata() *ShellData { return nil } +func (x *Msg) GetVctrl() *VncControl { + if x, ok := x.GetPayload().(*Msg_Vctrl); ok { + return x.Vctrl + } + return nil +} + +func (x *Msg) GetVmouse() *VncMouse { + if x, ok := x.GetPayload().(*Msg_Vmouse); ok { + return x.Vmouse + } + return nil +} + +func (x *Msg) GetVkbd() *VncKeyboard { + if x, ok := x.GetPayload().(*Msg_Vkbd); ok { + return x.Vkbd + } + return nil +} + type isMsg_Payload interface { isMsg_Payload() } @@ -308,6 +345,19 @@ type Msg_Sdata struct { Sdata *ShellData `protobuf:"bytes,21,opt,name=sdata,proto3,oneof"` } +type Msg_Vctrl struct { + // vnc + Vctrl *VncControl `protobuf:"bytes,30,opt,name=vctrl,proto3,oneof"` +} + +type Msg_Vmouse struct { + Vmouse *VncMouse `protobuf:"bytes,31,opt,name=vmouse,proto3,oneof"` +} + +type Msg_Vkbd struct { + Vkbd *VncKeyboard `protobuf:"bytes,32,opt,name=vkbd,proto3,oneof"` +} + func (*Msg_Hsp) isMsg_Payload() {} func (*Msg_Creq) isMsg_Payload() {} @@ -320,53 +370,72 @@ func (*Msg_Sresize) isMsg_Payload() {} func (*Msg_Sdata) isMsg_Payload() {} +func (*Msg_Vctrl) isMsg_Payload() {} + +func (*Msg_Vmouse) isMsg_Payload() {} + +func (*Msg_Vkbd) isMsg_Payload() {} + var File_msg_proto protoreflect.FileDescriptor var file_msg_proto_rawDesc = []byte{ 0x0a, 0x09, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x1a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0d, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x0b, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x25, 0x0a, 0x11, 0x68, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x5f, 0x70, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x03, 0x65, 0x6e, 0x63, 0x22, 0xd3, 0x04, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x26, - 0x0a, 0x05, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, - 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x12, 0x19, 0x0a, 0x08, 0x66, 0x72, - 0x6f, 0x6d, 0x5f, 0x69, 0x64, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x66, 0x72, - 0x6f, 0x6d, 0x49, 0x64, 0x78, 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x74, 0x6f, 0x12, 0x15, 0x0a, 0x06, 0x74, 0x6f, 0x5f, 0x69, 0x64, 0x78, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x49, 0x64, 0x78, 0x12, 0x17, 0x0a, 0x07, - 0x6c, 0x69, 0x6e, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, - 0x69, 0x6e, 0x6b, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x03, 0x68, 0x73, 0x70, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x68, 0x61, 0x6e, - 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x00, - 0x52, 0x03, 0x68, 0x73, 0x70, 0x12, 0x2e, 0x0a, 0x04, 0x63, 0x72, 0x65, 0x71, 0x18, 0x0b, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x63, 0x6f, - 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, - 0x04, 0x63, 0x72, 0x65, 0x71, 0x12, 0x2f, 0x0a, 0x04, 0x63, 0x72, 0x65, 0x70, 0x18, 0x0c, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x63, 0x6f, - 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, - 0x52, 0x04, 0x63, 0x72, 0x65, 0x70, 0x12, 0x24, 0x0a, 0x05, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, - 0x64, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x31, 0x0a, 0x07, - 0x73, 0x72, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, - 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x5f, 0x72, 0x65, - 0x73, 0x69, 0x7a, 0x65, 0x48, 0x00, 0x52, 0x07, 0x73, 0x72, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x12, - 0x2b, 0x0a, 0x05, 0x73, 0x64, 0x61, 0x74, 0x61, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, - 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x5f, 0x64, - 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x05, 0x73, 0x64, 0x61, 0x74, 0x61, 0x22, 0x92, 0x01, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, - 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x68, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x10, - 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x6b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x10, 0x02, - 0x12, 0x0f, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x71, 0x10, - 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x70, - 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x10, 0x05, 0x12, 0x0b, 0x0a, 0x07, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x10, 0x06, 0x12, - 0x10, 0x0a, 0x0c, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x10, - 0x0a, 0x12, 0x0e, 0x0a, 0x0a, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x10, - 0x0b, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x0c, 0x5a, 0x0a, + 0x74, 0x6f, 0x1a, 0x0b, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x09, 0x76, 0x6e, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x25, 0x0a, 0x11, 0x68, 0x61, + 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, + 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x65, 0x6e, + 0x63, 0x22, 0x98, 0x06, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x26, 0x0a, 0x05, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x12, 0x19, 0x0a, 0x08, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x69, 0x64, + 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x66, 0x72, 0x6f, 0x6d, 0x49, 0x64, 0x78, + 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x74, 0x6f, + 0x12, 0x15, 0x0a, 0x06, 0x74, 0x6f, 0x5f, 0x69, 0x64, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x05, 0x74, 0x6f, 0x49, 0x64, 0x78, 0x12, 0x17, 0x0a, 0x07, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, + 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x69, 0x6e, 0x6b, 0x49, 0x64, + 0x12, 0x2e, 0x0a, 0x03, 0x68, 0x73, 0x70, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x68, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, + 0x65, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x00, 0x52, 0x03, 0x68, 0x73, 0x70, + 0x12, 0x2e, 0x0a, 0x04, 0x63, 0x72, 0x65, 0x71, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x04, 0x63, 0x72, 0x65, 0x71, + 0x12, 0x2f, 0x0a, 0x04, 0x63, 0x72, 0x65, 0x70, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x04, 0x63, 0x72, 0x65, + 0x70, 0x12, 0x24, 0x0a, 0x05, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0d, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x48, + 0x00, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x31, 0x0a, 0x07, 0x73, 0x72, 0x65, 0x73, 0x69, + 0x7a, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x2e, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x48, + 0x00, 0x52, 0x07, 0x73, 0x72, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x73, 0x64, + 0x61, 0x74, 0x61, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x2e, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x48, 0x00, + 0x52, 0x05, 0x73, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x63, 0x74, 0x72, 0x6c, + 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x2e, 0x76, 0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x48, 0x00, 0x52, 0x05, + 0x76, 0x63, 0x74, 0x72, 0x6c, 0x12, 0x2c, 0x0a, 0x06, 0x76, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x18, + 0x1f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, + 0x76, 0x6e, 0x63, 0x5f, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x48, 0x00, 0x52, 0x06, 0x76, 0x6d, 0x6f, + 0x75, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x04, 0x76, 0x6b, 0x62, 0x64, 0x18, 0x20, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x15, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x76, 0x6e, 0x63, 0x5f, + 0x6b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x48, 0x00, 0x52, 0x04, 0x76, 0x6b, 0x62, 0x64, + 0x22, 0xce, 0x01, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x75, 0x6e, 0x6b, + 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x68, 0x61, 0x6e, 0x64, 0x73, 0x68, + 0x61, 0x6b, 0x65, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x6b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, + 0x76, 0x65, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, + 0x72, 0x65, 0x71, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x5f, 0x72, 0x65, 0x70, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x10, 0x05, 0x12, 0x0b, 0x0a, 0x07, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, + 0x64, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x5f, 0x72, 0x65, 0x73, + 0x69, 0x7a, 0x65, 0x10, 0x0a, 0x12, 0x0e, 0x0a, 0x0a, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x5f, 0x64, + 0x61, 0x74, 0x61, 0x10, 0x0b, 0x12, 0x0c, 0x0a, 0x08, 0x76, 0x6e, 0x63, 0x5f, 0x63, 0x74, 0x72, + 0x6c, 0x10, 0x14, 0x12, 0x0d, 0x0a, 0x09, 0x76, 0x6e, 0x63, 0x5f, 0x6d, 0x6f, 0x75, 0x73, 0x65, + 0x10, 0x15, 0x12, 0x10, 0x0a, 0x0c, 0x76, 0x6e, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x62, 0x6f, 0x61, + 0x72, 0x64, 0x10, 0x16, 0x12, 0x0b, 0x0a, 0x07, 0x76, 0x6e, 0x63, 0x5f, 0x63, 0x61, 0x64, 0x10, + 0x17, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x2f, 0x3b, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } @@ -394,20 +463,26 @@ var file_msg_proto_goTypes = []interface{}{ (*Data)(nil), // 5: network.data (*ShellResize)(nil), // 6: network.shell_resize (*ShellData)(nil), // 7: network.shell_data + (*VncControl)(nil), // 8: network.vnc_control + (*VncMouse)(nil), // 9: network.vnc_mouse + (*VncKeyboard)(nil), // 10: network.vnc_keyboard } var file_msg_proto_depIdxs = []int32{ - 0, // 0: network.msg._type:type_name -> network.msg.type - 1, // 1: network.msg.hsp:type_name -> network.handshake_payload - 3, // 2: network.msg.creq:type_name -> network.connect_request - 4, // 3: network.msg.crep:type_name -> network.connect_response - 5, // 4: network.msg._data:type_name -> network.data - 6, // 5: network.msg.sresize:type_name -> network.shell_resize - 7, // 6: network.msg.sdata:type_name -> network.shell_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 - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 0, // 0: network.msg._type:type_name -> network.msg.type + 1, // 1: network.msg.hsp:type_name -> network.handshake_payload + 3, // 2: network.msg.creq:type_name -> network.connect_request + 4, // 3: network.msg.crep:type_name -> network.connect_response + 5, // 4: network.msg._data:type_name -> network.data + 6, // 5: network.msg.sresize:type_name -> network.shell_resize + 7, // 6: network.msg.sdata:type_name -> network.shell_data + 8, // 7: network.msg.vctrl:type_name -> network.vnc_control + 9, // 8: network.msg.vmouse:type_name -> network.vnc_mouse + 10, // 9: network.msg.vkbd:type_name -> network.vnc_keyboard + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name } func init() { file_msg_proto_init() } @@ -418,6 +493,7 @@ func file_msg_proto_init() { file_connect_proto_init() file_forward_proto_init() file_shell_proto_init() + file_vnc_proto_init() if !protoimpl.UnsafeEnabled { file_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HandshakePayload); i { @@ -451,6 +527,9 @@ func file_msg_proto_init() { (*Msg_XData)(nil), (*Msg_Sresize)(nil), (*Msg_Sdata)(nil), + (*Msg_Vctrl)(nil), + (*Msg_Vmouse)(nil), + (*Msg_Vkbd)(nil), } type x struct{} out := protoimpl.TypeBuilder{ diff --git a/code/network/msg.proto b/code/network/msg.proto index 384330d..8b0af66 100644 --- a/code/network/msg.proto +++ b/code/network/msg.proto @@ -6,6 +6,7 @@ option go_package="./;network"; import "connect.proto"; import "forward.proto"; import "shell.proto"; +import "vnc.proto"; message handshake_payload { bytes enc = 1; @@ -23,6 +24,11 @@ message msg { // shell shell_resize = 10; shell_data = 11; + // vnc + vnc_ctrl = 20; + vnc_mouse = 21; + vnc_keyboard = 22; + vnc_cad = 23; // ctrl+alt+del } type _type = 1; string from = 2; @@ -36,7 +42,11 @@ message msg { connect_response crep = 12; data _data = 13; // shell - shell_resize sresize = 20; - shell_data sdata = 21; + shell_resize sresize = 20; + shell_data sdata = 21; + // vnc + vnc_control vctrl = 30; + vnc_mouse vmouse = 31; + vnc_keyboard vkbd = 32; } } \ No newline at end of file diff --git a/code/network/vnc.pb.go b/code/network/vnc.pb.go new file mode 100644 index 0000000..088fd3f --- /dev/null +++ b/code/network/vnc.pb.go @@ -0,0 +1,558 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.12.4 +// source: vnc.proto + +package network + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type VncStatus int32 + +const ( + VncStatus_unset_st VncStatus = 0 + VncStatus_down VncStatus = 1 + VncStatus_up VncStatus = 2 +) + +// Enum value maps for VncStatus. +var ( + VncStatus_name = map[int32]string{ + 0: "unset_st", + 1: "down", + 2: "up", + } + VncStatus_value = map[string]int32{ + "unset_st": 0, + "down": 1, + "up": 2, + } +) + +func (x VncStatus) Enum() *VncStatus { + p := new(VncStatus) + *p = x + return p +} + +func (x VncStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VncStatus) Descriptor() protoreflect.EnumDescriptor { + return file_vnc_proto_enumTypes[0].Descriptor() +} + +func (VncStatus) Type() protoreflect.EnumType { + return &file_vnc_proto_enumTypes[0] +} + +func (x VncStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VncStatus.Descriptor instead. +func (VncStatus) EnumDescriptor() ([]byte, []int) { + return file_vnc_proto_rawDescGZIP(), []int{0} +} + +type VncImageEncoding int32 + +const ( + VncImage_raw VncImageEncoding = 0 + VncImage_jpeg VncImageEncoding = 1 + VncImage_png VncImageEncoding = 2 +) + +// Enum value maps for VncImageEncoding. +var ( + VncImageEncoding_name = map[int32]string{ + 0: "raw", + 1: "jpeg", + 2: "png", + } + VncImageEncoding_value = map[string]int32{ + "raw": 0, + "jpeg": 1, + "png": 2, + } +) + +func (x VncImageEncoding) Enum() *VncImageEncoding { + p := new(VncImageEncoding) + *p = x + return p +} + +func (x VncImageEncoding) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VncImageEncoding) Descriptor() protoreflect.EnumDescriptor { + return file_vnc_proto_enumTypes[1].Descriptor() +} + +func (VncImageEncoding) Type() protoreflect.EnumType { + return &file_vnc_proto_enumTypes[1] +} + +func (x VncImageEncoding) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VncImageEncoding.Descriptor instead. +func (VncImageEncoding) EnumDescriptor() ([]byte, []int) { + return file_vnc_proto_rawDescGZIP(), []int{1, 0} +} + +type VncMouseButton int32 + +const ( + VncMouse_unset_btn VncMouseButton = 0 + VncMouse_left VncMouseButton = 1 + VncMouse_middle VncMouseButton = 2 + VncMouse_right VncMouseButton = 3 +) + +// Enum value maps for VncMouseButton. +var ( + VncMouseButton_name = map[int32]string{ + 0: "unset_btn", + 1: "left", + 2: "middle", + 3: "right", + } + VncMouseButton_value = map[string]int32{ + "unset_btn": 0, + "left": 1, + "middle": 2, + "right": 3, + } +) + +func (x VncMouseButton) Enum() *VncMouseButton { + p := new(VncMouseButton) + *p = x + return p +} + +func (x VncMouseButton) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VncMouseButton) Descriptor() protoreflect.EnumDescriptor { + return file_vnc_proto_enumTypes[2].Descriptor() +} + +func (VncMouseButton) Type() protoreflect.EnumType { + return &file_vnc_proto_enumTypes[2] +} + +func (x VncMouseButton) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VncMouseButton.Descriptor instead. +func (VncMouseButton) EnumDescriptor() ([]byte, []int) { + return file_vnc_proto_rawDescGZIP(), []int{2, 0} +} + +type VncControl struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Fps uint32 `protobuf:"varint,1,opt,name=fps,proto3" json:"fps,omitempty"` + Quality uint32 `protobuf:"varint,2,opt,name=quality,proto3" json:"quality,omitempty"` // image quality, percent +} + +func (x *VncControl) Reset() { + *x = VncControl{} + if protoimpl.UnsafeEnabled { + mi := &file_vnc_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VncControl) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VncControl) ProtoMessage() {} + +func (x *VncControl) ProtoReflect() protoreflect.Message { + mi := &file_vnc_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VncControl.ProtoReflect.Descriptor instead. +func (*VncControl) Descriptor() ([]byte, []int) { + return file_vnc_proto_rawDescGZIP(), []int{0} +} + +func (x *VncControl) GetFps() uint32 { + if x != nil { + return x.Fps + } + return 0 +} + +func (x *VncControl) GetQuality() uint32 { + if x != nil { + return x.Quality + } + return 0 +} + +type VncImage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Encode VncImageEncoding `protobuf:"varint,1,opt,name=encode,proto3,enum=network.VncImageEncoding" json:"encode,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *VncImage) Reset() { + *x = VncImage{} + if protoimpl.UnsafeEnabled { + mi := &file_vnc_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VncImage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VncImage) ProtoMessage() {} + +func (x *VncImage) ProtoReflect() protoreflect.Message { + mi := &file_vnc_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VncImage.ProtoReflect.Descriptor instead. +func (*VncImage) Descriptor() ([]byte, []int) { + return file_vnc_proto_rawDescGZIP(), []int{1} +} + +func (x *VncImage) GetEncode() VncImageEncoding { + if x != nil { + return x.Encode + } + return VncImage_raw +} + +func (x *VncImage) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +type VncMouse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type VncStatus `protobuf:"varint,1,opt,name=type,proto3,enum=network.VncStatus" json:"type,omitempty"` + Btn VncMouseButton `protobuf:"varint,2,opt,name=btn,proto3,enum=network.VncMouseButton" json:"btn,omitempty"` + X uint32 `protobuf:"varint,3,opt,name=x,proto3" json:"x,omitempty"` + Y uint32 `protobuf:"varint,4,opt,name=y,proto3" json:"y,omitempty"` +} + +func (x *VncMouse) Reset() { + *x = VncMouse{} + if protoimpl.UnsafeEnabled { + mi := &file_vnc_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VncMouse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VncMouse) ProtoMessage() {} + +func (x *VncMouse) ProtoReflect() protoreflect.Message { + mi := &file_vnc_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VncMouse.ProtoReflect.Descriptor instead. +func (*VncMouse) Descriptor() ([]byte, []int) { + return file_vnc_proto_rawDescGZIP(), []int{2} +} + +func (x *VncMouse) GetType() VncStatus { + if x != nil { + return x.Type + } + return VncStatus_unset_st +} + +func (x *VncMouse) GetBtn() VncMouseButton { + if x != nil { + return x.Btn + } + return VncMouse_unset_btn +} + +func (x *VncMouse) GetX() uint32 { + if x != nil { + return x.X + } + return 0 +} + +func (x *VncMouse) GetY() uint32 { + if x != nil { + return x.Y + } + return 0 +} + +type VncKeyboard struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type VncStatus `protobuf:"varint,1,opt,name=type,proto3,enum=network.VncStatus" json:"type,omitempty"` + // https://github.com/go-vgo/robotgo/blob/master/docs/keys.md + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` +} + +func (x *VncKeyboard) Reset() { + *x = VncKeyboard{} + if protoimpl.UnsafeEnabled { + mi := &file_vnc_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VncKeyboard) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VncKeyboard) ProtoMessage() {} + +func (x *VncKeyboard) ProtoReflect() protoreflect.Message { + mi := &file_vnc_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VncKeyboard.ProtoReflect.Descriptor instead. +func (*VncKeyboard) Descriptor() ([]byte, []int) { + return file_vnc_proto_rawDescGZIP(), []int{3} +} + +func (x *VncKeyboard) GetType() VncStatus { + if x != nil { + return x.Type + } + return VncStatus_unset_st +} + +func (x *VncKeyboard) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +var File_vnc_proto protoreflect.FileDescriptor + +var file_vnc_proto_rawDesc = []byte{ + 0x0a, 0x09, 0x76, 0x6e, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x22, 0x39, 0x0a, 0x0b, 0x76, 0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x66, 0x70, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x03, 0x66, 0x70, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x22, + 0x7c, 0x0a, 0x09, 0x76, 0x6e, 0x63, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x33, 0x0a, 0x06, + 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x76, 0x6e, 0x63, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, + 0x2e, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x65, 0x6e, 0x63, 0x6f, 0x64, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x26, 0x0a, 0x08, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, + 0x67, 0x12, 0x07, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x6a, 0x70, + 0x65, 0x67, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x70, 0x6e, 0x67, 0x10, 0x02, 0x22, 0xb7, 0x01, + 0x0a, 0x09, 0x76, 0x6e, 0x63, 0x5f, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x2e, 0x76, 0x6e, 0x63, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x12, 0x2b, 0x0a, 0x03, 0x62, 0x74, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x76, 0x6e, 0x63, 0x5f, + 0x6d, 0x6f, 0x75, 0x73, 0x65, 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, 0x49, 0x0a, 0x0c, 0x76, 0x6e, 0x63, 0x5f, 0x6b, + 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x27, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, + 0x76, 0x6e, 0x63, 0x5f, 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, 0x2a, 0x2c, 0x0a, 0x0a, 0x76, 0x6e, 0x63, 0x5f, 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, 0x0c, 0x5a, 0x0a, 0x2e, 0x2f, 0x3b, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_vnc_proto_rawDescOnce sync.Once + file_vnc_proto_rawDescData = file_vnc_proto_rawDesc +) + +func file_vnc_proto_rawDescGZIP() []byte { + file_vnc_proto_rawDescOnce.Do(func() { + file_vnc_proto_rawDescData = protoimpl.X.CompressGZIP(file_vnc_proto_rawDescData) + }) + return file_vnc_proto_rawDescData +} + +var file_vnc_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_vnc_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_vnc_proto_goTypes = []interface{}{ + (VncStatus)(0), // 0: network.vnc_status + (VncImageEncoding)(0), // 1: network.vnc_image.encoding + (VncMouseButton)(0), // 2: network.vnc_mouse.button + (*VncControl)(nil), // 3: network.vnc_control + (*VncImage)(nil), // 4: network.vnc_image + (*VncMouse)(nil), // 5: network.vnc_mouse + (*VncKeyboard)(nil), // 6: network.vnc_keyboard +} +var file_vnc_proto_depIdxs = []int32{ + 1, // 0: network.vnc_image.encode:type_name -> network.vnc_image.encoding + 0, // 1: network.vnc_mouse.type:type_name -> network.vnc_status + 2, // 2: network.vnc_mouse.btn:type_name -> network.vnc_mouse.button + 0, // 3: network.vnc_keyboard.type:type_name -> network.vnc_status + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_vnc_proto_init() } +func file_vnc_proto_init() { + if File_vnc_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_vnc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VncControl); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_vnc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VncImage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_vnc_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VncMouse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_vnc_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VncKeyboard); 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_vnc_proto_rawDesc, + NumEnums: 3, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_vnc_proto_goTypes, + DependencyIndexes: file_vnc_proto_depIdxs, + EnumInfos: file_vnc_proto_enumTypes, + MessageInfos: file_vnc_proto_msgTypes, + }.Build() + File_vnc_proto = out.File + file_vnc_proto_rawDesc = nil + file_vnc_proto_goTypes = nil + file_vnc_proto_depIdxs = nil +} diff --git a/code/network/vnc.proto b/code/network/vnc.proto new file mode 100644 index 0000000..797c23a --- /dev/null +++ b/code/network/vnc.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; + +package network; +option go_package="./;network"; + +message vnc_control { + uint32 fps = 1; + uint32 quality = 2; // image quality, percent +} + +message vnc_image { + enum encoding { + raw = 0; + jpeg = 1; + png = 2; + } + encoding encode = 1; + bytes data = 2; +} + +enum vnc_status { + unset_st = 0; + down = 1; + up = 2; +} + +message vnc_mouse { + enum button { + unset_btn = 0; + left = 1; + middle = 2; + right = 3; + } + vnc_status type = 1; + button btn = 2; + uint32 x = 3; + uint32 y = 4; +} + +message vnc_keyboard { + vnc_status type = 1; + // https://github.com/go-vgo/robotgo/blob/master/docs/keys.md + string key = 2; +} diff --git a/conf/tunnel.d/vnc.yaml b/conf/tunnel.d/vnc.yaml new file mode 100644 index 0000000..b6b79ed --- /dev/null +++ b/conf/tunnel.d/vnc.yaml @@ -0,0 +1,5 @@ +- name: vnc # 链路名称 + target: that # 目标客户端ID + type: vnc # web vnc + local_addr: 0.0.0.0 # 本地监听地址 + local_port: 5900 # 本地监听端口号 \ No newline at end of file