WIP: 增加剪贴板支持

This commit is contained in:
lwch
2021-11-22 11:04:58 +08:00
parent 160df374e9
commit 702dc118d8
14 changed files with 671 additions and 162 deletions
+22
View File
@@ -154,3 +154,25 @@ func (conn *Conn) SendVNCScroll(to string, toIdx uint32, id string, x, y int32)
case <-time.After(conn.parent.cfg.WriteTimeout):
}
}
// SendVNCClipboardSet send vnc set clipboard
func (conn *Conn) SendVNCClipboardSet(to string, toIdx uint32, id, data string) {
var msg network.Msg
msg.To = to
msg.ToIdx = toIdx
msg.XType = network.Msg_vnc_clipboard
msg.LinkId = id
msg.Payload = &network.Msg_Vclipboard{
Vclipboard: &network.VncClipboard{
Set: true,
XType: network.VncClipboard_text,
Payload: &network.VncClipboard_Data{
Data: []byte(data),
},
},
}
select {
case conn.write <- &msg:
case <-time.After(conn.parent.cfg.WriteTimeout):
}
}
+30
View File
@@ -0,0 +1,30 @@
package vnc
import (
"fmt"
"natpass/code/client/pool"
"net/http"
)
// Clipboard get/set clipboard
func (v *VNC) Clipboard(pool *pool.Pool, w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodGet {
v.getClipboard(pool, w, r)
return
}
v.setClipboard(pool, w, r)
}
func (v *VNC) getClipboard(pool *pool.Pool, w http.ResponseWriter, r *http.Request) {
}
func (v *VNC) setClipboard(pool *pool.Pool, w http.ResponseWriter, r *http.Request) {
data := r.FormValue("data")
if v.link == nil {
http.NotFound(w, r)
return
}
conn := pool.Get(v.link.id)
conn.SendVNCClipboardSet(v.link.target, v.link.targetIdx, v.link.id, data)
fmt.Fprint(w, "ok")
}
+2
View File
@@ -109,6 +109,8 @@ func (link *Link) remoteRead() {
link.ps.CADEvent()
case network.Msg_vnc_scroll:
link.ps.ScrollEvent(msg.GetVscroll())
case network.Msg_vnc_clipboard:
link.ps.ClipboardEvent(msg.GetVclipboard())
case network.Msg_disconnect:
logging.Info("link %s disconnected", link.id)
return
+30
View File
@@ -78,3 +78,33 @@ func (p *Process) ScrollEvent(data *network.VncScroll) {
}
p.chWrite <- &msg
}
// ClipboardEvent dispatch clipboard event to child process
func (p *Process) ClipboardEvent(data *network.VncClipboard) {
dup := func(data []byte) []byte {
ret := make([]byte, len(data))
copy(ret, data)
return ret
}
t := vncnetwork.ClipboardData_unset_type
var payload vncnetwork.ClipboardData_Data
switch data.GetXType() {
case network.VncClipboard_file:
t = vncnetwork.ClipboardData_file
case network.VncClipboard_image:
t = vncnetwork.ClipboardData_image
case network.VncClipboard_text:
t = vncnetwork.ClipboardData_text
payload.Data = dup(data.GetData())
}
var msg vncnetwork.VncMsg
msg.XType = vncnetwork.VncMsg_clipboard_event
msg.Payload = &vncnetwork.VncMsg_Clipboard{
Clipboard: &vncnetwork.ClipboardData{
Set: data.GetSet(),
XType: t,
Payload: &payload,
},
}
p.chWrite <- &msg
}
+1
View File
@@ -96,6 +96,7 @@ func (v *VNC) Handle(pl *pool.Pool) {
mux := http.NewServeMux()
mux.HandleFunc("/new", pf(v.New))
mux.HandleFunc("/ctrl", pf(v.Ctrl))
mux.HandleFunc("/clipboard", pf(v.Clipboard))
mux.HandleFunc("/ws/", pf(v.WS))
mux.HandleFunc("/", v.Render)
svr := &http.Server{
+256 -68
View File
@@ -121,15 +121,68 @@ func (MouseDataButton) EnumDescriptor() ([]byte, []int) {
return file_vncmsg_proto_rawDescGZIP(), []int{1, 0}
}
type ClipboardDataType int32
const (
ClipboardData_unset_type ClipboardDataType = 0
ClipboardData_text ClipboardDataType = 1
ClipboardData_image ClipboardDataType = 2
ClipboardData_file ClipboardDataType = 3
)
// Enum value maps for ClipboardDataType.
var (
ClipboardDataType_name = map[int32]string{
0: "unset_type",
1: "text",
2: "image",
3: "file",
}
ClipboardDataType_value = map[string]int32{
"unset_type": 0,
"text": 1,
"image": 2,
"file": 3,
}
)
func (x ClipboardDataType) Enum() *ClipboardDataType {
p := new(ClipboardDataType)
*p = x
return p
}
func (x ClipboardDataType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (ClipboardDataType) Descriptor() protoreflect.EnumDescriptor {
return file_vncmsg_proto_enumTypes[2].Descriptor()
}
func (ClipboardDataType) Type() protoreflect.EnumType {
return &file_vncmsg_proto_enumTypes[2]
}
func (x ClipboardDataType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use ClipboardDataType.Descriptor instead.
func (ClipboardDataType) EnumDescriptor() ([]byte, []int) {
return file_vncmsg_proto_rawDescGZIP(), []int{4, 0}
}
type VncMsgType int32
const (
VncMsg_capture_req VncMsgType = 0
VncMsg_capture_data VncMsgType = 1
VncMsg_mouse_event VncMsgType = 2
VncMsg_keyboard_event VncMsgType = 3
VncMsg_set_cursor VncMsgType = 4
VncMsg_scroll_event VncMsgType = 5
VncMsg_capture_req VncMsgType = 0
VncMsg_capture_data VncMsgType = 1
VncMsg_mouse_event VncMsgType = 2
VncMsg_keyboard_event VncMsgType = 3
VncMsg_set_cursor VncMsgType = 4
VncMsg_scroll_event VncMsgType = 5
VncMsg_clipboard_event VncMsgType = 6
)
// Enum value maps for VncMsgType.
@@ -141,14 +194,16 @@ var (
3: "keyboard_event",
4: "set_cursor",
5: "scroll_event",
6: "clipboard_event",
}
VncMsgType_value = map[string]int32{
"capture_req": 0,
"capture_data": 1,
"mouse_event": 2,
"keyboard_event": 3,
"set_cursor": 4,
"scroll_event": 5,
"capture_req": 0,
"capture_data": 1,
"mouse_event": 2,
"keyboard_event": 3,
"set_cursor": 4,
"scroll_event": 5,
"clipboard_event": 6,
}
)
@@ -163,11 +218,11 @@ func (x VncMsgType) String() string {
}
func (VncMsgType) Descriptor() protoreflect.EnumDescriptor {
return file_vncmsg_proto_enumTypes[2].Descriptor()
return file_vncmsg_proto_enumTypes[3].Descriptor()
}
func (VncMsgType) Type() protoreflect.EnumType {
return &file_vncmsg_proto_enumTypes[2]
return &file_vncmsg_proto_enumTypes[3]
}
func (x VncMsgType) Number() protoreflect.EnumNumber {
@@ -176,7 +231,7 @@ func (x VncMsgType) Number() protoreflect.EnumNumber {
// Deprecated: Use VncMsgType.Descriptor instead.
func (VncMsgType) EnumDescriptor() ([]byte, []int) {
return file_vncmsg_proto_rawDescGZIP(), []int{4, 0}
return file_vncmsg_proto_rawDescGZIP(), []int{5, 0}
}
type ImageData struct {
@@ -447,6 +502,88 @@ func (x *ScrollData) GetY() int32 {
return 0
}
type ClipboardData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Set bool `protobuf:"varint,1,opt,name=set,proto3" json:"set,omitempty"`
XType ClipboardDataType `protobuf:"varint,2,opt,name=_type,json=Type,proto3,enum=vncnetwork.ClipboardDataType" json:"_type,omitempty"`
// Types that are assignable to Payload:
// *ClipboardData_Data
Payload isClipboardData_Payload `protobuf_oneof:"payload"`
}
func (x *ClipboardData) Reset() {
*x = ClipboardData{}
if protoimpl.UnsafeEnabled {
mi := &file_vncmsg_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ClipboardData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ClipboardData) ProtoMessage() {}
func (x *ClipboardData) ProtoReflect() protoreflect.Message {
mi := &file_vncmsg_proto_msgTypes[4]
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 ClipboardData.ProtoReflect.Descriptor instead.
func (*ClipboardData) Descriptor() ([]byte, []int) {
return file_vncmsg_proto_rawDescGZIP(), []int{4}
}
func (x *ClipboardData) GetSet() bool {
if x != nil {
return x.Set
}
return false
}
func (x *ClipboardData) GetXType() ClipboardDataType {
if x != nil {
return x.XType
}
return ClipboardData_unset_type
}
func (m *ClipboardData) GetPayload() isClipboardData_Payload {
if m != nil {
return m.Payload
}
return nil
}
func (x *ClipboardData) GetData() []byte {
if x, ok := x.GetPayload().(*ClipboardData_Data); ok {
return x.Data
}
return nil
}
type isClipboardData_Payload interface {
isClipboardData_Payload()
}
type ClipboardData_Data struct {
Data []byte `protobuf:"bytes,10,opt,name=data,proto3,oneof"` // text data
}
func (*ClipboardData_Data) isClipboardData_Payload() {}
type VncMsg struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -459,13 +596,14 @@ type VncMsg struct {
// *VncMsg_Keyboard
// *VncMsg_ShowCursor
// *VncMsg_Scroll
// *VncMsg_Clipboard
Payload isVncMsg_Payload `protobuf_oneof:"payload"`
}
func (x *VncMsg) Reset() {
*x = VncMsg{}
if protoimpl.UnsafeEnabled {
mi := &file_vncmsg_proto_msgTypes[4]
mi := &file_vncmsg_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -478,7 +616,7 @@ func (x *VncMsg) String() string {
func (*VncMsg) ProtoMessage() {}
func (x *VncMsg) ProtoReflect() protoreflect.Message {
mi := &file_vncmsg_proto_msgTypes[4]
mi := &file_vncmsg_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -491,7 +629,7 @@ func (x *VncMsg) ProtoReflect() protoreflect.Message {
// Deprecated: Use VncMsg.ProtoReflect.Descriptor instead.
func (*VncMsg) Descriptor() ([]byte, []int) {
return file_vncmsg_proto_rawDescGZIP(), []int{4}
return file_vncmsg_proto_rawDescGZIP(), []int{5}
}
func (x *VncMsg) GetXType() VncMsgType {
@@ -543,6 +681,13 @@ func (x *VncMsg) GetScroll() *ScrollData {
return nil
}
func (x *VncMsg) GetClipboard() *ClipboardData {
if x, ok := x.GetPayload().(*VncMsg_Clipboard); ok {
return x.Clipboard
}
return nil
}
type isVncMsg_Payload interface {
isVncMsg_Payload()
}
@@ -567,6 +712,10 @@ type VncMsg_Scroll struct {
Scroll *ScrollData `protobuf:"bytes,6,opt,name=scroll,proto3,oneof"`
}
type VncMsg_Clipboard struct {
Clipboard *ClipboardData `protobuf:"bytes,7,opt,name=clipboard,proto3,oneof"`
}
func (*VncMsg_Data) isVncMsg_Payload() {}
func (*VncMsg_Mouse) isVncMsg_Payload() {}
@@ -577,6 +726,8 @@ func (*VncMsg_ShowCursor) isVncMsg_Payload() {}
func (*VncMsg_Scroll) isVncMsg_Payload() {}
func (*VncMsg_Clipboard) isVncMsg_Payload() {}
var File_vncmsg_proto protoreflect.FileDescriptor
var file_vncmsg_proto_rawDesc = []byte{
@@ -609,37 +760,54 @@ var file_vncmsg_proto_rawDesc = []byte{
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x29, 0x0a, 0x0b, 0x73, 0x63,
0x72, 0x6f, 0x6c, 0x6c, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01,
0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01,
0x28, 0x05, 0x52, 0x01, 0x79, 0x22, 0xa2, 0x03, 0x0a, 0x07, 0x76, 0x6e, 0x63, 0x5f, 0x6d, 0x73,
0x67, 0x12, 0x2d, 0x0a, 0x05, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e,
0x32, 0x18, 0x2e, 0x76, 0x6e, 0x63, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x76, 0x6e,
0x63, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65,
0x12, 0x2c, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16,
0x2e, 0x76, 0x6e, 0x63, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x69, 0x6d, 0x61, 0x67,
0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2e,
0x0a, 0x05, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e,
0x76, 0x6e, 0x63, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65,
0x5f, 0x64, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x05, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x12, 0x37,
0x0a, 0x08, 0x6b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x19, 0x2e, 0x76, 0x6e, 0x63, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 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, 0x12, 0x21, 0x0a, 0x0b, 0x73, 0x68, 0x6f, 0x77, 0x5f,
0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x0a,
0x73, 0x68, 0x6f, 0x77, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x12, 0x31, 0x0a, 0x06, 0x73, 0x63,
0x72, 0x6f, 0x6c, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x76, 0x6e, 0x63,
0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x73, 0x63, 0x72, 0x6f, 0x6c, 0x6c, 0x5f, 0x64,
0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x06, 0x73, 0x63, 0x72, 0x6f, 0x6c, 0x6c, 0x22, 0x70, 0x0a,
0x28, 0x05, 0x52, 0x01, 0x79, 0x22, 0xb0, 0x01, 0x0a, 0x0e, 0x63, 0x6c, 0x69, 0x70, 0x62, 0x6f,
0x61, 0x72, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x74, 0x18,
0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x73, 0x65, 0x74, 0x12, 0x34, 0x0a, 0x05, 0x5f, 0x74,
0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x76, 0x6e, 0x63, 0x6e,
0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x63, 0x6c, 0x69, 0x70, 0x62, 0x6f, 0x61, 0x72, 0x64,
0x5f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65,
0x12, 0x14, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00,
0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x35, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0e,
0x0a, 0x0a, 0x75, 0x6e, 0x73, 0x65, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x10, 0x00, 0x12, 0x08,
0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67,
0x65, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x10, 0x03, 0x42, 0x09, 0x0a,
0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0xf4, 0x03, 0x0a, 0x07, 0x76, 0x6e, 0x63,
0x5f, 0x6d, 0x73, 0x67, 0x12, 0x2d, 0x0a, 0x05, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x76, 0x6e, 0x63, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b,
0x2e, 0x76, 0x6e, 0x63, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54,
0x79, 0x70, 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x16, 0x2e, 0x76, 0x6e, 0x63, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x69,
0x6d, 0x61, 0x67, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x04, 0x64, 0x61, 0x74,
0x61, 0x12, 0x2e, 0x0a, 0x05, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x16, 0x2e, 0x76, 0x6e, 0x63, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x6f,
0x75, 0x73, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x05, 0x6d, 0x6f, 0x75, 0x73,
0x65, 0x12, 0x37, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x18, 0x04, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x76, 0x6e, 0x63, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b,
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, 0x12, 0x21, 0x0a, 0x0b, 0x73, 0x68,
0x6f, 0x77, 0x5f, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x48,
0x00, 0x52, 0x0a, 0x73, 0x68, 0x6f, 0x77, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x12, 0x31, 0x0a,
0x06, 0x73, 0x63, 0x72, 0x6f, 0x6c, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e,
0x76, 0x6e, 0x63, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x73, 0x63, 0x72, 0x6f, 0x6c,
0x6c, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52, 0x06, 0x73, 0x63, 0x72, 0x6f, 0x6c, 0x6c,
0x12, 0x3a, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x70, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x18, 0x07, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x76, 0x6e, 0x63, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b,
0x2e, 0x63, 0x6c, 0x69, 0x70, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x48,
0x00, 0x52, 0x09, 0x63, 0x6c, 0x69, 0x70, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x22, 0x85, 0x01, 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, 0x0e, 0x0a,
0x0a, 0x73, 0x65, 0x74, 0x5f, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x10, 0x04, 0x12, 0x10, 0x0a,
0x0c, 0x73, 0x63, 0x72, 0x6f, 0x6c, 0x6c, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x10, 0x05, 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, 0x0f, 0x5a, 0x0d, 0x2e, 0x2f, 0x3b, 0x76, 0x6e, 0x63, 0x6e, 0x65,
0x74, 0x77, 0x6f, 0x72, 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x0c, 0x73, 0x63, 0x72, 0x6f, 0x6c, 0x6c, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x12,
0x13, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x70, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x5f, 0x65, 0x76, 0x65,
0x6e, 0x74, 0x10, 0x06, 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, 0x0f, 0x5a, 0x0d, 0x2e, 0x2f, 0x3b,
0x76, 0x6e, 0x63, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
}
var (
@@ -654,32 +822,36 @@ func file_vncmsg_proto_rawDescGZIP() []byte {
return file_vncmsg_proto_rawDescData
}
var file_vncmsg_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
var file_vncmsg_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_vncmsg_proto_enumTypes = make([]protoimpl.EnumInfo, 4)
var file_vncmsg_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_vncmsg_proto_goTypes = []interface{}{
(Status)(0), // 0: vncnetwork.status
(MouseDataButton)(0), // 1: vncnetwork.mouse_data.button
(VncMsgType)(0), // 2: vncnetwork.vnc_msg.type
(*ImageData)(nil), // 3: vncnetwork.image_data
(*MouseData)(nil), // 4: vncnetwork.mouse_data
(*KeyboardData)(nil), // 5: vncnetwork.keyboard_data
(*ScrollData)(nil), // 6: vncnetwork.scroll_data
(*VncMsg)(nil), // 7: vncnetwork.vnc_msg
(Status)(0), // 0: vncnetwork.status
(MouseDataButton)(0), // 1: vncnetwork.mouse_data.button
(ClipboardDataType)(0), // 2: vncnetwork.clipboard_data.type
(VncMsgType)(0), // 3: vncnetwork.vnc_msg.type
(*ImageData)(nil), // 4: vncnetwork.image_data
(*MouseData)(nil), // 5: vncnetwork.mouse_data
(*KeyboardData)(nil), // 6: vncnetwork.keyboard_data
(*ScrollData)(nil), // 7: vncnetwork.scroll_data
(*ClipboardData)(nil), // 8: vncnetwork.clipboard_data
(*VncMsg)(nil), // 9: vncnetwork.vnc_msg
}
var file_vncmsg_proto_depIdxs = []int32{
0, // 0: vncnetwork.mouse_data.type:type_name -> vncnetwork.status
1, // 1: vncnetwork.mouse_data.btn:type_name -> vncnetwork.mouse_data.button
0, // 2: vncnetwork.keyboard_data.type:type_name -> vncnetwork.status
2, // 3: vncnetwork.vnc_msg._type:type_name -> vncnetwork.vnc_msg.type
3, // 4: vncnetwork.vnc_msg.data:type_name -> vncnetwork.image_data
4, // 5: vncnetwork.vnc_msg.mouse:type_name -> vncnetwork.mouse_data
5, // 6: vncnetwork.vnc_msg.keyboard:type_name -> vncnetwork.keyboard_data
6, // 7: vncnetwork.vnc_msg.scroll:type_name -> vncnetwork.scroll_data
8, // [8:8] is the sub-list for method output_type
8, // [8:8] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
0, // 0: vncnetwork.mouse_data.type:type_name -> vncnetwork.status
1, // 1: vncnetwork.mouse_data.btn:type_name -> vncnetwork.mouse_data.button
0, // 2: vncnetwork.keyboard_data.type:type_name -> vncnetwork.status
2, // 3: vncnetwork.clipboard_data._type:type_name -> vncnetwork.clipboard_data.type
3, // 4: vncnetwork.vnc_msg._type:type_name -> vncnetwork.vnc_msg.type
4, // 5: vncnetwork.vnc_msg.data:type_name -> vncnetwork.image_data
5, // 6: vncnetwork.vnc_msg.mouse:type_name -> vncnetwork.mouse_data
6, // 7: vncnetwork.vnc_msg.keyboard:type_name -> vncnetwork.keyboard_data
7, // 8: vncnetwork.vnc_msg.scroll:type_name -> vncnetwork.scroll_data
8, // 9: vncnetwork.vnc_msg.clipboard:type_name -> vncnetwork.clipboard_data
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_vncmsg_proto_init() }
@@ -737,6 +909,18 @@ func file_vncmsg_proto_init() {
}
}
file_vncmsg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ClipboardData); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_vncmsg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*VncMsg); i {
case 0:
return &v.state
@@ -750,19 +934,23 @@ func file_vncmsg_proto_init() {
}
}
file_vncmsg_proto_msgTypes[4].OneofWrappers = []interface{}{
(*ClipboardData_Data)(nil),
}
file_vncmsg_proto_msgTypes[5].OneofWrappers = []interface{}{
(*VncMsg_Data)(nil),
(*VncMsg_Mouse)(nil),
(*VncMsg_Keyboard)(nil),
(*VncMsg_ShowCursor)(nil),
(*VncMsg_Scroll)(nil),
(*VncMsg_Clipboard)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_vncmsg_proto_rawDesc,
NumEnums: 3,
NumMessages: 5,
NumEnums: 4,
NumMessages: 6,
NumExtensions: 0,
NumServices: 0,
},
+28 -11
View File
@@ -41,21 +41,38 @@ message scroll_data {
int32 y = 2;
}
message clipboard_data {
enum type {
unset_type = 0;
text = 1;
image = 2;
file = 3;
}
bool set = 1;
type _type = 2;
oneof payload {
bytes data = 10; // text data
// TODO
}
}
message vnc_msg {
enum type {
capture_req = 0;
capture_data = 1;
mouse_event = 2;
keyboard_event = 3;
set_cursor = 4;
scroll_event = 5;
capture_req = 0;
capture_data = 1;
mouse_event = 2;
keyboard_event = 3;
set_cursor = 4;
scroll_event = 5;
clipboard_event = 6;
}
type _type = 1;
oneof payload {
image_data data = 2;
mouse_data mouse = 3;
keyboard_data keyboard = 4;
bool show_cursor = 5;
scroll_data scroll = 6;
image_data data = 2;
mouse_data mouse = 3;
keyboard_data keyboard = 4;
bool show_cursor = 5;
scroll_data scroll = 6;
clipboard_data clipboard = 7;
}
}
+3
View File
@@ -13,3 +13,6 @@ func runKeyboard(data *vncnetwork.KeyboardData) {
func runScroll(data *vncnetwork.ScrollData) {
}
func runClipboard(data *vncnetwork.ClipboardData) {
}
@@ -59,3 +59,12 @@ func runScroll(data *vncnetwork.ScrollData) {
defer detach()
robotgo.Scroll(int(data.X), int(data.Y), 1)
}
func runClipboard(data *vncnetwork.ClipboardData) {
detach, err := attachDesktop()
if err != nil {
logging.Error("attach desktop: %v", err)
return
}
defer detach()
}
+2
View File
@@ -72,6 +72,8 @@ func (worker *Worker) Do(conn *websocket.Conn) {
worker.showCursor = msg.GetShowCursor()
case vncnetwork.VncMsg_scroll_event:
runScroll(msg.GetScroll())
case vncnetwork.VncMsg_clipboard_event:
runClipboard(msg.GetClipboard())
}
}
}
+70 -45
View File
@@ -34,12 +34,13 @@ const (
Msg_shell_resize MsgType = 10
Msg_shell_data MsgType = 11
// vnc
Msg_vnc_ctrl MsgType = 20
Msg_vnc_image MsgType = 21
Msg_vnc_mouse MsgType = 22
Msg_vnc_keyboard MsgType = 23
Msg_vnc_cad MsgType = 24 // ctrl+alt+del
Msg_vnc_scroll MsgType = 25
Msg_vnc_ctrl MsgType = 20
Msg_vnc_image MsgType = 21
Msg_vnc_mouse MsgType = 22
Msg_vnc_keyboard MsgType = 23
Msg_vnc_cad MsgType = 24 // ctrl+alt+del
Msg_vnc_scroll MsgType = 25
Msg_vnc_clipboard MsgType = 26
)
// Enum value maps for MsgType.
@@ -60,23 +61,25 @@ var (
23: "vnc_keyboard",
24: "vnc_cad",
25: "vnc_scroll",
26: "vnc_clipboard",
}
MsgType_value = map[string]int32{
"unknown": 0,
"handshake": 1,
"keepalive": 2,
"connect_req": 3,
"connect_rep": 4,
"disconnect": 5,
"forward": 6,
"shell_resize": 10,
"shell_data": 11,
"vnc_ctrl": 20,
"vnc_image": 21,
"vnc_mouse": 22,
"vnc_keyboard": 23,
"vnc_cad": 24,
"vnc_scroll": 25,
"unknown": 0,
"handshake": 1,
"keepalive": 2,
"connect_req": 3,
"connect_rep": 4,
"disconnect": 5,
"forward": 6,
"shell_resize": 10,
"shell_data": 11,
"vnc_ctrl": 20,
"vnc_image": 21,
"vnc_mouse": 22,
"vnc_keyboard": 23,
"vnc_cad": 24,
"vnc_scroll": 25,
"vnc_clipboard": 26,
}
)
@@ -177,6 +180,7 @@ type Msg struct {
// *Msg_Vmouse
// *Msg_Vkbd
// *Msg_Vscroll
// *Msg_Vclipboard
Payload isMsg_Payload `protobuf_oneof:"payload"`
}
@@ -338,6 +342,13 @@ func (x *Msg) GetVscroll() *VncScroll {
return nil
}
func (x *Msg) GetVclipboard() *VncClipboard {
if x, ok := x.GetPayload().(*Msg_Vclipboard); ok {
return x.Vclipboard
}
return nil
}
type isMsg_Payload interface {
isMsg_Payload()
}
@@ -388,6 +399,10 @@ type Msg_Vscroll struct {
Vscroll *VncScroll `protobuf:"bytes,34,opt,name=vscroll,proto3,oneof"`
}
type Msg_Vclipboard struct {
Vclipboard *VncClipboard `protobuf:"bytes,35,opt,name=vclipboard,proto3,oneof"`
}
func (*Msg_Hsp) isMsg_Payload() {}
func (*Msg_Creq) isMsg_Payload() {}
@@ -410,6 +425,8 @@ func (*Msg_Vkbd) isMsg_Payload() {}
func (*Msg_Vscroll) isMsg_Payload() {}
func (*Msg_Vclipboard) isMsg_Payload() {}
var File_msg_proto protoreflect.FileDescriptor
var file_msg_proto_rawDesc = []byte{
@@ -420,7 +437,7 @@ var file_msg_proto_rawDesc = []byte{
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, 0x92, 0x07, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x26, 0x0a, 0x05, 0x5f, 0x74, 0x79,
0x63, 0x22, 0xdf, 0x07, 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,
@@ -461,24 +478,29 @@ var file_msg_proto_rawDesc = []byte{
0x72, 0x64, 0x48, 0x00, 0x52, 0x04, 0x76, 0x6b, 0x62, 0x64, 0x12, 0x2f, 0x0a, 0x07, 0x76, 0x73,
0x63, 0x72, 0x6f, 0x6c, 0x6c, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6e, 0x65,
0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x76, 0x6e, 0x63, 0x5f, 0x73, 0x63, 0x72, 0x6f, 0x6c, 0x6c,
0x48, 0x00, 0x52, 0x07, 0x76, 0x73, 0x63, 0x72, 0x6f, 0x6c, 0x6c, 0x22, 0xed, 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, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x10, 0x15, 0x12, 0x0d, 0x0a,
0x09, 0x76, 0x6e, 0x63, 0x5f, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x10, 0x16, 0x12, 0x10, 0x0a, 0x0c,
0x76, 0x6e, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x10, 0x17, 0x12, 0x0b,
0x0a, 0x07, 0x76, 0x6e, 0x63, 0x5f, 0x63, 0x61, 0x64, 0x10, 0x18, 0x12, 0x0e, 0x0a, 0x0a, 0x76,
0x6e, 0x63, 0x5f, 0x73, 0x63, 0x72, 0x6f, 0x6c, 0x6c, 0x10, 0x19, 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,
0x48, 0x00, 0x52, 0x07, 0x76, 0x73, 0x63, 0x72, 0x6f, 0x6c, 0x6c, 0x12, 0x38, 0x0a, 0x0a, 0x76,
0x63, 0x6c, 0x69, 0x70, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x18, 0x23, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x16, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x76, 0x6e, 0x63, 0x5f, 0x63, 0x6c,
0x69, 0x70, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x48, 0x00, 0x52, 0x0a, 0x76, 0x63, 0x6c, 0x69, 0x70,
0x62, 0x6f, 0x61, 0x72, 0x64, 0x22, 0x80, 0x02, 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,
0x69, 0x6d, 0x61, 0x67, 0x65, 0x10, 0x15, 0x12, 0x0d, 0x0a, 0x09, 0x76, 0x6e, 0x63, 0x5f, 0x6d,
0x6f, 0x75, 0x73, 0x65, 0x10, 0x16, 0x12, 0x10, 0x0a, 0x0c, 0x76, 0x6e, 0x63, 0x5f, 0x6b, 0x65,
0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x10, 0x17, 0x12, 0x0b, 0x0a, 0x07, 0x76, 0x6e, 0x63, 0x5f,
0x63, 0x61, 0x64, 0x10, 0x18, 0x12, 0x0e, 0x0a, 0x0a, 0x76, 0x6e, 0x63, 0x5f, 0x73, 0x63, 0x72,
0x6f, 0x6c, 0x6c, 0x10, 0x19, 0x12, 0x11, 0x0a, 0x0d, 0x76, 0x6e, 0x63, 0x5f, 0x63, 0x6c, 0x69,
0x70, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x10, 0x1a, 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,
}
var (
@@ -509,6 +531,7 @@ var file_msg_proto_goTypes = []interface{}{
(*VncMouse)(nil), // 10: network.vnc_mouse
(*VncKeyboard)(nil), // 11: network.vnc_keyboard
(*VncScroll)(nil), // 12: network.vnc_scroll
(*VncClipboard)(nil), // 13: network.vnc_clipboard
}
var file_msg_proto_depIdxs = []int32{
0, // 0: network.msg._type:type_name -> network.msg.type
@@ -523,11 +546,12 @@ var file_msg_proto_depIdxs = []int32{
10, // 9: network.msg.vmouse:type_name -> network.vnc_mouse
11, // 10: network.msg.vkbd:type_name -> network.vnc_keyboard
12, // 11: network.msg.vscroll:type_name -> network.vnc_scroll
12, // [12:12] is the sub-list for method output_type
12, // [12:12] 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
13, // 12: network.msg.vclipboard:type_name -> network.vnc_clipboard
13, // [13:13] is the sub-list for method output_type
13, // [13:13] is the sub-list for method input_type
13, // [13:13] is the sub-list for extension type_name
13, // [13:13] is the sub-list for extension extendee
0, // [0:13] is the sub-list for field type_name
}
func init() { file_msg_proto_init() }
@@ -577,6 +601,7 @@ func file_msg_proto_init() {
(*Msg_Vmouse)(nil),
(*Msg_Vkbd)(nil),
(*Msg_Vscroll)(nil),
(*Msg_Vclipboard)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
+13 -11
View File
@@ -25,12 +25,13 @@ message msg {
shell_resize = 10;
shell_data = 11;
// vnc
vnc_ctrl = 20;
vnc_image = 21;
vnc_mouse = 22;
vnc_keyboard = 23;
vnc_cad = 24; // ctrl+alt+del
vnc_scroll = 25;
vnc_ctrl = 20;
vnc_image = 21;
vnc_mouse = 22;
vnc_keyboard = 23;
vnc_cad = 24; // ctrl+alt+del
vnc_scroll = 25;
vnc_clipboard = 26;
}
type _type = 1;
string from = 2;
@@ -47,10 +48,11 @@ message msg {
shell_resize sresize = 20;
shell_data sdata = 21;
// vnc
vnc_control vctrl = 30;
vnc_image vimg = 31;
vnc_mouse vmouse = 32;
vnc_keyboard vkbd = 33;
vnc_scroll vscroll = 34;
vnc_control vctrl = 30;
vnc_image vimg = 31;
vnc_mouse vmouse = 32;
vnc_keyboard vkbd = 33;
vnc_scroll vscroll = 34;
vnc_clipboard vclipboard = 35;
}
}
+190 -27
View File
@@ -170,6 +170,58 @@ func (VncMouseButton) EnumDescriptor() ([]byte, []int) {
return file_vnc_proto_rawDescGZIP(), []int{2, 0}
}
type VncClipboardType int32
const (
VncClipboard_unset_type VncClipboardType = 0
VncClipboard_text VncClipboardType = 1
VncClipboard_image VncClipboardType = 2
VncClipboard_file VncClipboardType = 3
)
// Enum value maps for VncClipboardType.
var (
VncClipboardType_name = map[int32]string{
0: "unset_type",
1: "text",
2: "image",
3: "file",
}
VncClipboardType_value = map[string]int32{
"unset_type": 0,
"text": 1,
"image": 2,
"file": 3,
}
)
func (x VncClipboardType) Enum() *VncClipboardType {
p := new(VncClipboardType)
*p = x
return p
}
func (x VncClipboardType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (VncClipboardType) Descriptor() protoreflect.EnumDescriptor {
return file_vnc_proto_enumTypes[3].Descriptor()
}
func (VncClipboardType) Type() protoreflect.EnumType {
return &file_vnc_proto_enumTypes[3]
}
func (x VncClipboardType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use VncClipboardType.Descriptor instead.
func (VncClipboardType) EnumDescriptor() ([]byte, []int) {
return file_vnc_proto_rawDescGZIP(), []int{5, 0}
}
type VncControl struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -470,6 +522,88 @@ func (x *VncScroll) GetY() int32 {
return 0
}
type VncClipboard struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Set bool `protobuf:"varint,1,opt,name=set,proto3" json:"set,omitempty"`
XType VncClipboardType `protobuf:"varint,2,opt,name=_type,json=Type,proto3,enum=network.VncClipboardType" json:"_type,omitempty"`
// Types that are assignable to Payload:
// *VncClipboard_Data
Payload isVncClipboard_Payload `protobuf_oneof:"payload"`
}
func (x *VncClipboard) Reset() {
*x = VncClipboard{}
if protoimpl.UnsafeEnabled {
mi := &file_vnc_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *VncClipboard) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*VncClipboard) ProtoMessage() {}
func (x *VncClipboard) ProtoReflect() protoreflect.Message {
mi := &file_vnc_proto_msgTypes[5]
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 VncClipboard.ProtoReflect.Descriptor instead.
func (*VncClipboard) Descriptor() ([]byte, []int) {
return file_vnc_proto_rawDescGZIP(), []int{5}
}
func (x *VncClipboard) GetSet() bool {
if x != nil {
return x.Set
}
return false
}
func (x *VncClipboard) GetXType() VncClipboardType {
if x != nil {
return x.XType
}
return VncClipboard_unset_type
}
func (m *VncClipboard) GetPayload() isVncClipboard_Payload {
if m != nil {
return m.Payload
}
return nil
}
func (x *VncClipboard) GetData() []byte {
if x, ok := x.GetPayload().(*VncClipboard_Data); ok {
return x.Data
}
return nil
}
type isVncClipboard_Payload interface {
isVncClipboard_Payload()
}
type VncClipboard_Data struct {
Data []byte `protobuf:"bytes,10,opt,name=data,proto3,oneof"` // text data
}
func (*VncClipboard_Data) isVncClipboard_Payload() {}
type VncImageInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -486,7 +620,7 @@ type VncImageInfo struct {
func (x *VncImageInfo) Reset() {
*x = VncImageInfo{}
if protoimpl.UnsafeEnabled {
mi := &file_vnc_proto_msgTypes[5]
mi := &file_vnc_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -499,7 +633,7 @@ func (x *VncImageInfo) String() string {
func (*VncImageInfo) ProtoMessage() {}
func (x *VncImageInfo) ProtoReflect() protoreflect.Message {
mi := &file_vnc_proto_msgTypes[5]
mi := &file_vnc_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -607,11 +741,22 @@ var file_vnc_proto_rawDesc = []byte{
0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x28, 0x0a, 0x0a, 0x76, 0x6e, 0x63, 0x5f, 0x73, 0x63,
0x72, 0x6f, 0x6c, 0x6c, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 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,
0x22, 0xab, 0x01, 0x0a, 0x0d, 0x76, 0x6e, 0x63, 0x5f, 0x63, 0x6c, 0x69, 0x70, 0x62, 0x6f, 0x61,
0x72, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
0x03, 0x73, 0x65, 0x74, 0x12, 0x30, 0x0a, 0x05, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x76, 0x6e,
0x63, 0x5f, 0x63, 0x6c, 0x69, 0x70, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x2e, 0x74, 0x79, 0x70, 0x65,
0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0a,
0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x35, 0x0a, 0x04,
0x74, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x75, 0x6e, 0x73, 0x65, 0x74, 0x5f, 0x74, 0x79,
0x70, 0x65, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x10, 0x01, 0x12, 0x09,
0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x66, 0x69, 0x6c,
0x65, 0x10, 0x03, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 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 (
@@ -626,30 +771,33 @@ func file_vnc_proto_rawDescGZIP() []byte {
return file_vnc_proto_rawDescData
}
var file_vnc_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
var file_vnc_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_vnc_proto_enumTypes = make([]protoimpl.EnumInfo, 4)
var file_vnc_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
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
(*VncScroll)(nil), // 7: network.vnc_scroll
(*VncImageInfo)(nil), // 8: network.vnc_image.info
(VncClipboardType)(0), // 3: network.vnc_clipboard.type
(*VncControl)(nil), // 4: network.vnc_control
(*VncImage)(nil), // 5: network.vnc_image
(*VncMouse)(nil), // 6: network.vnc_mouse
(*VncKeyboard)(nil), // 7: network.vnc_keyboard
(*VncScroll)(nil), // 8: network.vnc_scroll
(*VncClipboard)(nil), // 9: network.vnc_clipboard
(*VncImageInfo)(nil), // 10: network.vnc_image.info
}
var file_vnc_proto_depIdxs = []int32{
8, // 0: network.vnc_image._info:type_name -> network.vnc_image.info
1, // 1: network.vnc_image.encode:type_name -> network.vnc_image.encoding
0, // 2: network.vnc_mouse.type:type_name -> network.vnc_status
2, // 3: network.vnc_mouse.btn:type_name -> network.vnc_mouse.button
0, // 4: network.vnc_keyboard.type:type_name -> network.vnc_status
5, // [5:5] is the sub-list for method output_type
5, // [5:5] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
10, // 0: network.vnc_image._info:type_name -> network.vnc_image.info
1, // 1: network.vnc_image.encode:type_name -> network.vnc_image.encoding
0, // 2: network.vnc_mouse.type:type_name -> network.vnc_status
2, // 3: network.vnc_mouse.btn:type_name -> network.vnc_mouse.button
0, // 4: network.vnc_keyboard.type:type_name -> network.vnc_status
3, // 5: network.vnc_clipboard._type:type_name -> network.vnc_clipboard.type
6, // [6:6] is the sub-list for method output_type
6, // [6:6] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
}
func init() { file_vnc_proto_init() }
@@ -719,6 +867,18 @@ func file_vnc_proto_init() {
}
}
file_vnc_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*VncClipboard); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_vnc_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*VncImageInfo); i {
case 0:
return &v.state
@@ -731,13 +891,16 @@ func file_vnc_proto_init() {
}
}
}
file_vnc_proto_msgTypes[5].OneofWrappers = []interface{}{
(*VncClipboard_Data)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_vnc_proto_rawDesc,
NumEnums: 3,
NumMessages: 6,
NumEnums: 4,
NumMessages: 7,
NumExtensions: 0,
NumServices: 0,
},
+15
View File
@@ -55,4 +55,19 @@ message vnc_keyboard {
message vnc_scroll {
int32 x = 1;
int32 y = 2;
}
message vnc_clipboard {
enum type {
unset_type = 0;
text = 1;
image = 2;
file = 3;
}
bool set = 1;
type _type = 2;
oneof payload {
bytes data = 10; // text data
// TODO
}
}