mirror of
				https://github.com/amitbet/vncproxy.git
				synced 2025-10-31 09:08:53 +00:00 
			
		
		
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			master
			...
			test_novnc
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | f2e945c2d7 | 
| @@ -4,6 +4,7 @@ import ( | |||||||
| 	"io" | 	"io" | ||||||
| 	"math" | 	"math" | ||||||
| 	"vncproxy/common" | 	"vncproxy/common" | ||||||
|  | 	"vncproxy/logger" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type EncCursorPseudo struct { | type EncCursorPseudo struct { | ||||||
| @@ -21,6 +22,8 @@ func (pe *EncCursorPseudo) Read(pf *common.PixelFormat, rect *common.Rectangle, | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	bytesPixel := int(pf.BPP / 8) //calcTightBytePerPixel(pf) | 	bytesPixel := int(pf.BPP / 8) //calcTightBytePerPixel(pf) | ||||||
|  | 	logger.Infof("EncCursorPseudo bytesPerPixel= %d", bytesPixel) | ||||||
|  |  | ||||||
| 	r.ReadBytes(int(rect.Width*rect.Height) * bytesPixel) | 	r.ReadBytes(int(rect.Width*rect.Height) * bytesPixel) | ||||||
| 	mask := ((rect.Width + 7) / 8) * rect.Height | 	mask := ((rect.Width + 7) / 8) * rect.Height | ||||||
| 	r.ReadBytes(int(math.Floor(float64(mask)))) | 	r.ReadBytes(int(math.Floor(float64(mask)))) | ||||||
|   | |||||||
| @@ -6,15 +6,15 @@ func TestProxy(t *testing.T) { | |||||||
| 	//create default session if required | 	//create default session if required | ||||||
|  |  | ||||||
| 	proxy := &VncProxy{ | 	proxy := &VncProxy{ | ||||||
| 		WsListeningUrl:  "http://localhost:7777/", // empty = not listening on ws | 		WsListeningUrl:  "http://localhost:8183/", // empty = not listening on ws | ||||||
| 		RecordingDir:    "/Users/amitbet/vncRec",  // empty = no recording | 		RecordingDir:    "",                       //"/Users/amitbet/vncRec",  // empty = no recording | ||||||
| 		TcpListeningUrl: ":5904", | 		TcpListeningUrl: ":5905", | ||||||
| 		//recordingDir:          "C:\\vncRec", // empty = no recording | 		//recordingDir:          "C:\\vncRec", // empty = no recording | ||||||
| 		ProxyVncPassword: "1234", //empty = no auth | 		ProxyVncPassword: "", //empty = no auth | ||||||
| 		SingleSession: &VncSession{ | 		SingleSession: &VncSession{ | ||||||
| 			TargetHostname: "localhost", | 			TargetHostname: "192.168.1.101", | ||||||
| 			TargetPort:     "5903", | 			TargetPort:     "5900", | ||||||
| 			TargetPassword: "Ch_#!T@8", | 			TargetPassword: "ancient1", //"Ch_#!T@8", // | ||||||
| 			ID:             "dummySession", | 			ID:             "dummySession", | ||||||
| 			Status:         SessionStatusInit, | 			Status:         SessionStatusInit, | ||||||
| 			Type:           SessionTypeRecordingProxy, | 			Type:           SessionTypeRecordingProxy, | ||||||
|   | |||||||
| @@ -182,13 +182,59 @@ func (c *ServerConn) handle() error { | |||||||
| 			switch parsedMsg.Type() { | 			switch parsedMsg.Type() { | ||||||
| 			case common.SetPixelFormatMsgType: | 			case common.SetPixelFormatMsgType: | ||||||
| 				// update pixel format | 				// update pixel format | ||||||
| 				logger.Debugf("ClientUpdater.Consume: updating pixel format") | 				logger.Debugf("IServerConn.Handle: updating pixel format") | ||||||
| 				pixFmtMsg := parsedMsg.(*MsgSetPixelFormat) | 				pixFmtMsg := parsedMsg.(*MsgSetPixelFormat) | ||||||
| 				c.SetPixelFormat(&pixFmtMsg.PF) | 				c.SetPixelFormat(&pixFmtMsg.PF) | ||||||
| 				if pixFmtMsg.PF.TrueColor != 0 { | 				if pixFmtMsg.PF.TrueColor != 0 { | ||||||
| 					c.SetColorMap(&common.ColorMap{}) | 					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 { | 			if err != nil { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user