diff --git a/encodings/enc-cursor-pseudo.go b/encodings/enc-cursor-pseudo.go index 74bed99..09a357f 100644 --- a/encodings/enc-cursor-pseudo.go +++ b/encodings/enc-cursor-pseudo.go @@ -4,6 +4,7 @@ import ( "io" "math" "vncproxy/common" + "vncproxy/logger" ) type EncCursorPseudo struct { @@ -21,6 +22,8 @@ func (pe *EncCursorPseudo) Read(pf *common.PixelFormat, rect *common.Rectangle, } bytesPixel := int(pf.BPP / 8) //calcTightBytePerPixel(pf) + logger.Infof("EncCursorPseudo bytesPerPixel= %d", bytesPixel) + r.ReadBytes(int(rect.Width*rect.Height) * bytesPixel) mask := ((rect.Width + 7) / 8) * rect.Height r.ReadBytes(int(math.Floor(float64(mask)))) diff --git a/proxy/proxy_test.go b/proxy/proxy_test.go index 070e1c8..66b3718 100644 --- a/proxy/proxy_test.go +++ b/proxy/proxy_test.go @@ -6,15 +6,15 @@ func TestProxy(t *testing.T) { //create default session if required proxy := &VncProxy{ - WsListeningUrl: "http://localhost:7777/", // empty = not listening on ws - RecordingDir: "/Users/amitbet/vncRec", // empty = no recording - TcpListeningUrl: ":5904", + WsListeningUrl: "http://localhost:8183/", // empty = not listening on ws + RecordingDir: "", //"/Users/amitbet/vncRec", // empty = no recording + TcpListeningUrl: ":5905", //recordingDir: "C:\\vncRec", // empty = no recording - ProxyVncPassword: "1234", //empty = no auth + ProxyVncPassword: "", //empty = no auth SingleSession: &VncSession{ - TargetHostname: "localhost", - TargetPort: "5903", - TargetPassword: "Ch_#!T@8", + TargetHostname: "192.168.1.101", + TargetPort: "5900", + TargetPassword: "ancient1", //"Ch_#!T@8", // ID: "dummySession", Status: SessionStatusInit, Type: SessionTypeRecordingProxy, diff --git a/server/server-conn.go b/server/server-conn.go index 7ef88f6..509a5f6 100644 --- a/server/server-conn.go +++ b/server/server-conn.go @@ -182,13 +182,59 @@ func (c *ServerConn) handle() error { switch parsedMsg.Type() { case common.SetPixelFormatMsgType: // update pixel format - logger.Debugf("ClientUpdater.Consume: updating pixel format") + logger.Debugf("IServerConn.Handle: updating pixel format") pixFmtMsg := parsedMsg.(*MsgSetPixelFormat) c.SetPixelFormat(&pixFmtMsg.PF) if pixFmtMsg.PF.TrueColor != 0 { c.SetColorMap(&common.ColorMap{}) } + + case common.FramebufferUpdateRequestMsgType: + //logger.Infof("IServerConn.Handle: msgBuff update request") + //updMsg := parsedMsg.(*MsgFramebufferUpdateRequest) + //updMsg.Inc = 1 + case common.SetEncodingsMsgType: + encMsg := parsedMsg.(*MsgSetEncodings) + // for i, enc := range encMsg.Encodings { + // if enc > common.EncJPEGQualityLevelPseudo1 && enc < common.EncJPEGQualityLevelPseudo10 { //common.EncCursorPseudo + // //encMsg.EncNum-- + // //encMsg.Encodings = append(encMsg.Encodings[:i], encMsg.Encodings[i+1:]...) + // encMsg.Encodings[i] = encMsg.Encodings[len(encMsg.Encodings)-1] + // encMsg.Encodings[len(encMsg.Encodings)-1] = common.EncJPEGQualityLevelPseudo9 + // break + // } + // // if enc == common.EncCompressionLevel3 { + // // encMsg.Encodings[i] = common.EncJPEGQualityLevelPseudo9 + // // } + // // if enc == common.EncJPEGQualityLevelPseudo7 { + // // encMsg.Encodings[i] = common.EncJPEGQualityLevelPseudo9 + // // } + // } + + encMsg.Encodings = []common.EncodingType{ + common.EncDesktopSizePseudo, + common.EncExtendedDesktopSizePseudo, + common.EncLastRectPseudo, + common.EncContinuousUpdatesPseudo, + common.EncCursorPseudo, + common.EncFencePseudo, + common.EncHextile, + common.EncCopyRect, + common.EncTight, + common.EncZRLE, + common.EncRRE, + common.EncRaw, + common.EncCompressionLevel2, + common.EncJPEGQualityLevelPseudo1, + common.EncQEMUExtendedKeyEventPseudo, + common.EncTightPng, + common.EncXvpPseudo, + } + encMsg.EncNum = uint16(len(encMsg.Encodings)) + + //bad: EncCopyRect EncTight EncTightPng EncHextile EncRRE EncRaw EncJPEGQualityLevelPseudo7 EncCompressionLevel3 EncDesktopSizePseudo EncLastRectPseudo EncCursorPseudo EncQEMUExtendedKeyEventPseudo EncExtendedDesktopSizePseudo EncXvpPseudo EncFencePseudo EncContinuousUpdatesPseudo } + //////// if err != nil {