mirror of
https://github.com/lwch/natpass.git
synced 2026-10-21 05:22:00 +00:00
实现图像数据处理
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
|
||||
func connect(mgr *tunnel.Mgr, conn *pool.Conn, msg *network.Msg) {
|
||||
req := msg.GetCreq()
|
||||
// TODO: 创建tcp连接移到reverse包中实现
|
||||
dial := "tcp"
|
||||
if req.GetXType() == network.ConnectRequest_udp {
|
||||
dial = "udp"
|
||||
@@ -86,6 +87,7 @@ func vncCreate(mgr *tunnel.Mgr, conn *pool.Conn, msg *network.Msg) {
|
||||
mgr.Add(tn)
|
||||
}
|
||||
lk := tn.NewLink(msg.GetLinkId(), msg.GetFrom(), msg.GetFromIdx(), nil, conn).(*vnc.Link)
|
||||
lk.SetQuality(create.GetCvnc().GetQuality())
|
||||
err := lk.Fork()
|
||||
if err != nil {
|
||||
logging.Error("create vnc failed: %v", err)
|
||||
|
||||
@@ -67,6 +67,36 @@ func (conn *Conn) SendConnectReq(id string, cfg global.Tunnel) {
|
||||
}
|
||||
}
|
||||
|
||||
// SendConnectVnc send connect vnc request message
|
||||
func (conn *Conn) SendConnectVnc(id string, cfg global.Tunnel, quality uint64) {
|
||||
var msg network.Msg
|
||||
msg.To = cfg.Target
|
||||
msg.XType = network.Msg_connect_req
|
||||
msg.LinkId = id
|
||||
fps := cfg.Fps
|
||||
if fps > 50 {
|
||||
fps = 50
|
||||
} else if fps == 0 {
|
||||
fps = 10
|
||||
}
|
||||
msg.Payload = &network.Msg_Creq{
|
||||
Creq: &network.ConnectRequest{
|
||||
Name: cfg.Name,
|
||||
XType: network.ConnectRequest_vnc,
|
||||
Payload: &network.ConnectRequest_Cvnc{
|
||||
Cvnc: &network.ConnectVnc{
|
||||
Fps: cfg.Fps,
|
||||
Quality: uint32(quality),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
select {
|
||||
case conn.write <- &msg:
|
||||
case <-time.After(conn.parent.cfg.WriteTimeout):
|
||||
}
|
||||
}
|
||||
|
||||
// SendConnectError send connect error response message
|
||||
func (conn *Conn) SendConnectError(to string, toIdx uint32, id, info string) {
|
||||
var msg network.Msg
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package pool
|
||||
|
||||
import (
|
||||
"image"
|
||||
"natpass/code/network"
|
||||
"time"
|
||||
)
|
||||
|
||||
// SendVNCImage send vnc image data
|
||||
func (conn *Conn) SendVNCImage(to string, toIdx uint32, id string, screen, rect image.Rectangle,
|
||||
encode network.VncImageEncoding, data []byte) {
|
||||
var msg network.Msg
|
||||
msg.To = to
|
||||
msg.ToIdx = toIdx
|
||||
msg.XType = network.Msg_shell_resize
|
||||
msg.LinkId = id
|
||||
msg.Payload = &network.Msg_Vimg{
|
||||
Vimg: &network.VncImage{
|
||||
XInfo: &network.VncImageInfo{
|
||||
ScreenWidth: uint32(screen.Dx()),
|
||||
ScreenHeight: uint32(screen.Dy()),
|
||||
RectX: uint32(rect.Min.X),
|
||||
RectY: uint32(rect.Min.Y),
|
||||
RectWidth: uint32(rect.Dx()),
|
||||
RectHeight: uint32(rect.Dy()),
|
||||
},
|
||||
Encode: encode,
|
||||
Data: data,
|
||||
},
|
||||
}
|
||||
select {
|
||||
case conn.write <- &msg:
|
||||
case <-time.After(conn.parent.cfg.WriteTimeout):
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
package core
|
||||
package define
|
||||
|
||||
import "syscall"
|
||||
|
||||
var (
|
||||
libGdi32, _ = syscall.LoadLibrary("Gdi32.dll")
|
||||
funcGetDeviceCaps, _ = syscall.GetProcAddress(syscall.Handle(libGdi32), "GetDeviceCaps")
|
||||
FuncGetDeviceCaps, _ = syscall.GetProcAddress(syscall.Handle(libGdi32), "GetDeviceCaps")
|
||||
)
|
||||
|
||||
const (
|
||||
+4
-4
@@ -1,12 +1,12 @@
|
||||
package core
|
||||
package define
|
||||
|
||||
import "syscall"
|
||||
|
||||
var (
|
||||
libKernel32, _ = syscall.LoadLibrary("kernel32.dll")
|
||||
funcWTSGetActiveConsoleSessionId, _ = syscall.GetProcAddress(syscall.Handle(libKernel32), "WTSGetActiveConsoleSessionId")
|
||||
funcGlobalAlloc, _ = syscall.GetProcAddress(syscall.Handle(libKernel32), "GlobalAlloc")
|
||||
funcGlobalFree, _ = syscall.GetProcAddress(syscall.Handle(libKernel32), "GlobalFree")
|
||||
FuncWTSGetActiveConsoleSessionId, _ = syscall.GetProcAddress(syscall.Handle(libKernel32), "WTSGetActiveConsoleSessionId")
|
||||
FuncGlobalAlloc, _ = syscall.GetProcAddress(syscall.Handle(libKernel32), "GlobalAlloc")
|
||||
FuncGlobalFree, _ = syscall.GetProcAddress(syscall.Handle(libKernel32), "GlobalFree")
|
||||
)
|
||||
|
||||
const PROCESS_ALL_ACCESS = 0x1F0FFF
|
||||
@@ -0,0 +1,14 @@
|
||||
package define
|
||||
|
||||
import "syscall"
|
||||
|
||||
var (
|
||||
libUser32, _ = syscall.LoadLibrary("user32.dll")
|
||||
FuncOpenInputDesktop, _ = syscall.GetProcAddress(syscall.Handle(libUser32), "OpenInputDesktop")
|
||||
FuncSetThreadDesktop, _ = syscall.GetProcAddress(syscall.Handle(libUser32), "SetThreadDesktop")
|
||||
FuncGetThreadDesktop, _ = syscall.GetProcAddress(syscall.Handle(libUser32), "GetThreadDesktop")
|
||||
FuncCloseDesktop, _ = syscall.GetProcAddress(syscall.Handle(libUser32), "CloseDesktop")
|
||||
FuncGetDesktopWindow, _ = syscall.GetProcAddress(syscall.Handle(libUser32), "GetDesktopWindow")
|
||||
FuncGetDC, _ = syscall.GetProcAddress(syscall.Handle(libUser32), "GetDC")
|
||||
FuncReleaseDC, _ = syscall.GetProcAddress(syscall.Handle(libUser32), "ReleaseDC")
|
||||
)
|
||||
@@ -181,8 +181,10 @@ type ImageData struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
DataInfo *ImageDataInfo `protobuf:"bytes,1,opt,name=data_info,json=dataInfo,proto3" json:"data_info,omitempty"`
|
||||
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
|
||||
Bits uint32 `protobuf:"varint,1,opt,name=bits,proto3" json:"bits,omitempty"`
|
||||
Width uint32 `protobuf:"varint,2,opt,name=width,proto3" json:"width,omitempty"`
|
||||
Height uint32 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"`
|
||||
Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ImageData) Reset() {
|
||||
@@ -217,11 +219,25 @@ func (*ImageData) Descriptor() ([]byte, []int) {
|
||||
return file_msg_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *ImageData) GetDataInfo() *ImageDataInfo {
|
||||
func (x *ImageData) GetBits() uint32 {
|
||||
if x != nil {
|
||||
return x.DataInfo
|
||||
return x.Bits
|
||||
}
|
||||
return nil
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ImageData) GetWidth() uint32 {
|
||||
if x != nil {
|
||||
return x.Width
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ImageData) GetHeight() uint32 {
|
||||
if x != nil {
|
||||
return x.Height
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ImageData) GetData() []byte {
|
||||
@@ -459,162 +475,54 @@ func (*Msg_Mouse) isMsg_Payload() {}
|
||||
|
||||
func (*Msg_Keyboard) isMsg_Payload() {}
|
||||
|
||||
type ImageDataInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ScreenBits uint32 `protobuf:"varint,1,opt,name=screen_bits,json=screenBits,proto3" json:"screen_bits,omitempty"`
|
||||
ScreenWidth uint32 `protobuf:"varint,2,opt,name=screen_width,json=screenWidth,proto3" json:"screen_width,omitempty"`
|
||||
ScreenHeight uint32 `protobuf:"varint,3,opt,name=screen_height,json=screenHeight,proto3" json:"screen_height,omitempty"`
|
||||
RectX uint32 `protobuf:"varint,4,opt,name=rect_x,json=rectX,proto3" json:"rect_x,omitempty"`
|
||||
RectY uint32 `protobuf:"varint,5,opt,name=rect_y,json=rectY,proto3" json:"rect_y,omitempty"`
|
||||
RectWidth uint32 `protobuf:"varint,6,opt,name=rect_width,json=rectWidth,proto3" json:"rect_width,omitempty"`
|
||||
RectHeight uint32 `protobuf:"varint,7,opt,name=rect_height,json=rectHeight,proto3" json:"rect_height,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ImageDataInfo) Reset() {
|
||||
*x = ImageDataInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_msg_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ImageDataInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ImageDataInfo) ProtoMessage() {}
|
||||
|
||||
func (x *ImageDataInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_msg_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 ImageDataInfo.ProtoReflect.Descriptor instead.
|
||||
func (*ImageDataInfo) Descriptor() ([]byte, []int) {
|
||||
return file_msg_proto_rawDescGZIP(), []int{0, 0}
|
||||
}
|
||||
|
||||
func (x *ImageDataInfo) GetScreenBits() uint32 {
|
||||
if x != nil {
|
||||
return x.ScreenBits
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ImageDataInfo) GetScreenWidth() uint32 {
|
||||
if x != nil {
|
||||
return x.ScreenWidth
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ImageDataInfo) GetScreenHeight() uint32 {
|
||||
if x != nil {
|
||||
return x.ScreenHeight
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ImageDataInfo) GetRectX() uint32 {
|
||||
if x != nil {
|
||||
return x.RectX
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ImageDataInfo) GetRectY() uint32 {
|
||||
if x != nil {
|
||||
return x.RectY
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ImageDataInfo) GetRectWidth() uint32 {
|
||||
if x != nil {
|
||||
return x.RectWidth
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ImageDataInfo) GetRectHeight() uint32 {
|
||||
if x != nil {
|
||||
return x.RectHeight
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_msg_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, 0xb4, 0x02, 0x0a, 0x0a, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61,
|
||||
0x12, 0x32, 0x0a, 0x09, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x69, 0x6d, 0x61, 0x67, 0x65,
|
||||
0x5f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x1a, 0xdd, 0x01, 0x0a, 0x04, 0x69, 0x6e, 0x66,
|
||||
0x6f, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x5f, 0x62, 0x69, 0x74, 0x73,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x42, 0x69,
|
||||
0x74, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x5f, 0x77, 0x69, 0x64,
|
||||
0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e,
|
||||
0x57, 0x69, 0x64, 0x74, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x5f,
|
||||
0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x73, 0x63,
|
||||
0x72, 0x65, 0x65, 0x6e, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x65,
|
||||
0x63, 0x74, 0x5f, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x72, 0x65, 0x63, 0x74,
|
||||
0x58, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28,
|
||||
0x0d, 0x52, 0x05, 0x72, 0x65, 0x63, 0x74, 0x59, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x63, 0x74,
|
||||
0x5f, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65,
|
||||
0x63, 0x74, 0x57, 0x69, 0x64, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x63, 0x74, 0x5f,
|
||||
0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x72, 0x65,
|
||||
0x63, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 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,
|
||||
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 (
|
||||
@@ -630,31 +538,29 @@ func file_msg_proto_rawDescGZIP() []byte {
|
||||
}
|
||||
|
||||
var file_msg_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
|
||||
var file_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||
var file_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_msg_proto_goTypes = []interface{}{
|
||||
(Status)(0), // 0: core.status
|
||||
(MouseDataButton)(0), // 1: core.mouse_data.button
|
||||
(MsgType)(0), // 2: core.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
|
||||
(*ImageDataInfo)(nil), // 7: core.image_data.info
|
||||
(Status)(0), // 0: core.status
|
||||
(MouseDataButton)(0), // 1: core.mouse_data.button
|
||||
(MsgType)(0), // 2: core.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
|
||||
}
|
||||
var file_msg_proto_depIdxs = []int32{
|
||||
7, // 0: core.image_data.data_info:type_name -> core.image_data.info
|
||||
0, // 1: core.mouse_data.type:type_name -> core.status
|
||||
1, // 2: core.mouse_data.btn:type_name -> core.mouse_data.button
|
||||
0, // 3: core.keyboard_data.type:type_name -> core.status
|
||||
2, // 4: core.msg._type:type_name -> core.msg.type
|
||||
3, // 5: core.msg.data:type_name -> core.image_data
|
||||
4, // 6: core.msg.mouse:type_name -> core.mouse_data
|
||||
5, // 7: core.msg.keyboard:type_name -> core.keyboard_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: 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
|
||||
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
|
||||
}
|
||||
|
||||
func init() { file_msg_proto_init() }
|
||||
@@ -711,18 +617,6 @@ func file_msg_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ImageDataInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
file_msg_proto_msgTypes[3].OneofWrappers = []interface{}{
|
||||
(*Msg_Data)(nil),
|
||||
@@ -735,7 +629,7 @@ func file_msg_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_msg_proto_rawDesc,
|
||||
NumEnums: 3,
|
||||
NumMessages: 5,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
@@ -4,17 +4,10 @@ package core;
|
||||
option go_package="./;core";
|
||||
|
||||
message image_data {
|
||||
message info {
|
||||
uint32 screen_bits = 1;
|
||||
uint32 screen_width = 2;
|
||||
uint32 screen_height = 3;
|
||||
uint32 rect_x = 4;
|
||||
uint32 rect_y = 5;
|
||||
uint32 rect_width = 6;
|
||||
uint32 rect_height = 7;
|
||||
}
|
||||
info data_info = 1;
|
||||
bytes data = 2;
|
||||
uint32 bits = 1;
|
||||
uint32 width = 2;
|
||||
uint32 height = 3;
|
||||
bytes data = 4;
|
||||
}
|
||||
|
||||
enum status {
|
||||
|
||||
@@ -3,11 +3,15 @@ package core
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"natpass/code/utils"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/lwch/logging"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -46,6 +50,47 @@ func (p *Process) ws(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
defer conn.Close()
|
||||
defer p.Close()
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(2)
|
||||
go func() {
|
||||
defer utils.Recover("ws read")
|
||||
defer wg.Done()
|
||||
for {
|
||||
_, data, err := conn.ReadMessage()
|
||||
if err != nil {
|
||||
logging.Error("read message: %v", err)
|
||||
return
|
||||
}
|
||||
var msg Msg
|
||||
err = proto.Unmarshal(data, &msg)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
switch msg.GetXType() {
|
||||
case Msg_capture_data:
|
||||
p.chImage <- msg.GetData()
|
||||
default:
|
||||
}
|
||||
}
|
||||
}()
|
||||
go func() {
|
||||
defer utils.Recover("ws write")
|
||||
defer wg.Done()
|
||||
for {
|
||||
msg := <-p.chWrite
|
||||
data, err := proto.Marshal(msg)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
err = conn.WriteMessage(websocket.BinaryMessage, data)
|
||||
if err != nil {
|
||||
logging.Error("write message: %v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
func (p *Process) kill() {
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"image"
|
||||
"natpass/code/client/tunnel/vnc/core/define"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
"unicode/utf16"
|
||||
"unsafe"
|
||||
|
||||
@@ -14,8 +18,10 @@ import (
|
||||
|
||||
// Process process
|
||||
type Process struct {
|
||||
pid int
|
||||
srv *http.Server
|
||||
pid int
|
||||
srv *http.Server
|
||||
chWrite chan *Msg
|
||||
chImage chan *ImageData
|
||||
}
|
||||
|
||||
func getLogonPid(sessionID uintptr) uint32 {
|
||||
@@ -62,13 +68,13 @@ func parseProcessName(exeFile [syscall.MAX_PATH]uint16) string {
|
||||
}
|
||||
|
||||
func getSessionID() uintptr {
|
||||
id, _, _ := syscall.Syscall(funcWTSGetActiveConsoleSessionId, 0, 0, 0, 0)
|
||||
id, _, _ := syscall.Syscall(define.FuncWTSGetActiveConsoleSessionId, 0, 0, 0, 0)
|
||||
return id
|
||||
}
|
||||
|
||||
func getSessionUserTokenWin() windows.Token {
|
||||
pid := getLogonPid(getSessionID())
|
||||
process, err := windows.OpenProcess(PROCESS_ALL_ACCESS, false, pid)
|
||||
process, err := windows.OpenProcess(define.PROCESS_ALL_ACCESS, false, pid)
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
@@ -93,6 +99,8 @@ func createWorker(tk windows.Token) (*Process, error) {
|
||||
return nil, err
|
||||
}
|
||||
var p Process
|
||||
p.chWrite = make(chan *Msg)
|
||||
p.chImage = make(chan *ImageData)
|
||||
port, err := p.listenAndServe()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -120,5 +128,40 @@ func (p *Process) Close() {
|
||||
if p.srv != nil {
|
||||
p.srv.Close()
|
||||
}
|
||||
if p.chImage != nil {
|
||||
close(p.chImage)
|
||||
}
|
||||
if p.chWrite != nil {
|
||||
close(p.chWrite)
|
||||
}
|
||||
p.kill()
|
||||
}
|
||||
|
||||
func (p *Process) Capture(timeout time.Duration) (*image.RGBA, error) {
|
||||
var msg Msg
|
||||
msg.XType = Msg_capture_req
|
||||
p.chWrite <- &msg
|
||||
trans := func(data *ImageData) *image.RGBA {
|
||||
img := image.NewRGBA(image.Rect(0, 0, int(data.GetWidth()), int(data.GetHeight())))
|
||||
switch data.GetBits() {
|
||||
case 8:
|
||||
// TODO
|
||||
case 24:
|
||||
// TODO
|
||||
case 32:
|
||||
copy(img.Pix, data.GetData())
|
||||
}
|
||||
return img
|
||||
}
|
||||
if timeout > 0 {
|
||||
select {
|
||||
case data := <-p.chImage:
|
||||
return trans(data), nil
|
||||
case <-time.After(timeout):
|
||||
return nil, errors.New("timeout")
|
||||
}
|
||||
} else {
|
||||
data := <-p.chImage
|
||||
return trans(data), nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package core
|
||||
|
||||
import "syscall"
|
||||
|
||||
var (
|
||||
libUser32, _ = syscall.LoadLibrary("user32.dll")
|
||||
funcOpenInputDesktop, _ = syscall.GetProcAddress(syscall.Handle(libUser32), "OpenInputDesktop")
|
||||
funcSetThreadDesktop, _ = syscall.GetProcAddress(syscall.Handle(libUser32), "SetThreadDesktop")
|
||||
funcGetThreadDesktop, _ = syscall.GetProcAddress(syscall.Handle(libUser32), "GetThreadDesktop")
|
||||
funcCloseDesktop, _ = syscall.GetProcAddress(syscall.Handle(libUser32), "CloseDesktop")
|
||||
funcGetDesktopWindow, _ = syscall.GetProcAddress(syscall.Handle(libUser32), "GetDesktopWindow")
|
||||
funcGetDC, _ = syscall.GetProcAddress(syscall.Handle(libUser32), "GetDC")
|
||||
funcReleaseDC, _ = syscall.GetProcAddress(syscall.Handle(libUser32), "ReleaseDC")
|
||||
)
|
||||
@@ -2,6 +2,7 @@ package core
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"natpass/code/client/tunnel/vnc/core/define"
|
||||
"runtime"
|
||||
"syscall"
|
||||
|
||||
@@ -18,21 +19,21 @@ type ctxOsBased struct {
|
||||
func (ctx *Context) attachDesktop() (func(), error) {
|
||||
runtime.LockOSThread()
|
||||
locked := true
|
||||
oldDesktop, _, err := syscall.Syscall(funcGetThreadDesktop, 1, uintptr(windows.GetCurrentThreadId()), 0, 0)
|
||||
oldDesktop, _, err := syscall.Syscall(define.FuncGetThreadDesktop, 1, uintptr(windows.GetCurrentThreadId()), 0, 0)
|
||||
if oldDesktop == 0 {
|
||||
return nil, fmt.Errorf("get thread desktop: %v", err)
|
||||
}
|
||||
desktop, _, err := syscall.Syscall(funcOpenInputDesktop, 3, 0, 0, windows.GENERIC_ALL)
|
||||
desktop, _, err := syscall.Syscall(define.FuncOpenInputDesktop, 3, 0, 0, windows.GENERIC_ALL)
|
||||
if desktop == 0 {
|
||||
return nil, fmt.Errorf("open input desktop: %v", err)
|
||||
}
|
||||
ok, _, err := syscall.Syscall(funcSetThreadDesktop, 1, desktop, 0, 0)
|
||||
ok, _, err := syscall.Syscall(define.FuncSetThreadDesktop, 1, desktop, 0, 0)
|
||||
if ok == 0 {
|
||||
logging.Error("set thread desktop: %v", err)
|
||||
}
|
||||
return func() {
|
||||
syscall.Syscall(funcSetThreadDesktop, 1, oldDesktop, 0, 0)
|
||||
syscall.Syscall(funcCloseDesktop, 1, desktop, 0, 0)
|
||||
syscall.Syscall(define.FuncSetThreadDesktop, 1, oldDesktop, 0, 0)
|
||||
syscall.Syscall(define.FuncCloseDesktop, 1, desktop, 0, 0)
|
||||
if locked {
|
||||
runtime.UnlockOSThread()
|
||||
locked = false
|
||||
@@ -59,16 +60,16 @@ func (ctx *Context) init() error {
|
||||
}
|
||||
|
||||
func (ctx *Context) getHandle() error {
|
||||
hwnd, _, err := syscall.Syscall(funcGetDesktopWindow, 0, 0, 0, 0)
|
||||
hwnd, _, err := syscall.Syscall(define.FuncGetDesktopWindow, 0, 0, 0, 0)
|
||||
if hwnd == 0 {
|
||||
return fmt.Errorf("get desktop window: %v", err)
|
||||
}
|
||||
hdc, _, err := syscall.Syscall(funcGetDC, 1, hwnd, 0, 0)
|
||||
hdc, _, err := syscall.Syscall(define.FuncGetDC, 1, hwnd, 0, 0)
|
||||
if hdc == 0 {
|
||||
return fmt.Errorf("get dc: %v", err)
|
||||
}
|
||||
if ctx.hdc != 0 {
|
||||
syscall.Syscall(funcReleaseDC, 2, ctx.hwnd, ctx.hdc, 0)
|
||||
syscall.Syscall(define.FuncReleaseDC, 2, ctx.hwnd, ctx.hdc, 0)
|
||||
}
|
||||
ctx.hwnd = hwnd
|
||||
ctx.hdc = hdc
|
||||
@@ -76,15 +77,15 @@ func (ctx *Context) getHandle() error {
|
||||
}
|
||||
|
||||
func (ctx *Context) updateInfo() error {
|
||||
bits, _, err := syscall.Syscall(funcGetDeviceCaps, 2, ctx.hdc, BITSPIXEL, 0)
|
||||
bits, _, err := syscall.Syscall(define.FuncGetDeviceCaps, 2, ctx.hdc, define.BITSPIXEL, 0)
|
||||
if bits == 0 {
|
||||
return fmt.Errorf("get device caps(bits): %v", err)
|
||||
}
|
||||
width, _, err := syscall.Syscall(funcGetDeviceCaps, 2, ctx.hdc, HORZRES, 0)
|
||||
width, _, err := syscall.Syscall(define.FuncGetDeviceCaps, 2, ctx.hdc, define.HORZRES, 0)
|
||||
if width == 0 {
|
||||
return fmt.Errorf("get device caps(width): %v", err)
|
||||
}
|
||||
height, _, err := syscall.Syscall(funcGetDeviceCaps, 2, ctx.hdc, VERTRES, 0)
|
||||
height, _, err := syscall.Syscall(define.FuncGetDeviceCaps, 2, ctx.hdc, define.VERTRES, 0)
|
||||
if height == 0 {
|
||||
return fmt.Errorf("get device caps(height): %v", err)
|
||||
}
|
||||
@@ -95,12 +96,12 @@ func (ctx *Context) updateInfo() error {
|
||||
}
|
||||
|
||||
func (ctx *Context) updateBuffer() error {
|
||||
addr, _, err := syscall.Syscall(funcGlobalAlloc, 2, GMEM_FIXED, uintptr(ctx.Info.Bits*ctx.Info.Width*ctx.Info.Height/8), 0)
|
||||
addr, _, err := syscall.Syscall(define.FuncGlobalAlloc, 2, define.GMEM_FIXED, uintptr(ctx.Info.Bits*ctx.Info.Width*ctx.Info.Height/8), 0)
|
||||
if addr == 0 {
|
||||
return fmt.Errorf("global alloc: %v", err)
|
||||
}
|
||||
if ctx.buffer != 0 {
|
||||
syscall.Syscall(funcGlobalFree, 1, ctx.buffer, 0, 0)
|
||||
syscall.Syscall(define.FuncGlobalFree, 1, ctx.buffer, 0, 0)
|
||||
}
|
||||
ctx.buffer = addr
|
||||
return nil
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package vnc
|
||||
|
||||
import (
|
||||
"image"
|
||||
"reflect"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func calcDiff(src, dst *image.RGBA) []image.Rectangle {
|
||||
// 宽度必须为2的倍数
|
||||
const width = 64
|
||||
const height = 64
|
||||
size := dst.Bounds()
|
||||
ret := make([]image.Rectangle, 0, (size.Max.X*size.Max.Y)/(width*height))
|
||||
for y := 0; y < size.Max.Y; y += height {
|
||||
for x := 0; x < size.Max.X; x += width {
|
||||
dWidth := size.Max.X - x
|
||||
dHeight := size.Max.Y - y
|
||||
if dWidth > width {
|
||||
dWidth = width
|
||||
}
|
||||
if dHeight > height {
|
||||
dHeight = height
|
||||
}
|
||||
rect := image.Rect(x, y, x+dWidth, y+dHeight)
|
||||
if dWidth%2 == 0 {
|
||||
if isDiff8(src, dst, rect) {
|
||||
ret = append(ret, rect)
|
||||
}
|
||||
} else {
|
||||
if isDiff4(src, dst, rect) {
|
||||
ret = append(ret, rect)
|
||||
}
|
||||
}
|
||||
////////
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func isDiff8(src, dst *image.RGBA, rect image.Rectangle) bool {
|
||||
sx := src.Bounds().Max.X * 4
|
||||
dx := rect.Min.X * 4
|
||||
ptr := uintptr(rect.Min.Y*sx + dx)
|
||||
srcData := unsafe.Pointer((*reflect.SliceHeader)(unsafe.Pointer(&src.Pix)).Data)
|
||||
dstData := unsafe.Pointer((*reflect.SliceHeader)(unsafe.Pointer(&dst.Pix)).Data)
|
||||
for y := 0; y < rect.Size().Y; y++ {
|
||||
next := ptr + uintptr(sx)
|
||||
for x := 0; x < rect.Size().X; x += 2 {
|
||||
src := (*uint64)(unsafe.Pointer(uintptr(srcData) + ptr))
|
||||
dst := (*uint64)(unsafe.Pointer(uintptr(dstData) + ptr))
|
||||
if *src != *dst {
|
||||
return true
|
||||
}
|
||||
ptr += 8
|
||||
}
|
||||
ptr = next
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func isDiff4(src, dst *image.RGBA, rect image.Rectangle) bool {
|
||||
sx := src.Bounds().Max.X * 4
|
||||
dx := rect.Min.X * 4
|
||||
ptr := uintptr(rect.Min.Y*sx + dx)
|
||||
srcData := unsafe.Pointer((*reflect.SliceHeader)(unsafe.Pointer(&src.Pix)).Data)
|
||||
dstData := unsafe.Pointer((*reflect.SliceHeader)(unsafe.Pointer(&dst.Pix)).Data)
|
||||
for y := 0; y < rect.Size().Y; y++ {
|
||||
next := ptr + uintptr(sx)
|
||||
for x := 0; x < rect.Size().X; x++ {
|
||||
src := (*uint64)(unsafe.Pointer(uintptr(srcData) + ptr))
|
||||
dst := (*uint64)(unsafe.Pointer(uintptr(dstData) + ptr))
|
||||
if *src != *dst {
|
||||
return true
|
||||
}
|
||||
ptr += 4
|
||||
}
|
||||
ptr = next
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"natpass/code/client/pool"
|
||||
"natpass/code/network"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/lwch/logging"
|
||||
@@ -16,6 +17,11 @@ func (v *VNC) New(pool *pool.Pool, w http.ResponseWriter, r *http.Request) {
|
||||
if v.link != nil {
|
||||
v.link.close()
|
||||
}
|
||||
q := r.FormValue("quality")
|
||||
quality, err := strconv.ParseUint(q, 10, 32)
|
||||
if err != nil {
|
||||
quality = 75
|
||||
}
|
||||
id, err := runtime.UUID(16, "0123456789abcdef")
|
||||
if err != nil {
|
||||
logging.Error("failed to generate link_id for vnc: %s, err=%v",
|
||||
@@ -24,8 +30,8 @@ func (v *VNC) New(pool *pool.Pool, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
conn := pool.Get(id)
|
||||
conn.SendConnectReq(id, v.cfg)
|
||||
v.link = NewLink(v, id, v.cfg.Target, conn)
|
||||
conn.SendConnectVnc(id, v.cfg, quality)
|
||||
v.link = v.NewLink(id, v.cfg.Target, 0, nil, conn).(*Link)
|
||||
ch := conn.ChanRead(id)
|
||||
timeout := time.After(conn.ReadTimeout)
|
||||
for {
|
||||
@@ -37,6 +43,7 @@ func (v *VNC) New(pool *pool.Pool, w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, "timeout", http.StatusBadGateway)
|
||||
return
|
||||
}
|
||||
v.link.SetTargetIdx(msg.GetFromIdx())
|
||||
if msg.GetXType() != network.Msg_connect_rep {
|
||||
conn.Reset(id, msg)
|
||||
time.Sleep(conn.ReadTimeout / 10)
|
||||
|
||||
+116
-19
@@ -1,12 +1,23 @@
|
||||
package vnc
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"image"
|
||||
"image/jpeg"
|
||||
"natpass/code/client/pool"
|
||||
"natpass/code/client/tunnel/vnc/core"
|
||||
"natpass/code/network"
|
||||
"natpass/code/utils"
|
||||
"time"
|
||||
|
||||
"github.com/lwch/logging"
|
||||
)
|
||||
|
||||
const (
|
||||
zoneWidth = 256
|
||||
zoneHeight = 256
|
||||
)
|
||||
|
||||
// Link vnc link
|
||||
type Link struct {
|
||||
parent *VNC
|
||||
@@ -15,25 +26,16 @@ type Link struct {
|
||||
targetIdx uint32 // target idx
|
||||
remote *pool.Conn
|
||||
// vnc
|
||||
ps *core.Process
|
||||
ps *core.Process
|
||||
quality uint32
|
||||
img *image.RGBA
|
||||
// runtime
|
||||
sendBytes uint64
|
||||
recvBytes uint64
|
||||
sendPacket uint64
|
||||
recvPacket uint64
|
||||
}
|
||||
|
||||
// NewLink create link
|
||||
func NewLink(parent *VNC, id, target string, remote *pool.Conn) *Link {
|
||||
remote.AddLink(id)
|
||||
logging.Info("create link %s for tunnel %s on connection %d",
|
||||
id, parent.Name, remote.Idx)
|
||||
return &Link{
|
||||
parent: parent,
|
||||
id: id,
|
||||
target: target,
|
||||
remote: remote,
|
||||
}
|
||||
sendBytes uint64
|
||||
recvBytes uint64
|
||||
sendPacket uint64
|
||||
recvPacket uint64
|
||||
idx int
|
||||
resetQuality bool
|
||||
}
|
||||
|
||||
// GetID get link id
|
||||
@@ -56,6 +58,12 @@ func (link *Link) SetTargetIdx(idx uint32) {
|
||||
link.targetIdx = idx
|
||||
}
|
||||
|
||||
// SetQuality transfer quality
|
||||
func (link *Link) SetQuality(q uint32) {
|
||||
link.quality = q
|
||||
link.resetQuality = true
|
||||
}
|
||||
|
||||
// Fork fork worker process
|
||||
func (link *Link) Fork() error {
|
||||
p, err := core.CreateWorkerProcess()
|
||||
@@ -68,11 +76,100 @@ func (link *Link) Fork() error {
|
||||
|
||||
// Forward forward data
|
||||
func (link *Link) Forward() {
|
||||
go func() {
|
||||
// TODO: exit by context
|
||||
defer utils.Recover("capture")
|
||||
defer link.close()
|
||||
img, err := link.ps.Capture(3 * time.Second)
|
||||
if err != nil {
|
||||
logging.Error("capture: %v", err)
|
||||
return
|
||||
}
|
||||
link.sendAll(img)
|
||||
link.img = img
|
||||
size := img.Rect
|
||||
sleep := time.Second / time.Duration(link.parent.cfg.Fps)
|
||||
for {
|
||||
time.Sleep(sleep)
|
||||
img, err = link.ps.Capture(0)
|
||||
if err != nil {
|
||||
logging.Error("capture: %v", err)
|
||||
continue
|
||||
}
|
||||
if img.Rect.Dx() != size.Dx() ||
|
||||
img.Rect.Dy() != size.Dy() ||
|
||||
link.resetQuality ||
|
||||
link.idx%100 == 0 {
|
||||
link.sendAll(img)
|
||||
link.resetQuality = false
|
||||
} else {
|
||||
link.sendDiff(img)
|
||||
}
|
||||
link.img = img
|
||||
link.idx++
|
||||
}
|
||||
}()
|
||||
go func() {
|
||||
ch := link.remote.ChanRead(link.id)
|
||||
for {
|
||||
msg := <-ch
|
||||
switch msg.GetXType() {
|
||||
case network.Msg_vnc_ctrl:
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func (link *Link) close() {
|
||||
if link.ps != nil {
|
||||
link.ps.Close()
|
||||
}
|
||||
// TODO: send close message
|
||||
link.remote.SendDisconnect(link.target, link.targetIdx, link.id)
|
||||
}
|
||||
|
||||
func (link *Link) sendAll(img *image.RGBA) {
|
||||
size := img.Bounds()
|
||||
screen := image.Rect(0, 0, img.Rect.Dx(), img.Rect.Dy())
|
||||
var buf bytes.Buffer
|
||||
for y := 0; y < size.Max.Y; y += zoneHeight {
|
||||
for x := 0; x < size.Max.X; x += zoneWidth {
|
||||
width := size.Max.X - x
|
||||
height := size.Max.Y - y
|
||||
if width > zoneWidth {
|
||||
width = zoneWidth
|
||||
}
|
||||
if height > zoneHeight {
|
||||
height = zoneHeight
|
||||
}
|
||||
rect := image.Rect(x, y, x+width, y+height)
|
||||
next := img.SubImage(rect)
|
||||
buf.Reset()
|
||||
err := jpeg.Encode(&buf, next, &jpeg.Options{Quality: int(link.quality)})
|
||||
if err == nil {
|
||||
link.remote.SendVNCImage(link.target, link.targetIdx, link.id,
|
||||
screen, rect, network.VncImage_jpeg, buf.Bytes())
|
||||
} else {
|
||||
link.remote.SendVNCImage(link.target, link.targetIdx, link.id,
|
||||
screen, rect, network.VncImage_raw, next.(*image.RGBA).Pix)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (link *Link) sendDiff(img *image.RGBA) {
|
||||
blocks := calcDiff(link.img, img)
|
||||
screen := image.Rect(0, 0, img.Rect.Dx(), img.Rect.Dy())
|
||||
var buf bytes.Buffer
|
||||
for _, block := range blocks {
|
||||
next := img.SubImage(block)
|
||||
buf.Reset()
|
||||
err := jpeg.Encode(&buf, next, &jpeg.Options{Quality: int(link.quality)})
|
||||
if err == nil {
|
||||
link.remote.SendVNCImage(link.target, link.targetIdx, link.id,
|
||||
screen, block, network.VncImage_jpeg, buf.Bytes())
|
||||
} else {
|
||||
link.remote.SendVNCImage(link.target, link.targetIdx, link.id,
|
||||
screen, block, network.VncImage_raw, next.(*image.RGBA).Pix)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+36
-27
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.1
|
||||
// protoc v3.12.4
|
||||
// protoc v3.16.0
|
||||
// source: connect.proto
|
||||
|
||||
package network
|
||||
@@ -187,7 +187,8 @@ type ConnectVnc struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Fps uint32 `protobuf:"varint,1,opt,name=fps,proto3" json:"fps,omitempty"`
|
||||
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 *ConnectVnc) Reset() {
|
||||
@@ -229,6 +230,13 @@ func (x *ConnectVnc) GetFps() uint32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ConnectVnc) GetQuality() uint32 {
|
||||
if x != nil {
|
||||
return x.Quality
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type ConnectRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -405,32 +413,33 @@ 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, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x6e, 0x65,
|
||||
0x28, 0x09, 0x52, 0x03, 0x65, 0x6e, 0x76, 0x22, 0x39, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x6e, 0x65,
|
||||
0x63, 0x74, 0x5f, 0x76, 0x6e, 0x63, 0x12, 0x10, 0x0a, 0x03, 0x66, 0x70, 0x73, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x0d, 0x52, 0x03, 0x66, 0x70, 0x73, 0x22, 0x9f, 0x02, 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, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
|
||||
0x74, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x52, 0x04,
|
||||
0x54, 0x79, 0x70, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x63, 0x61, 0x64, 0x64, 0x72, 0x18, 0x0a, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x48, 0x00, 0x52, 0x05, 0x63, 0x61,
|
||||
0x64, 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, 0x12, 0x2a, 0x0a, 0x04, 0x63, 0x76, 0x6e, 0x63, 0x18, 0x0c, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x76, 0x6e, 0x63, 0x48, 0x00, 0x52, 0x04, 0x63, 0x76, 0x6e,
|
||||
0x63, 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, 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,
|
||||
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, 0x9f, 0x02, 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, 0x2e, 0x6e, 0x65, 0x74, 0x77,
|
||||
0x6f, 0x72, 0x6b, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2d,
|
||||
0x0a, 0x05, 0x63, 0x61, 0x64, 0x64, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e,
|
||||
0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f,
|
||||
0x61, 0x64, 0x64, 0x72, 0x48, 0x00, 0x52, 0x05, 0x63, 0x61, 0x64, 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, 0x12,
|
||||
0x2a, 0x0a, 0x04, 0x63, 0x76, 0x6e, 0x63, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e,
|
||||
0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f,
|
||||
0x76, 0x6e, 0x63, 0x48, 0x00, 0x52, 0x04, 0x63, 0x76, 0x6e, 0x63, 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,
|
||||
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 (
|
||||
|
||||
@@ -14,7 +14,8 @@ message connect_shell {
|
||||
}
|
||||
|
||||
message connect_vnc {
|
||||
uint32 fps = 1;
|
||||
uint32 fps = 1;
|
||||
uint32 quality = 2; // image quality, percent
|
||||
}
|
||||
|
||||
message connect_request {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.1
|
||||
// protoc v3.12.4
|
||||
// protoc v3.16.0
|
||||
// source: forward.proto
|
||||
|
||||
package network
|
||||
|
||||
+54
-35
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.1
|
||||
// protoc v3.12.4
|
||||
// protoc v3.16.0
|
||||
// source: msg.proto
|
||||
|
||||
package network
|
||||
@@ -167,6 +167,7 @@ type Msg struct {
|
||||
// *Msg_Sresize
|
||||
// *Msg_Sdata
|
||||
// *Msg_Vctrl
|
||||
// *Msg_Vimg
|
||||
// *Msg_Vmouse
|
||||
// *Msg_Vkbd
|
||||
Payload isMsg_Payload `protobuf_oneof:"payload"`
|
||||
@@ -302,6 +303,13 @@ func (x *Msg) GetVctrl() *VncControl {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Msg) GetVimg() *VncImage {
|
||||
if x, ok := x.GetPayload().(*Msg_Vimg); ok {
|
||||
return x.Vimg
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Msg) GetVmouse() *VncMouse {
|
||||
if x, ok := x.GetPayload().(*Msg_Vmouse); ok {
|
||||
return x.Vmouse
|
||||
@@ -350,12 +358,16 @@ type Msg_Vctrl struct {
|
||||
Vctrl *VncControl `protobuf:"bytes,30,opt,name=vctrl,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Msg_Vimg struct {
|
||||
Vimg *VncImage `protobuf:"bytes,31,opt,name=vimg,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Msg_Vmouse struct {
|
||||
Vmouse *VncMouse `protobuf:"bytes,31,opt,name=vmouse,proto3,oneof"`
|
||||
Vmouse *VncMouse `protobuf:"bytes,32,opt,name=vmouse,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Msg_Vkbd struct {
|
||||
Vkbd *VncKeyboard `protobuf:"bytes,32,opt,name=vkbd,proto3,oneof"`
|
||||
Vkbd *VncKeyboard `protobuf:"bytes,33,opt,name=vkbd,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*Msg_Hsp) isMsg_Payload() {}
|
||||
@@ -372,6 +384,8 @@ func (*Msg_Sdata) isMsg_Payload() {}
|
||||
|
||||
func (*Msg_Vctrl) isMsg_Payload() {}
|
||||
|
||||
func (*Msg_Vimg) isMsg_Payload() {}
|
||||
|
||||
func (*Msg_Vmouse) isMsg_Payload() {}
|
||||
|
||||
func (*Msg_Vkbd) isMsg_Payload() {}
|
||||
@@ -386,7 +400,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, 0x98, 0x06, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x26, 0x0a, 0x05, 0x5f, 0x74, 0x79,
|
||||
0x63, 0x22, 0xc2, 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,
|
||||
@@ -416,28 +430,30 @@ var file_msg_proto_rawDesc = []byte{
|
||||
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,
|
||||
0x76, 0x63, 0x74, 0x72, 0x6c, 0x12, 0x28, 0x0a, 0x04, 0x76, 0x69, 0x6d, 0x67, 0x18, 0x1f, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x76, 0x6e,
|
||||
0x63, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x48, 0x00, 0x52, 0x04, 0x76, 0x69, 0x6d, 0x67, 0x12,
|
||||
0x2c, 0x0a, 0x06, 0x76, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x18, 0x20, 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, 0x21, 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,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -464,8 +480,9 @@ var file_msg_proto_goTypes = []interface{}{
|
||||
(*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
|
||||
(*VncImage)(nil), // 9: network.vnc_image
|
||||
(*VncMouse)(nil), // 10: network.vnc_mouse
|
||||
(*VncKeyboard)(nil), // 11: network.vnc_keyboard
|
||||
}
|
||||
var file_msg_proto_depIdxs = []int32{
|
||||
0, // 0: network.msg._type:type_name -> network.msg.type
|
||||
@@ -476,13 +493,14 @@ var file_msg_proto_depIdxs = []int32{
|
||||
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
|
||||
9, // 8: network.msg.vimg:type_name -> network.vnc_image
|
||||
10, // 9: network.msg.vmouse:type_name -> network.vnc_mouse
|
||||
11, // 10: network.msg.vkbd:type_name -> network.vnc_keyboard
|
||||
11, // [11:11] is the sub-list for method output_type
|
||||
11, // [11:11] is the sub-list for method input_type
|
||||
11, // [11:11] is the sub-list for extension type_name
|
||||
11, // [11:11] is the sub-list for extension extendee
|
||||
0, // [0:11] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_msg_proto_init() }
|
||||
@@ -528,6 +546,7 @@ func file_msg_proto_init() {
|
||||
(*Msg_Sresize)(nil),
|
||||
(*Msg_Sdata)(nil),
|
||||
(*Msg_Vctrl)(nil),
|
||||
(*Msg_Vimg)(nil),
|
||||
(*Msg_Vmouse)(nil),
|
||||
(*Msg_Vkbd)(nil),
|
||||
}
|
||||
|
||||
@@ -46,7 +46,8 @@ message msg {
|
||||
shell_data sdata = 21;
|
||||
// vnc
|
||||
vnc_control vctrl = 30;
|
||||
vnc_mouse vmouse = 31;
|
||||
vnc_keyboard vkbd = 32;
|
||||
vnc_image vimg = 31;
|
||||
vnc_mouse vmouse = 32;
|
||||
vnc_keyboard vkbd = 33;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.1
|
||||
// protoc v3.12.4
|
||||
// protoc v3.16.0
|
||||
// source: shell.proto
|
||||
|
||||
package network
|
||||
|
||||
+169
-54
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.1
|
||||
// protoc v3.12.4
|
||||
// protoc v3.16.0
|
||||
// source: vnc.proto
|
||||
|
||||
package network
|
||||
@@ -175,8 +175,7 @@ type VncControl struct {
|
||||
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
|
||||
Quality uint32 `protobuf:"varint,1,opt,name=quality,proto3" json:"quality,omitempty"` // image quality, percent
|
||||
}
|
||||
|
||||
func (x *VncControl) Reset() {
|
||||
@@ -211,13 +210,6 @@ 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
|
||||
@@ -230,8 +222,9 @@ type VncImage struct {
|
||||
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"`
|
||||
XInfo *VncImageInfo `protobuf:"bytes,1,opt,name=_info,json=Info,proto3" json:"_info,omitempty"`
|
||||
Encode VncImageEncoding `protobuf:"varint,2,opt,name=encode,proto3,enum=network.VncImageEncoding" json:"encode,omitempty"`
|
||||
Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func (x *VncImage) Reset() {
|
||||
@@ -266,6 +259,13 @@ func (*VncImage) Descriptor() ([]byte, []int) {
|
||||
return file_vnc_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *VncImage) GetXInfo() *VncImageInfo {
|
||||
if x != nil {
|
||||
return x.XInfo
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *VncImage) GetEncode() VncImageEncoding {
|
||||
if x != nil {
|
||||
return x.Encode
|
||||
@@ -407,43 +407,144 @@ func (x *VncKeyboard) GetKey() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
type VncImageInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ScreenWidth uint32 `protobuf:"varint,1,opt,name=screen_width,json=screenWidth,proto3" json:"screen_width,omitempty"`
|
||||
ScreenHeight uint32 `protobuf:"varint,2,opt,name=screen_height,json=screenHeight,proto3" json:"screen_height,omitempty"`
|
||||
RectX uint32 `protobuf:"varint,3,opt,name=rect_x,json=rectX,proto3" json:"rect_x,omitempty"`
|
||||
RectY uint32 `protobuf:"varint,4,opt,name=rect_y,json=rectY,proto3" json:"rect_y,omitempty"`
|
||||
RectWidth uint32 `protobuf:"varint,5,opt,name=rect_width,json=rectWidth,proto3" json:"rect_width,omitempty"`
|
||||
RectHeight uint32 `protobuf:"varint,6,opt,name=rect_height,json=rectHeight,proto3" json:"rect_height,omitempty"`
|
||||
}
|
||||
|
||||
func (x *VncImageInfo) Reset() {
|
||||
*x = VncImageInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_vnc_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *VncImageInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*VncImageInfo) ProtoMessage() {}
|
||||
|
||||
func (x *VncImageInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_vnc_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 VncImageInfo.ProtoReflect.Descriptor instead.
|
||||
func (*VncImageInfo) Descriptor() ([]byte, []int) {
|
||||
return file_vnc_proto_rawDescGZIP(), []int{1, 0}
|
||||
}
|
||||
|
||||
func (x *VncImageInfo) GetScreenWidth() uint32 {
|
||||
if x != nil {
|
||||
return x.ScreenWidth
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *VncImageInfo) GetScreenHeight() uint32 {
|
||||
if x != nil {
|
||||
return x.ScreenHeight
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *VncImageInfo) GetRectX() uint32 {
|
||||
if x != nil {
|
||||
return x.RectX
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *VncImageInfo) GetRectY() uint32 {
|
||||
if x != nil {
|
||||
return x.RectY
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *VncImageInfo) GetRectWidth() uint32 {
|
||||
if x != nil {
|
||||
return x.RectWidth
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *VncImageInfo) GetRectHeight() uint32 {
|
||||
if x != nil {
|
||||
return x.RectHeight
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
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,
|
||||
0x77, 0x6f, 0x72, 0x6b, 0x22, 0x27, 0x0a, 0x0b, 0x76, 0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6e, 0x74,
|
||||
0x72, 0x6f, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x22, 0xe9, 0x02,
|
||||
0x0a, 0x09, 0x76, 0x6e, 0x63, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x2c, 0x0a, 0x05, 0x5f,
|
||||
0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6e, 0x65, 0x74,
|
||||
0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x76, 0x6e, 0x63, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2e, 0x69,
|
||||
0x6e, 0x66, 0x6f, 0x52, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, 0x06, 0x65, 0x6e, 0x63,
|
||||
0x6f, 0x64, 0x65, 0x18, 0x02, 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, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61,
|
||||
0x74, 0x61, 0x1a, 0xbc, 0x01, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x21, 0x0a, 0x0c, 0x73,
|
||||
0x63, 0x72, 0x65, 0x65, 0x6e, 0x5f, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x0d, 0x52, 0x0b, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x57, 0x69, 0x64, 0x74, 0x68, 0x12, 0x23,
|
||||
0x0a, 0x0d, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x48, 0x65, 0x69,
|
||||
0x67, 0x68, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x78, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x0d, 0x52, 0x05, 0x72, 0x65, 0x63, 0x74, 0x58, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x65,
|
||||
0x63, 0x74, 0x5f, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x72, 0x65, 0x63, 0x74,
|
||||
0x59, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x77, 0x69, 0x64, 0x74, 0x68, 0x18,
|
||||
0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x63, 0x74, 0x57, 0x69, 0x64, 0x74, 0x68,
|
||||
0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18,
|
||||
0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x72, 0x65, 0x63, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68,
|
||||
0x74, 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, 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,
|
||||
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 (
|
||||
@@ -459,7 +560,7 @@ func file_vnc_proto_rawDescGZIP() []byte {
|
||||
}
|
||||
|
||||
var file_vnc_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
|
||||
var file_vnc_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_vnc_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||
var file_vnc_proto_goTypes = []interface{}{
|
||||
(VncStatus)(0), // 0: network.vnc_status
|
||||
(VncImageEncoding)(0), // 1: network.vnc_image.encoding
|
||||
@@ -468,17 +569,19 @@ var file_vnc_proto_goTypes = []interface{}{
|
||||
(*VncImage)(nil), // 4: network.vnc_image
|
||||
(*VncMouse)(nil), // 5: network.vnc_mouse
|
||||
(*VncKeyboard)(nil), // 6: network.vnc_keyboard
|
||||
(*VncImageInfo)(nil), // 7: network.vnc_image.info
|
||||
}
|
||||
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
|
||||
7, // 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
|
||||
}
|
||||
|
||||
func init() { file_vnc_proto_init() }
|
||||
@@ -535,6 +638,18 @@ func file_vnc_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_vnc_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*VncImageInfo); 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{
|
||||
@@ -542,7 +657,7 @@ func file_vnc_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_vnc_proto_rawDesc,
|
||||
NumEnums: 3,
|
||||
NumMessages: 4,
|
||||
NumMessages: 5,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
+12
-4
@@ -4,18 +4,26 @@ package network;
|
||||
option go_package="./;network";
|
||||
|
||||
message vnc_control {
|
||||
uint32 fps = 1;
|
||||
uint32 quality = 2; // image quality, percent
|
||||
uint32 quality = 1; // image quality, percent
|
||||
}
|
||||
|
||||
message vnc_image {
|
||||
message info {
|
||||
uint32 screen_width = 1;
|
||||
uint32 screen_height = 2;
|
||||
uint32 rect_x = 3;
|
||||
uint32 rect_y = 4;
|
||||
uint32 rect_width = 5;
|
||||
uint32 rect_height = 6;
|
||||
}
|
||||
enum encoding {
|
||||
raw = 0;
|
||||
jpeg = 1;
|
||||
png = 2;
|
||||
}
|
||||
encoding encode = 1;
|
||||
bytes data = 2;
|
||||
info _info = 1;
|
||||
encoding encode = 2;
|
||||
bytes data = 3;
|
||||
}
|
||||
|
||||
enum vnc_status {
|
||||
|
||||
Reference in New Issue
Block a user