refactored encodings to directories.

This commit is contained in:
betzalel 2017-06-14 10:54:15 +03:00
parent 89ff8ac9e3
commit f28d0de0ad
26 changed files with 1200 additions and 966 deletions

View File

@ -3,23 +3,37 @@
<CLASSES>
<root url="file://$PROJECT_DIR$/../elastictrail" />
<root url="file://$PROJECT_DIR$/../gopkg.in" />
<root url="file://$PROJECT_DIR$/../srf.opb" />
<root url="file://$PROJECT_DIR$/../vncproxy1" />
<root url="file://$PROJECT_DIR$/../GoProjExample" />
<root url="file://$PROJECT_DIR$/../github.com" />
<root url="file://$PROJECT_DIR$/../golang.org" />
<root url="file://$PROJECT_DIR$/../srf.opb" />
<root url="file://$PROJECT_DIR$/../sourcegraph.com" />
<root url="file://$USER_HOME$/srf/experience.center.opb/src/github.com" />
<root url="file://$PROJECT_DIR$/../github.com" />
<root url="file://$USER_HOME$/srf/experience.center.opb/src/gopkg.in" />
<root url="file://$PROJECT_DIR$/../golang.org" />
<root url="file://$USER_HOME$/srf/experience.center.opb/src/golang.org" />
<root url="file://$USER_HOME$/srf/experience.center.opb/src/srf" />
<root url="file://$USER_HOME$/srf/experience.center.opb/src/version" />
<root url="file://$PROJECT_DIR$/../srf.storage" />
<root url="file://$USER_HOME$/srf/experience.center.opb/src/sourcegraph.com" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/../elastictrail" />
<root url="file://$PROJECT_DIR$/../gopkg.in" />
<root url="file://$PROJECT_DIR$/../srf.opb" />
<root url="file://$PROJECT_DIR$/../vncproxy1" />
<root url="file://$PROJECT_DIR$/../GoProjExample" />
<root url="file://$PROJECT_DIR$/../github.com" />
<root url="file://$PROJECT_DIR$/../golang.org" />
<root url="file://$PROJECT_DIR$/../srf.opb" />
<root url="file://$PROJECT_DIR$/../sourcegraph.com" />
<root url="file://$USER_HOME$/srf/experience.center.opb/src/github.com" />
<root url="file://$PROJECT_DIR$/../github.com" />
<root url="file://$USER_HOME$/srf/experience.center.opb/src/gopkg.in" />
<root url="file://$PROJECT_DIR$/../golang.org" />
<root url="file://$USER_HOME$/srf/experience.center.opb/src/golang.org" />
<root url="file://$USER_HOME$/srf/experience.center.opb/src/srf" />
<root url="file://$USER_HOME$/srf/experience.center.opb/src/version" />
<root url="file://$PROJECT_DIR$/../srf.storage" />
<root url="file://$USER_HOME$/srf/experience.center.opb/src/sourcegraph.com" />
</SOURCES>
<excluded>
<root url="file://$PROJECT_DIR$" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GOROOT" path="C:/Go" />
<component name="GOROOT" path="/usr/local/Cellar/go/1.8.3/libexec" />
</project>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -1,7 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="aeba8696-a0e4-4bdc-984c-b9ca26151c10" name="Default" comment="" />
<list default="true" id="aeba8696-a0e4-4bdc-984c-b9ca26151c10" name="Default" comment="">
<change type="DELETED" beforePath="$PROJECT_DIR$/vnc/client.go" afterPath="" />
<change type="MOVED" beforePath="$PROJECT_DIR$/vnc/enc-raw.go" afterPath="$PROJECT_DIR$/encodings/enc-raw.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/compiler.xml" afterPath="$PROJECT_DIR$/.idea/compiler.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/copyright/profiles_settings.xml" afterPath="$PROJECT_DIR$/.idea/copyright/profiles_settings.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/libraries/GOPATH__vncproxy_.xml" afterPath="$PROJECT_DIR$/.idea/libraries/GOPATH__vncproxy_.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/misc.xml" afterPath="$PROJECT_DIR$/.idea/misc.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/modules.xml" afterPath="$PROJECT_DIR$/.idea/modules.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/vcs.xml" afterPath="$PROJECT_DIR$/.idea/vcs.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/vncproxy.iml" afterPath="$PROJECT_DIR$/.idea/vncproxy.iml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.vscode/launch.json" afterPath="$PROJECT_DIR$/.vscode/launch.json" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.vscode/tasks.json" afterPath="$PROJECT_DIR$/.vscode/tasks.json" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/LICENSE" afterPath="$PROJECT_DIR$/LICENSE" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/README.md" afterPath="$PROJECT_DIR$/README.md" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/main.go" afterPath="$PROJECT_DIR$/main.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/vnc/Logger.go" afterPath="$PROJECT_DIR$/vnc/Logger.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/vnc/README.md" afterPath="$PROJECT_DIR$/vnc/README.md" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/vnc/client_auth.go" afterPath="$PROJECT_DIR$/vnc/client_auth.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/vnc/client_auth_test.go" afterPath="$PROJECT_DIR$/vnc/client_auth_test.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/vnc/client_test.go" afterPath="$PROJECT_DIR$/vnc/client_test.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/vnc/color.go" afterPath="$PROJECT_DIR$/vnc/color.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/vnc/enc-hextile.go" afterPath="$PROJECT_DIR$/vnc/enc-hextile.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/vnc/enc-rre.go" afterPath="$PROJECT_DIR$/vnc/enc-rre.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/vnc/enc-tight.go" afterPath="$PROJECT_DIR$/vnc/enc-tight.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/vnc/enc-zlib.go" afterPath="$PROJECT_DIR$/vnc/enc-zlib.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/vnc/enc-zrle.go" afterPath="$PROJECT_DIR$/vnc/enc-zrle.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/vnc/encoding.go" afterPath="$PROJECT_DIR$/vnc/encoding.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/vnc/pixel_format.go" afterPath="$PROJECT_DIR$/vnc/pixel_format.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/vnc/pointer.go" afterPath="$PROJECT_DIR$/vnc/pointer.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/vnc/recorder.go" afterPath="$PROJECT_DIR$/vnc/recorder.go" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/vnc/server_messages.go" afterPath="$PROJECT_DIR$/vnc/server_messages.go" />
</list>
<ignored path="vncproxy.iws" />
<ignored path=".idea/workspace.xml" />
<ignored path=".idea/dataSources.local.xml" />
@ -18,63 +50,46 @@
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="DatabaseView">
<option name="SHOW_INTERMEDIATE" value="true" />
<option name="GROUP_SCHEMA" value="true" />
<option name="GROUP_CONTENTS" value="false" />
<option name="SORT_POSITIONED" value="false" />
<option name="SHOW_TABLE_DETAILS" value="true" />
<option name="SHOW_EMPTY_GROUPS" value="false" />
<option name="AUTO_SCROLL_FROM_SOURCE" value="false" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FavoritesManager">
<favorites_list name="vncproxy" />
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="client.go" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/vnc/client.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="204">
<caret line="12" column="25" lean-forward="true" selection-start-line="12" selection-start-column="25" selection-end-line="12" selection-end-column="25" />
<folding>
<element signature="e#123#158#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="enc-raw.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/vnc/enc-raw.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="13" column="1" lean-forward="true" selection-start-line="13" selection-start-column="1" selection-end-line="13" selection-end-column="1" />
<folding>
<element signature="e#13#24#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="client-conn.go" pinned="false" current-in-tab="false">
<file leaf-file-name="client-conn.go" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/vnc/client-conn.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="357">
<caret line="28" column="48" lean-forward="false" selection-start-line="28" selection-start-column="48" selection-end-line="28" selection-end-column="48" />
<state relative-caret-position="15">
<caret line="357" column="33" lean-forward="false" selection-start-line="357" selection-start-column="28" selection-end-line="357" selection-end-column="33" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="main.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/main.go">
<file leaf-file-name="enc-rre.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/vnc/enc-rre.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="13" column="0" lean-forward="false" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
<folding>
<element signature="e#14#68#0" expanded="true" />
</folding>
<state relative-caret-position="312">
<caret line="31" column="0" lean-forward="false" selection-start-line="31" selection-start-column="0" selection-end-line="31" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="client_test.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/vnc/client_test.go">
<file leaf-file-name="readers.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/common/readers.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<state relative-caret-position="162">
<caret line="97" column="41" lean-forward="false" selection-start-line="97" selection-start-column="23" selection-end-line="97" selection-end-column="41" />
<folding />
</state>
</provider>
@ -90,11 +105,53 @@
</provider>
</entry>
</file>
<file leaf-file-name="client_auth.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/vnc/client_auth.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="enc-raw.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/encodings/enc-raw.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="167">
<caret line="18" column="24" lean-forward="false" selection-start-line="18" selection-start-column="24" selection-end-line="18" selection-end-column="24" />
<folding>
<element signature="e#19#77#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="client_test.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/vnc/client_test.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="enc-hextile.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/vnc/enc-hextile.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="765">
<caret line="45" column="55" lean-forward="false" selection-start-line="45" selection-start-column="55" selection-end-line="45" selection-end-column="55" />
<state relative-caret-position="402">
<caret line="45" column="41" lean-forward="true" selection-start-line="45" selection-start-column="41" selection-end-line="45" selection-end-column="41" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Logger.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/vnc/Logger.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
@ -103,18 +160,8 @@
<file leaf-file-name="enc-tight.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/vnc/enc-tight.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="385">
<caret line="104" column="63" lean-forward="false" selection-start-line="104" selection-start-column="63" selection-end-line="104" selection-end-column="63" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="server_messages.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/vnc/server_messages.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="439">
<caret line="86" column="0" lean-forward="false" selection-start-line="86" selection-start-column="0" selection-end-line="86" selection-end-column="0" />
<state relative-caret-position="60">
<caret line="8" column="0" lean-forward="false" selection-start-line="8" selection-start-column="0" selection-end-line="8" selection-end-column="31" />
<folding />
</state>
</provider>
@ -122,6 +169,19 @@
</file>
</leaf>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>Read</find>
<find>.Read</find>
<find>.read</find>
<find>server</find>
<find>uint8</find>
<find>TightMinToCompress</find>
</findStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="GradleLocalSettings">
<option name="externalProjectsViewState">
<projects_view />
@ -130,13 +190,17 @@
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/main.go" />
<option value="$PROJECT_DIR$/vnc/enc-tight.go" />
<option value="$PROJECT_DIR$/vnc/encoding/enc-raw.go" />
<option value="$PROJECT_DIR$/vnc/enc-raw.go" />
<option value="$PROJECT_DIR$/vnc/common/client.go" />
<option value="$PROJECT_DIR$/vnc/encoding/client.go" />
<option value="$PROJECT_DIR$/main.go" />
<option value="$PROJECT_DIR$/vnc/server_messages.go" />
<option value="$PROJECT_DIR$/vnc/client.go" />
<option value="$PROJECT_DIR$/vnc/enc-rre.go" />
<option value="$PROJECT_DIR$/encodings/enc-raw.go" />
<option value="$PROJECT_DIR$/common/readers.go" />
</list>
</option>
</component>
@ -147,11 +211,12 @@
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="-8" />
<option name="y" value="-8" />
<option name="width" value="1936" />
<option name="height" value="1176" />
<option name="x" value="256" />
<option name="y" value="201" />
<option name="width" value="1280" />
<option name="height" value="773" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectReloadState">
<option name="STATE" value="1" />
</component>
@ -163,13 +228,120 @@
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<autoscrollToSource ProjectPane="true" />
<autoscrollFromSource ProjectPane="true" />
<sortByType />
<manualOrder />
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scratches" />
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="vncproxy" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="External Libraries" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ExternalLibrariesNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="vncproxy" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="External Libraries" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ExternalLibrariesNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="Go SDK 1.8.3" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.SyntheticLibraryElementNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="vncproxy" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="External Libraries" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ExternalLibrariesNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="Go SDK 1.8.3" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.SyntheticLibraryElementNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="bytes" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="vncproxy" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="vncproxy" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="vncproxy" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="vncproxy" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="vnc" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="vncproxy" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="vncproxy" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="encodings" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="vncproxy" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="vncproxy" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="common" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="Scope">
<subPane subId="Problems">
<PATH>
@ -232,51 +404,24 @@
</PATH>
</subPane>
</pane>
<pane id="Scratches" />
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="vncproxy" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="vncproxy" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="vncproxy" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="vncproxy" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="vnc" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="aspect.path.notification.shown" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="settings.editor.selected.configurable" value="project.propCompiler" />
<property name="settings.editor.selected.configurable" value="reference.settingsdialog.IDE.editor.colors.General" />
<property name="go.libraries.notification.had.been.shown" value="true" />
<property name="recentsLimit" value="5" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/encodings" />
<recent name="$PROJECT_DIR$" />
<recent name="$PROJECT_DIR$/common" />
<recent name="C:\Users\betzalel\Dropbox\go\src\vncproxy\vnc" />
<recent name="C:\Users\betzalel\Dropbox\go\src\vncproxy\vnc\encoding" />
<recent name="C:\Users\betzalel\Dropbox\go\src\vncproxy\vnc\common" />
</key>
</component>
<component name="RunDashboard">
@ -534,7 +679,7 @@
<method />
</configuration>
<configuration default="true" type="GoRunFileConfiguration" factoryName="Go Single File">
<module name="" />
<module name="vncproxy" />
<working_directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" />
<method />
@ -735,9 +880,9 @@
</configuration>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="Go Single File.runVnc" />
<item index="1" class="java.lang.String" itemvalue="Go Application.Build main.go and run" />
<item index="2" class="java.lang.String" itemvalue="Go Application.Build main.go and run (1)" />
<item index="3" class="java.lang.String" itemvalue="Go Single File.Unnamed" />
<item index="1" class="java.lang.String" itemvalue="Go Single File.Unnamed" />
<item index="2" class="java.lang.String" itemvalue="Go Application.Build main.go and run" />
<item index="3" class="java.lang.String" itemvalue="Go Application.Build main.go and run (1)" />
</list>
<recent_temporary>
<list size="2">
@ -784,11 +929,16 @@
<workItem from="1497276427351" duration="817000" />
<workItem from="1497277513428" duration="371000" />
<workItem from="1497278098752" duration="3181000" />
<workItem from="1497313424857" duration="102000" />
<workItem from="1497313550726" duration="2070000" />
<workItem from="1497315693804" duration="252000" />
<workItem from="1497315971989" duration="1909000" />
<workItem from="1497322223215" duration="351000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="5305000" />
<option name="totallyTimeSpent" value="11052000" />
</component>
<component name="TodoView" selected-index="2">
<todo-panel id="selected-file">
@ -800,38 +950,38 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1176" extended-state="6" />
<editor active="true" />
<frame x="256" y="201" width="1280" height="773" extended-state="0" />
<layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32981783" sideWeight="0.4914712" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Nl-Palette" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.35474592" sideWeight="0.5170576" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32892805" sideWeight="0.50646204" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32885906" sideWeight="0.7036247" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Properties" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32981783" sideWeight="0.4936034" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.14658849" sideWeight="0.4947994" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.23990306" sideWeight="0.4947994" order="0" side_tool="false" content_ui="combo" />
<window_info id="Problems" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32892805" sideWeight="0.49353796" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.14658849" sideWeight="0.50520056" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.35474592" sideWeight="0.48294243" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.14658849" sideWeight="0.50520056" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
</layout>
</component>
@ -855,53 +1005,45 @@
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/main.go</url>
<line>11</line>
<properties />
<option name="timeStamp" value="5" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/vnc/enc-tight.go</url>
<line>76</line>
<properties />
<option name="timeStamp" value="6" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/vnc/enc-tight.go</url>
<line>98</line>
<properties />
<option name="timeStamp" value="7" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/vnc/enc-tight.go</url>
<line>103</line>
<properties />
<option name="timeStamp" value="8" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/vnc/enc-tight.go</url>
<line>155</line>
<properties />
<line>156</line>
<option name="timeStamp" value="9" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/vnc/enc-tight.go</url>
<line>172</line>
<properties />
<line>173</line>
<option name="timeStamp" value="10" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/vnc/enc-tight.go</url>
<line>177</line>
<properties />
<line>178</line>
<option name="timeStamp" value="11" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/vnc/server_messages.go</url>
<line>78</line>
<properties />
<option name="timeStamp" value="12" />
</line-breakpoint>
</breakpoints>
<option name="time" value="13" />
<option name="time" value="14" />
</breakpoint-manager>
<watches-manager />
</component>
@ -910,16 +1052,54 @@
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/vnc/client.go">
<entry file="file://$PROJECT_DIR$/main.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<state relative-caret-position="360">
<caret line="24" column="60" lean-forward="false" selection-start-line="24" selection-start-column="60" selection-end-line="24" selection-end-column="60" />
<folding>
<element signature="e#123#158#0" expanded="true" />
<element signature="e#14#68#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go" />
<entry file="file://$PROJECT_DIR$/vnc/client-conn.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go" />
<entry file="file://$PROJECT_DIR$/vnc/client-conn.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="476">
<caret line="28" column="48" lean-forward="false" selection-start-line="28" selection-start-column="48" selection-end-line="28" selection-end-column="48" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/enc-tight.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1003">
<caret line="59" column="23" lean-forward="false" selection-start-line="59" selection-start-column="23" selection-end-line="59" selection-end-column="23" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/main.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="289">
<caret line="17" column="5" lean-forward="false" selection-start-line="17" selection-start-column="5" selection-end-line="17" selection-end-column="5" />
<folding>
<element signature="e#14#68#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go" />
<entry file="file://$PROJECT_DIR$/vnc/client.go" />
<entry file="file://$PROJECT_DIR$/vnc/client-conn.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="476">
@ -933,7 +1113,7 @@
<state relative-caret-position="187">
<caret line="17" column="5" lean-forward="false" selection-start-line="17" selection-start-column="5" selection-end-line="17" selection-end-column="5" />
<folding>
<element signature="e#14#68#0" expanded="true" />
<element signature="e#14#68#0" expanded="false" />
</folding>
</state>
</provider>
@ -946,16 +1126,7 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#123#158#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go" />
<entry file="file://$PROJECT_DIR$/vnc/client-conn.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="476">
@ -969,7 +1140,7 @@
<state relative-caret-position="289">
<caret line="17" column="5" lean-forward="true" selection-start-line="17" selection-start-column="5" selection-end-line="17" selection-end-column="5" />
<folding>
<element signature="e#14#68#0" expanded="true" />
<element signature="e#14#68#0" expanded="false" />
</folding>
</state>
</provider>
@ -982,16 +1153,7 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="555">
<caret line="40" column="29" lean-forward="false" selection-start-line="40" selection-start-column="29" selection-end-line="40" selection-end-column="29" />
<folding>
<element signature="e#123#158#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go" />
<entry file="file://$PROJECT_DIR$/vnc/client-conn.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="315">
@ -1013,21 +1175,12 @@
<state relative-caret-position="360">
<caret line="24" column="60" lean-forward="false" selection-start-line="24" selection-start-column="60" selection-end-line="24" selection-end-column="60" />
<folding>
<element signature="e#14#68#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="40" column="29" lean-forward="false" selection-start-line="40" selection-start-column="29" selection-end-line="40" selection-end-column="29" />
<folding>
<element signature="e#123#158#0" expanded="true" />
<element signature="e#14#68#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go" />
<entry file="file://$PROJECT_DIR$/vnc/client-conn.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
@ -1036,16 +1189,7 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#123#158#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go" />
<entry file="file://$PROJECT_DIR$/vnc/client-conn.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="476">
@ -1067,31 +1211,13 @@
<state relative-caret-position="289">
<caret line="17" column="5" lean-forward="true" selection-start-line="17" selection-start-column="5" selection-end-line="17" selection-end-column="5" />
<folding>
<element signature="e#14#68#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="28" column="0" lean-forward="true" selection-start-line="28" selection-start-column="0" selection-end-line="28" selection-end-column="0" />
<folding>
<element signature="e#123#158#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="555">
<caret line="40" column="29" lean-forward="false" selection-start-line="40" selection-start-column="29" selection-end-line="40" selection-end-column="29" />
<folding>
<element signature="e#123#158#0" expanded="true" />
<element signature="e#14#68#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go" />
<entry file="file://$PROJECT_DIR$/vnc/client.go" />
<entry file="file://$PROJECT_DIR$/vnc/client-conn.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="315">
@ -1113,21 +1239,12 @@
<state relative-caret-position="360">
<caret line="24" column="60" lean-forward="false" selection-start-line="24" selection-start-column="60" selection-end-line="24" selection-end-column="60" />
<folding>
<element signature="e#14#68#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="40" column="29" lean-forward="false" selection-start-line="40" selection-start-column="29" selection-end-line="40" selection-end-column="29" />
<folding>
<element signature="e#123#158#0" expanded="true" />
<element signature="e#14#68#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go" />
<entry file="file://$PROJECT_DIR$/vnc/client-conn.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
@ -1136,42 +1253,92 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go">
<entry file="file://$PROJECT_DIR$/vnc/client.go" />
<entry file="file:///usr/local/Cellar/go/1.8/libexec/src/os/file_unix.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#123#158#0" expanded="true" />
</folding>
<state relative-caret-position="1785">
<caret line="122" column="0" lean-forward="false" selection-start-line="122" selection-start-column="0" selection-end-line="122" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="105">
<caret line="7" column="0" lean-forward="true" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/main.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="13" column="0" lean-forward="false" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
<state relative-caret-position="465">
<caret line="37" column="28" lean-forward="false" selection-start-line="37" selection-start-column="28" selection-end-line="37" selection-end-column="28" />
<folding>
<element signature="e#14#68#0" expanded="true" />
<element signature="e#14#68#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file:///usr/local/Cellar/go/1.8.3/libexec/src/io/io.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="161">
<caret line="76" column="5" lean-forward="false" selection-start-line="76" selection-start-column="5" selection-end-line="76" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/server_messages.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="439">
<caret line="86" column="0" lean-forward="false" selection-start-line="86" selection-start-column="0" selection-end-line="86" selection-end-column="0" />
<state relative-caret-position="420">
<caret line="33" column="45" lean-forward="false" selection-start-line="33" selection-start-column="45" selection-end-line="33" selection-end-column="45" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/enc-tight.go">
<entry file="file:///usr/local/Cellar/go/1.8.3/libexec/src/bytes/buffer.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="385">
<caret line="104" column="63" lean-forward="false" selection-start-line="104" selection-start-column="63" selection-end-line="104" selection-end-column="63" />
<state relative-caret-position="150">
<caret line="14" column="64" lean-forward="false" selection-start-line="14" selection-start-column="64" selection-end-line="14" selection-end-column="64" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go" />
<entry file="file://$PROJECT_DIR$/vnc/enc-rre.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="312">
<caret line="31" column="0" lean-forward="false" selection-start-line="31" selection-start-column="0" selection-end-line="31" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/Logger.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/enc-hextile.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="402">
<caret line="45" column="41" lean-forward="true" selection-start-line="45" selection-start-column="41" selection-end-line="45" selection-end-column="41" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/encodings/enc-raw.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="167">
<caret line="18" column="24" lean-forward="false" selection-start-line="18" selection-start-column="24" selection-end-line="18" selection-end-column="24" />
<folding>
<element signature="e#19#77#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client_test.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
@ -1188,42 +1355,38 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/enc-hextile.go">
<entry file="file://$PROJECT_DIR$/common/readers.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="765">
<caret line="45" column="55" lean-forward="false" selection-start-line="45" selection-start-column="55" selection-end-line="45" selection-end-column="55" />
<state relative-caret-position="162">
<caret line="97" column="41" lean-forward="false" selection-start-line="97" selection-start-column="23" selection-end-line="97" selection-end-column="41" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/enc-raw.go">
<entry file="file://$PROJECT_DIR$/vnc/enc-tight.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="13" column="1" lean-forward="true" selection-start-line="13" selection-start-column="1" selection-end-line="13" selection-end-column="1" />
<folding>
<element signature="e#13#24#0" expanded="true" />
</folding>
<state relative-caret-position="60">
<caret line="8" column="0" lean-forward="false" selection-start-line="8" selection-start-column="0" selection-end-line="8" selection-end-column="31" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client_auth.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client-conn.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="357">
<caret line="28" column="48" lean-forward="false" selection-start-line="28" selection-start-column="48" selection-end-line="28" selection-end-column="48" />
<state relative-caret-position="15">
<caret line="357" column="33" lean-forward="false" selection-start-line="357" selection-start-column="28" selection-end-line="357" selection-end-column="33" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/vnc/client.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="204">
<caret line="12" column="25" lean-forward="true" selection-start-line="12" selection-start-column="25" selection-end-line="12" selection-end-column="25" />
<folding>
<element signature="e#123#158#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>

View File

@ -1,4 +1,4 @@
package vnc
package common
type Logger interface {
Debug(v ...interface{})

28
common/encoding.go Normal file
View File

@ -0,0 +1,28 @@
package common
import (
"io"
)
// An Encoding implements a method for encoding pixel data that is
// sent by the server to the client.
type Encoding interface {
// The number that uniquely identifies this encoding type.
Type() int32
// Read reads the contents of the encoded pixel data from the reader.
// This should return a new Encoding implementation that contains
// the proper data.
Read(*PixelFormat, *Rectangle, io.Reader) (Encoding, error)
}
const (
EncodingRaw = 0
EncodingCopyRect = 1
EncodingRRE = 2
EncodingCoRRE = 4
EncodingHextile = 5
EncodingZlib = 6
EncodingTight = 7
EncodingZRLE = 16
)

111
common/readers.go Normal file
View File

@ -0,0 +1,111 @@
// Package vnc implements a VNC client.
//
// References:
// [PROTOCOL]: http://tools.ietf.org/html/rfc6143
package common
import (
"bytes"
"encoding/binary"
"fmt"
"io"
)
// type DataSource struct {
// conn io.Reader
// output io.Writer
// passThrough bool
// PixelFormat PixelFormat
// }Color
type RfbReader struct {
reader io.Reader
saveBytes bool
savedBuff bytes.Buffer
}
func (r *RfbReader) Read(p []byte) (n int, err error) {
readLen, err := r.reader.Read(p)
r.savedBuff.Write(p)
return readLen, err
}
func (r *RfbReader) SavedBuff() bytes.Buffer {
return r.savedBuff
}
type RfbReadHelper struct {
io.Reader
}
func (d *RfbReadHelper) ReadBytes(count int) ([]byte, error) {
buff := make([]byte, count)
_, err := io.ReadFull(d.Reader, buff)
if err != nil {
//if err := binary.Read(d.conn, binary.BigEndian, &buff); err != nil {
return nil, err
}
return buff, nil
}
func (d *RfbReadHelper) ReadUint8() (uint8, error) {
var myUint uint8
if err := binary.Read(d.Reader, binary.BigEndian, &myUint); err != nil {
return 0, err
}
//fmt.Printf("myUint=%d", myUint)
return myUint, nil
}
func (d *RfbReadHelper) ReadUint16() (uint16, error) {
var myUint uint16
if err := binary.Read(d.Reader, binary.BigEndian, &myUint); err != nil {
return 0, err
}
//fmt.Printf("myUint=%d", myUint)
return myUint, nil
}
func (d *RfbReadHelper) ReadUint32() (uint32, error) {
var myUint uint32
if err := binary.Read(d.Reader, binary.BigEndian, &myUint); err != nil {
return 0, err
}
//fmt.Printf("myUint=%d", myUint)
return myUint, nil
}
func (d *RfbReadHelper) ReadCompactLen() (int, error) {
var err error
part, err := d.ReadUint8()
//byteCount := 1
len := uint32(part & 0x7F)
if (part & 0x80) != 0 {
part, err = d.ReadUint8()
//byteCount++
len |= uint32(part&0x7F) << 7
if (part & 0x80) != 0 {
part, err = d.ReadUint8()
//byteCount++
len |= uint32(part&0xFF) << 14
}
}
// for i := 0; i < byteCount; i++{
// rec.writeByte(portion[i]);
// }
return int(len), err
}
var TightMinToCompress int = 12
func (r *RfbReadHelper) ReadTightData(dataSize int) ([]byte, error) {
if int(dataSize) < TightMinToCompress {
return r.ReadBytes(int(dataSize))
}
zlibDataLen, err := r.ReadCompactLen()
fmt.Printf("compactlen=%d\n", zlibDataLen)
if err != nil {
return nil, err
}
//byte[] zlibData = new byte[zlibDataLen];
//rfb.readFully(zlibData);
return r.ReadBytes(zlibDataLen)
}

View File

@ -1,26 +1,34 @@
package vnc
// Rectangle represents a rectangle of pixel data.
type Rectangle struct {
X uint16
Y uint16
Width uint16
Height uint16
Enc Encoding
}
// PixelFormat describes the way a pixel is formatted for a VNC connection.
//
// See RFC 6143 Section 7.4 for information on each of the fields.
type PixelFormat struct {
BPP uint8
Depth uint8
BigEndian bool
TrueColor bool
RedMax uint16
GreenMax uint16
BlueMax uint16
RedShift uint8
GreenShift uint8
BlueShift uint8
}
package common
import (
"fmt"
)
// Rectangle represents a rectangle of pixel data.
type Rectangle struct {
X uint16
Y uint16
Width uint16
Height uint16
Enc Encoding
}
func (r *Rectangle) String() string {
return fmt.Sprintf("(%d,%d) (width: %d, height: %d), Enc= %d", r.X, r.Y, r.Width, r.Height, r.Enc.Type())
}
// PixelFormat describes the way a pixel is formatted for a VNC connection.
//
// See RFC 6143 Section 7.4 for information on each of the fields.
type PixelFormat struct {
BPP uint8
Depth uint8
BigEndian bool
TrueColor bool
RedMax uint16
GreenMax uint16
BlueMax uint16
RedShift uint8
GreenShift uint8
BlueShift uint8
}

View File

@ -0,0 +1,26 @@
package encodings
import (
"io"
"vncproxy/common"
)
type CopyRectEncoding struct {
//Colors []Color
copyRectSrcX uint16
copyRectSrcY uint16
}
func (z *CopyRectEncoding) Type() int32 {
return 1
}
func (z *CopyRectEncoding) Read(pixelFmt *common.PixelFormat, rect *common.Rectangle, r io.Reader) (common.Encoding, error) {
conn := common.RfbReadHelper{r}
//conn := &DataSource{conn: conn.c, PixelFormat: conn.PixelFormat}
//bytesPerPixel := c.PixelFormat.BPP / 8
z.copyRectSrcX, _ = conn.ReadUint16()
z.copyRectSrcY, _ = conn.ReadUint16()
return z, nil
}
//////////

48
encodings/enc-corre.go Normal file
View File

@ -0,0 +1,48 @@
package encodings
import (
"io"
"vncproxy/common"
)
type CoRREEncoding struct {
//Colors []Color
}
func (z *CoRREEncoding) Type() int32 {
return 4
}
func (z *CoRREEncoding) Read(pixelFmt *common.PixelFormat, rect *common.Rectangle, r io.Reader) (common.Encoding, error) {
conn := common.RfbReadHelper{r}
bytesPerPixel := int(pixelFmt.BPP / 8)
numOfSubrectangles, _ := conn.ReadUint32()
//read whole rect background color
conn.ReadBytes(bytesPerPixel)
//read all individual rects (color=BPP + x=16b + y=16b + w=16b + h=16b)
_, err := conn.ReadBytes(int(numOfSubrectangles) * (bytesPerPixel + 4))
if err != nil {
return nil, err
}
return z, nil
//int nSubrects = rfb.readU32();
//byte[] bg_buf = new byte[bytesPerPixel];
//rfb.readFully(bytesPerPixel);
//Color pixel;
// if (bytesPixel == 1) {
// pixel = colors[bg_buf[0] & 0xFF];
// } else {
// pixel = new Color(bg_buf[2] & 0xFF, bg_buf[1] & 0xFF, bg_buf[0] & 0xFF);
// }
// memGraphics.setColor(pixel);
// memGraphics.fillRect(x, y, w, h);
// byte[] buf = new byte[nSubrects * (bytesPixel + 4)];
// rfb.readFully(buf);
}

View File

@ -1,81 +1,85 @@
package vnc
import "io"
const (
HextileRaw = 1
HextileBackgroundSpecified = 2
HextileForegroundSpecified = 4
HextileAnySubrects = 8
HextileSubrectsColoured = 16
)
type HextileEncoding struct {
Colors []Color
}
func (z *HextileEncoding) Type() int32 {
return 5
}
func (z *HextileEncoding) Read(conn *ClientConn, rect *Rectangle, r io.Reader) (Encoding, error) {
//conn := &DataSource{conn: conn.c, PixelFormat: conn.PixelFormat}
bytesPerPixel := int(conn.PixelFormat.BPP) / 8
//buf := make([]byte, bytesPerPixel)
for ty := rect.Y; ty < rect.Y+rect.Height; ty += 16 {
th := 16
if rect.Y+rect.Height-ty < 16 {
th = int(rect.Y) + int(rect.Height) - int(ty)
}
for tx := rect.X; tx < rect.X+rect.Width; tx += 16 {
tw := 16
if rect.X+rect.Width-tx < 16 {
tw = int(rect.X) + int(rect.Width) - int(tx)
}
//handle Hextile Subrect(tx, ty, tw, th):
subencoding, err := conn.readUint8()
//fmt.Printf("hextile reader tile: (%d,%d) subenc=%d\n", ty, tx, subencoding)
if err != nil {
//fmt.Printf("error in hextile reader: %v\n", err)
return nil, err
}
if (subencoding & HextileRaw) != 0 {
//ReadRawRect(c, rect, r)
conn.readBytes(tw * th * bytesPerPixel)
//fmt.Printf("hextile reader: HextileRaw\n")
continue
}
if (subencoding & HextileBackgroundSpecified) != 0 {
conn.readBytes(int(bytesPerPixel))
}
if (subencoding & HextileForegroundSpecified) != 0 {
conn.readBytes(int(bytesPerPixel))
}
if (subencoding & HextileAnySubrects) == 0 {
//fmt.Printf("hextile reader: no Subrects\n")
continue
}
//fmt.Printf("hextile reader: handling Subrects\n")
nSubrects, err := conn.readUint8()
if err != nil {
return nil, err
}
bufsize := int(nSubrects) * 2
if (subencoding & HextileSubrectsColoured) != 0 {
bufsize += int(nSubrects) * int(bytesPerPixel)
}
//byte[] buf = new byte[bufsize];
conn.readBytes(bufsize)
}
}
// len, _ := readUint32(c.c)
// _, err := readBytes(c.c, int(len))
// if err != nil {
// return nil, err
// }
return z, nil
}
package encodings
import (
"io"
"vncproxy/common"
)
const (
HextileRaw = 1
HextileBackgroundSpecified = 2
HextileForegroundSpecified = 4
HextileAnySubrects = 8
HextileSubrectsColoured = 16
)
type HextileEncoding struct {
//Colors []Color
}
func (z *HextileEncoding) Type() int32 {
return 5
}
func (z *HextileEncoding) Read(pixelFmt *common.PixelFormat, rect *common.Rectangle, r io.Reader) (common.Encoding, error) {
conn := common.RfbReadHelper{r}
//conn := &DataSource{conn: conn.c, PixelFormat: conn.PixelFormat}
bytesPerPixel := int(pixelFmt.BPP) / 8
//buf := make([]byte, bytesPerPixel)
for ty := rect.Y; ty < rect.Y+rect.Height; ty += 16 {
th := 16
if rect.Y+rect.Height-ty < 16 {
th = int(rect.Y) + int(rect.Height) - int(ty)
}
for tx := rect.X; tx < rect.X+rect.Width; tx += 16 {
tw := 16
if rect.X+rect.Width-tx < 16 {
tw = int(rect.X) + int(rect.Width) - int(tx)
}
//handle Hextile Subrect(tx, ty, tw, th):
subencoding, err := conn.ReadUint8()
//fmt.Printf("hextile reader tile: (%d,%d) subenc=%d\n", ty, tx, subencoding)
if err != nil {
//fmt.Printf("error in hextile reader: %v\n", err)
return nil, err
}
if (subencoding & HextileRaw) != 0 {
//ReadRawRect(c, rect, r)
conn.ReadBytes(tw * th * bytesPerPixel)
//fmt.Printf("hextile reader: HextileRaw\n")
continue
}
if (subencoding & HextileBackgroundSpecified) != 0 {
conn.ReadBytes(int(bytesPerPixel))
}
if (subencoding & HextileForegroundSpecified) != 0 {
conn.ReadBytes(int(bytesPerPixel))
}
if (subencoding & HextileAnySubrects) == 0 {
//fmt.Printf("hextile reader: no Subrects\n")
continue
}
//fmt.Printf("hextile reader: handling Subrects\n")
nSubrects, err := conn.ReadUint8()
if err != nil {
return nil, err
}
bufsize := int(nSubrects) * 2
if (subencoding & HextileSubrectsColoured) != 0 {
bufsize += int(nSubrects) * int(bytesPerPixel)
}
//byte[] buf = new byte[bufsize];
conn.ReadBytes(bufsize)
}
}
// len, _ := readUint32(c.c)
// _, err := readBytes(c.c, int(len))
// if err != nil {
// return nil, err
// }
return z, nil
}

View File

@ -1,24 +1,25 @@
package vnc
package encodings
import "io"
import (
"io"
"vncproxy/common"
)
// RawEncoding is raw pixel data sent by the server.
//
// See RFC 6143 Section 7.7.1
type RawEncoding struct {
Colors []Color
//Colors []Color
}
func (*RawEncoding) Type() int32 {
return 0
}
func (*RawEncoding) Read(conn *ClientConn, rect *Rectangle, r io.Reader) (Encoding, error) {
func (*RawEncoding) Read(pixelFmt *common.PixelFormat, rect *common.Rectangle, r io.Reader) (common.Encoding, error) {
//conn := &DataSource{conn: conn.c, PixelFormat: conn.PixelFormat}
bytesPerPixel := int(conn.PixelFormat.BPP / 8)
conn := common.RfbReadHelper{r}
bytesPerPixel := int(pixelFmt.BPP / 8)
//pixelBytes := make([]uint8, bytesPerPixel)
// var byteOrder binary.ByteOrder = binary.LittleEndian
@ -26,11 +27,11 @@ func (*RawEncoding) Read(conn *ClientConn, rect *Rectangle, r io.Reader) (Encodi
// byteOrder = binary.BigEndian
// }
colors := make([]Color, int(rect.Height)*int(rect.Width))
//colors := make([]vnc.Color, int(rect.Height)*int(rect.Width))
for y := uint16(0); y < rect.Height; y++ {
for x := uint16(0); x < rect.Width; x++ {
if _, err := conn.readBytes(bytesPerPixel); err != nil {
if _, err := conn.ReadBytes(bytesPerPixel); err != nil {
return nil, err
}
@ -54,5 +55,5 @@ func (*RawEncoding) Read(conn *ClientConn, rect *Rectangle, r io.Reader) (Encodi
}
}
return &RawEncoding{colors}, nil
return &RawEncoding{}, nil
}

28
encodings/enc-rre.go Normal file
View File

@ -0,0 +1,28 @@
package encodings
import "io"
import "vncproxy/common"
type RREEncoding struct {
//Colors []Color
}
func (z *RREEncoding) Type() int32 {
return 2
}
func (z *RREEncoding) Read(pixelFmt *common.PixelFormat, rect *common.Rectangle, r io.Reader) (common.Encoding, error) {
conn := common.RfbReadHelper{r}
bytesPerPixel := int(pixelFmt.BPP / 8)
numOfSubrectangles, _ := conn.ReadUint32()
//read whole rect background color
conn.ReadBytes(bytesPerPixel)
//read all individual rects (color=BPP + x=16b + y=16b + w=16b + h=16b)
_, err := conn.ReadBytes(int(numOfSubrectangles) * (bytesPerPixel + 8))
if err != nil {
return nil, err
}
return z, nil
}

View File

@ -1,346 +1,334 @@
package vnc
import (
"errors"
"fmt"
"io"
)
var TightMinToCompress int = 12
const (
TightExplicitFilter = 0x04
TightFill = 0x08
TightJpeg = 0x09
TightMaxSubencoding = 0x09
TightFilterCopy = 0x00
TightFilterPalette = 0x01
TightFilterGradient = 0x02
)
type TightEncoding struct {
output io.Writer
logger Logger
}
func (t *TightEncoding) SetOutput(output io.Writer) {
t.output = output
}
func (*TightEncoding) Type() int32 {
return 7
}
// func ReadAndRecBytes(conn io.Reader, rec io.Writer, count int) ([]byte, error) {
// buf, err := readBytes(conn, count)
// rec.Write(buf)
// return buf, err
// }
// func ReadAndRecUint8(conn io.Reader, rec io.Writer) (uint8, error) {
// myUint, err := readUint8(conn)
// buf := make([]byte, 1)
// buf[0] = byte(myUint) // cast int8 to byte
// rec.Write(buf)
// return myUint, err
// }
// func ReadAndRecUint16(conn io.Reader, rec io.Writer) (uint16, error) {
// myUint, err := readUint16(conn)
// buf := make([]byte, 2)
// //buf[0] = byte(myUint) // cast int8 to byte
// //var i int16 = 41
// //b := make([]byte, 2)
// binary.LittleEndian.PutUint16(buf, uint16(myUint))
// rec.Write(buf)
// return myUint, err
// }
func calcTightBytePerPixel(pf PixelFormat) int {
bytesPerPixel := int(pf.BPP / 8)
var bytesPerPixelTight int
if 24 == pf.Depth && 32 == pf.BPP {
bytesPerPixelTight = 3
} else {
bytesPerPixelTight = bytesPerPixel
}
return bytesPerPixelTight
}
func (t *TightEncoding) Read(conn *ClientConn, rect *Rectangle, reader io.Reader) (Encoding, error) {
bytesPixel := calcTightBytePerPixel(conn.PixelFormat)
//conn := &DataSource{conn: conn.c, PixelFormat: conn.PixelFormat}
//var subencoding uint8
subencoding, err := conn.readUint8()
if err != nil {
fmt.Printf("error in handling tight encoding: %v\n", err)
return nil, err
}
fmt.Printf("bytesPixel= %d, subencoding= %d\n", bytesPixel, subencoding)
// if err := binary.Read(conn.c, binary.BigEndian, &subencoding); err != nil {
// return t, err
// }
//move it to position (remove zlib flush commands)
compType := subencoding >> 4 & 0x0F
// for stream_id := 0; stream_id < 4; stream_id++ {
// // if ((comp_ctl & 1) != 0 && tightInflaters[stream_id] != null) {
// // tightInflaters[stream_id] = null;
// // }
// subencoding >>= 1
// }
fmt.Printf("afterSHL:%d\n", compType)
switch compType {
case TightFill:
fmt.Printf("reading fill size=%d\n", bytesPixel)
//read color
conn.readBytes(int(bytesPixel))
return t, nil
case TightJpeg:
if conn.PixelFormat.BPP == 8 {
return nil, errors.New("Tight encoding: JPEG is not supported in 8 bpp mode")
}
len, err := conn.readCompactLen()
if err != nil {
return nil, err
}
fmt.Printf("reading jpeg size=%d\n", len)
conn.readBytes(len)
return t, nil
default:
if compType > TightJpeg {
fmt.Println("Compression control byte is incorrect!")
}
handleTightFilters(subencoding, conn, rect, reader)
return t, nil
}
}
func handleTightFilters(subencoding uint8, conn *ClientConn, rect *Rectangle, reader io.Reader) {
var FILTER_ID_MASK uint8 = 0x40
//var STREAM_ID_MASK uint8 = 0x30
//decoderId := (subencoding & STREAM_ID_MASK) >> 4
var filterid uint8
var err error
if (subencoding & FILTER_ID_MASK) > 0 { // filter byte presence
filterid, err = conn.readUint8()
if err != nil {
fmt.Printf("error in handling tight encoding, reading filterid: %v\n", err)
return
}
fmt.Printf("read filter: %d\n", filterid)
}
//var numColors uint8
bytesPixel := calcTightBytePerPixel(conn.PixelFormat)
fmt.Printf("filter: %d\n", filterid)
// if rfb.rec != null {
// rfb.rec.writeByte(filter_id)
// }
lengthCurrentbpp := int(bytesPixel) * int(rect.Width) * int(rect.Height)
switch filterid {
case TightFilterPalette: //PALETTE_FILTER
colorCount, err := conn.readUint8()
paletteSize := colorCount + 1 // add one more
fmt.Printf("----PALETTE_FILTER: paletteSize=%d bytesPixel=%d\n", paletteSize, bytesPixel)
//complete palette
conn.readBytes(int(paletteSize) * bytesPixel)
var dataLength int
if paletteSize == 2 {
dataLength = int(rect.Height) * ((int(rect.Width) + 7) / 8)
} else {
dataLength = int(rect.Width * rect.Height)
}
_, err = readTightData(conn, dataLength)
if err != nil {
fmt.Printf("error in handling tight encoding, Reading Palette: %v\n", err)
return
}
case TightFilterGradient: //GRADIENT_FILTER
fmt.Printf("----GRADIENT_FILTER: bytesPixel=%d\n", bytesPixel)
//useGradient = true
fmt.Printf("usegrad: %d\n", filterid)
readTightData(conn, lengthCurrentbpp)
case TightFilterCopy: //BASIC_FILTER
fmt.Printf("----BASIC_FILTER: bytesPixel=%d\n", bytesPixel)
readTightData(conn, lengthCurrentbpp)
default:
fmt.Printf("Bad tight filter id: %d\n", filterid)
return
}
////////////
// if numColors == 0 && bytesPixel == 4 {
// rowSize1 *= 3
// }
// rowSize := (int(rect.Width)*bitsPixel + 7) / 8
// dataSize := int(rect.Height) * rowSize
// dataSize1 := rect.Height * rowSize1
// fmt.Printf("datasize: %d, origDatasize: %d", dataSize, dataSize1)
// // Read, optionally uncompress and decode data.
// if int(dataSize1) < TightMinToCompress {
// // Data size is small - not compressed with zlib.
// if numColors != 0 {
// // Indexed colors.
// //indexedData := make([]byte, dataSize)
// readBytes(conn.c, int(dataSize1))
// //readFully(indexedData);
// // if (rfb.rec != null) {
// // rfb.rec.write(indexedData);
// // }
// // if (numColors == 2) {
// // // Two colors.
// // if (bytesPixel == 1) {
// // decodeMonoData(x, y, w, h, indexedData, palette8);
// // } else {
// // decodeMonoData(x, y, w, h, indexedData, palette24);
// // }
// // } else {
// // // 3..255 colors (assuming bytesPixel == 4).
// // int i = 0;
// // for (int dy = y; dy < y + h; dy++) {
// // for (int dx = x; dx < x + w; dx++) {
// // pixels24[dy * rfb.framebufferWidth + dx] = palette24[indexedData[i++] & 0xFF];
// // }
// // }
// // }
// } else if useGradient {
// // "Gradient"-processed data
// //buf := make ( []byte,w * h * 3);
// dataByteCount := int(3) * int(rect.Width) * int(rect.Height)
// readBytes(conn.c, dataByteCount)
// // rfb.readFully(buf);
// // if (rfb.rec != null) {
// // rfb.rec.write(buf);
// // }
// // decodeGradientData(x, y, w, h, buf);
// } else {
// // Raw truecolor data.
// dataByteCount := int(bytesPixel) * int(rect.Width) * int(rect.Height)
// readBytes(conn.c, dataByteCount)
// // if (bytesPixel == 1) {
// // for (int dy = y; dy < y + h; dy++) {
// // rfb.readFully(pixels8, dy * rfb.framebufferWidth + x, w);
// // if (rfb.rec != null) {
// // rfb.rec.write(pixels8, dy * rfb.framebufferWidth + x, w);
// // }
// // }
// // } else {
// // byte[] buf = new byte[w * 3];
// // int i, offset;
// // for (int dy = y; dy < y + h; dy++) {
// // rfb.readFully(buf);
// // if (rfb.rec != null) {
// // rfb.rec.write(buf);
// // }
// // offset = dy * rfb.framebufferWidth + x;
// // for (i = 0; i < w; i++) {
// // pixels24[offset + i] = (buf[i * 3] & 0xFF) << 16 | (buf[i * 3 + 1] & 0xFF) << 8 | (buf[i * 3 + 2] & 0xFF);
// // }
// // }
// // }
// }
// } else {
// // Data was compressed with zlib.
// zlibDataLen, err := readCompactLen(conn.c)
// fmt.Printf("compactlen=%d\n", zlibDataLen)
// if err != nil {
// return nil, err
// }
// //byte[] zlibData = new byte[zlibDataLen];
// //rfb.readFully(zlibData);
// readBytes(conn.c, zlibDataLen)
// // if (rfb.rec != null) {
// // rfb.rec.write(zlibData);
// // }
// // int stream_id = comp_ctl & 0x03;
// // if (tightInflaters[stream_id] == null) {
// // tightInflaters[stream_id] = new Inflater();
// // }
// // Inflater myInflater = tightInflaters[stream_id];
// // myInflater.setInput(zlibData);
// // byte[] buf = new byte[dataSize];
// // myInflater.inflate(buf);
// // if (rfb.rec != null && !rfb.recordFromBeginning) {
// // rfb.recordCompressedData(buf);
// // }
// // if (numColors != 0) {
// // // Indexed colors.
// // if (numColors == 2) {
// // // Two colors.
// // if (bytesPixel == 1) {
// // decodeMonoData(x, y, w, h, buf, palette8);
// // } else {
// // decodeMonoData(x, y, w, h, buf, palette24);
// // }
// // } else {
// // // More than two colors (assuming bytesPixel == 4).
// // int i = 0;
// // for (int dy = y; dy < y + h; dy++) {
// // for (int dx = x; dx < x + w; dx++) {
// // pixels24[dy * rfb.framebufferWidth + dx] = palette24[buf[i++] & 0xFF];
// // }
// // }
// // }
// // } else if (useGradient) {
// // // Compressed "Gradient"-filtered data (assuming bytesPixel == 4).
// // decodeGradientData(x, y, w, h, buf);
// // } else {
// // // Compressed truecolor data.
// // if (bytesPixel == 1) {
// // int destOffset = y * rfb.framebufferWidth + x;
// // for (int dy = 0; dy < h; dy++) {
// // System.arraycopy(buf, dy * w, pixels8, destOffset, w);
// // destOffset += rfb.framebufferWidth;
// // }
// // } else {
// // int srcOffset = 0;
// // int destOffset, i;
// // for (int dy = 0; dy < h; dy++) {
// // myInflater.inflate(buf);
// // destOffset = (y + dy) * rfb.framebufferWidth + x;
// // for (i = 0; i < w; i++) {
// // pixels24[destOffset + i] = (buf[srcOffset] & 0xFF) << 16 | (buf[srcOffset + 1] & 0xFF) << 8
// // | (buf[srcOffset + 2] & 0xFF);
// // srcOffset += 3;
// // }
// // }
// // }
// // }
// }
return
}
func readTightData(conn *ClientConn, dataSize int) ([]byte, error) {
if int(dataSize) < TightMinToCompress {
return conn.readBytes(int(dataSize))
}
zlibDataLen, err := conn.readCompactLen()
fmt.Printf("compactlen=%d\n", zlibDataLen)
if err != nil {
return nil, err
}
//byte[] zlibData = new byte[zlibDataLen];
//rfb.readFully(zlibData);
return conn.readBytes(zlibDataLen)
}
package encodings
import (
"errors"
"fmt"
"io"
"vncproxy/common"
)
var TightMinToCompress int = 12
const (
TightExplicitFilter = 0x04
TightFill = 0x08
TightJpeg = 0x09
TightMaxSubencoding = 0x09
TightFilterCopy = 0x00
TightFilterPalette = 0x01
TightFilterGradient = 0x02
)
type TightEncoding struct {
output io.Writer
logger common.Logger
}
func (t *TightEncoding) SetOutput(output io.Writer) {
t.output = output
}
func (*TightEncoding) Type() int32 {
return 7
}
// func ReadAndRecBytes(conn io.Reader, rec io.Writer, count int) ([]byte, error) {
// buf, err := readBytes(conn, count)
// rec.Write(buf)
// return buf, err
// }
// func ReadAndRecUint8(conn io.Reader, rec io.Writer) (uint8, error) {
// myUint, err := readUint8(conn)
// buf := make([]byte, 1)
// buf[0] = byte(myUint) // cast int8 to byte
// rec.Write(buf)
// return myUint, err
// }
// func ReadAndRecUint16(conn io.Reader, rec io.Writer) (uint16, error) {
// myUint, err := readUint16(conn)
// buf := make([]byte, 2)
// //buf[0] = byte(myUint) // cast int8 to byte
// //var i int16 = 41
// //b := make([]byte, 2)
// binary.LittleEndian.PutUint16(buf, uint16(myUint))
// rec.Write(buf)
// return myUint, err
// }
func calcTightBytePerPixel(pf *common.PixelFormat) int {
bytesPerPixel := int(pf.BPP / 8)
var bytesPerPixelTight int
if 24 == pf.Depth && 32 == pf.BPP {
bytesPerPixelTight = 3
} else {
bytesPerPixelTight = bytesPerPixel
}
return bytesPerPixelTight
}
func (t *TightEncoding) Read(pixelFmt *common.PixelFormat, rect *common.Rectangle, reader io.Reader) (common.Encoding, error) {
bytesPixel := calcTightBytePerPixel(pixelFmt)
conn := common.RfbReadHelper{reader}
//conn := &DataSource{conn: conn.c, PixelFormat: conn.PixelFormat}
//var subencoding uint8
subencoding, err := conn.ReadUint8()
if err != nil {
fmt.Printf("error in handling tight encoding: %v\n", err)
return nil, err
}
fmt.Printf("bytesPixel= %d, subencoding= %d\n", bytesPixel, subencoding)
// if err := binary.Read(conn.c, binary.BigEndian, &subencoding); err != nil {
// return t, err
// }
//move it to position (remove zlib flush commands)
compType := subencoding >> 4 & 0x0F
// for stream_id := 0; stream_id < 4; stream_id++ {
// // if ((comp_ctl & 1) != 0 && tightInflaters[stream_id] != null) {
// // tightInflaters[stream_id] = null;
// // }
// subencoding >>= 1
// }
fmt.Printf("afterSHL:%d\n", compType)
switch compType {
case TightFill:
fmt.Printf("reading fill size=%d\n", bytesPixel)
//read color
conn.ReadBytes(int(bytesPixel))
return t, nil
case TightJpeg:
if pixelFmt.BPP == 8 {
return nil, errors.New("Tight encoding: JPEG is not supported in 8 bpp mode")
}
len, err := conn.ReadCompactLen()
if err != nil {
return nil, err
}
fmt.Printf("reading jpeg size=%d\n", len)
conn.ReadBytes(len)
return t, nil
default:
if compType > TightJpeg {
fmt.Println("Compression control byte is incorrect!")
}
handleTightFilters(subencoding, pixelFmt, rect, reader)
return t, nil
}
}
func handleTightFilters(subencoding uint8, pixelFmt *common.PixelFormat, rect *common.Rectangle, reader io.Reader) {
conn := common.RfbReadHelper{reader}
var FILTER_ID_MASK uint8 = 0x40
//var STREAM_ID_MASK uint8 = 0x30
//decoderId := (subencoding & STREAM_ID_MASK) >> 4
var filterid uint8
var err error
if (subencoding & FILTER_ID_MASK) > 0 { // filter byte presence
filterid, err = conn.ReadUint8()
if err != nil {
fmt.Printf("error in handling tight encoding, reading filterid: %v\n", err)
return
}
fmt.Printf("read filter: %d\n", filterid)
}
//var numColors uint8
bytesPixel := calcTightBytePerPixel(pixelFmt)
fmt.Printf("filter: %d\n", filterid)
// if rfb.rec != null {
// rfb.rec.writeByte(filter_id)
// }
lengthCurrentbpp := int(bytesPixel) * int(rect.Width) * int(rect.Height)
switch filterid {
case TightFilterPalette: //PALETTE_FILTER
colorCount, err := conn.ReadUint8()
paletteSize := colorCount + 1 // add one more
fmt.Printf("----PALETTE_FILTER: paletteSize=%d bytesPixel=%d\n", paletteSize, bytesPixel)
//complete palette
conn.ReadBytes(int(paletteSize) * bytesPixel)
var dataLength int
if paletteSize == 2 {
dataLength = int(rect.Height) * ((int(rect.Width) + 7) / 8)
} else {
dataLength = int(rect.Width * rect.Height)
}
_, err = conn.ReadTightData(dataLength)
if err != nil {
fmt.Printf("error in handling tight encoding, Reading Palette: %v\n", err)
return
}
case TightFilterGradient: //GRADIENT_FILTER
fmt.Printf("----GRADIENT_FILTER: bytesPixel=%d\n", bytesPixel)
//useGradient = true
fmt.Printf("usegrad: %d\n", filterid)
conn.ReadTightData(lengthCurrentbpp)
case TightFilterCopy: //BASIC_FILTER
fmt.Printf("----BASIC_FILTER: bytesPixel=%d\n", bytesPixel)
conn.ReadTightData(lengthCurrentbpp)
default:
fmt.Printf("Bad tight filter id: %d\n", filterid)
return
}
////////////
// if numColors == 0 && bytesPixel == 4 {
// rowSize1 *= 3
// }
// rowSize := (int(rect.Width)*bitsPixel + 7) / 8
// dataSize := int(rect.Height) * rowSize
// dataSize1 := rect.Height * rowSize1
// fmt.Printf("datasize: %d, origDatasize: %d", dataSize, dataSize1)
// // Read, optionally uncompress and decode data.
// if int(dataSize1) < TightMinToCompress {
// // Data size is small - not compressed with zlib.
// if numColors != 0 {
// // Indexed colors.
// //indexedData := make([]byte, dataSize)
// readBytes(conn.c, int(dataSize1))
// //readFully(indexedData);
// // if (rfb.rec != null) {
// // rfb.rec.write(indexedData);
// // }
// // if (numColors == 2) {
// // // Two colors.
// // if (bytesPixel == 1) {
// // decodeMonoData(x, y, w, h, indexedData, palette8);
// // } else {
// // decodeMonoData(x, y, w, h, indexedData, palette24);
// // }
// // } else {
// // // 3..255 colors (assuming bytesPixel == 4).
// // int i = 0;
// // for (int dy = y; dy < y + h; dy++) {
// // for (int dx = x; dx < x + w; dx++) {
// // pixels24[dy * rfb.framebufferWidth + dx] = palette24[indexedData[i++] & 0xFF];
// // }
// // }
// // }
// } else if useGradient {
// // "Gradient"-processed data
// //buf := make ( []byte,w * h * 3);
// dataByteCount := int(3) * int(rect.Width) * int(rect.Height)
// readBytes(conn.c, dataByteCount)
// // rfb.readFully(buf);
// // if (rfb.rec != null) {
// // rfb.rec.write(buf);
// // }
// // decodeGradientData(x, y, w, h, buf);
// } else {
// // Raw truecolor data.
// dataByteCount := int(bytesPixel) * int(rect.Width) * int(rect.Height)
// readBytes(conn.c, dataByteCount)
// // if (bytesPixel == 1) {
// // for (int dy = y; dy < y + h; dy++) {
// // rfb.readFully(pixels8, dy * rfb.framebufferWidth + x, w);
// // if (rfb.rec != null) {
// // rfb.rec.write(pixels8, dy * rfb.framebufferWidth + x, w);
// // }
// // }
// // } else {
// // byte[] buf = new byte[w * 3];
// // int i, offset;
// // for (int dy = y; dy < y + h; dy++) {
// // rfb.readFully(buf);
// // if (rfb.rec != null) {
// // rfb.rec.write(buf);
// // }
// // offset = dy * rfb.framebufferWidth + x;
// // for (i = 0; i < w; i++) {
// // pixels24[offset + i] = (buf[i * 3] & 0xFF) << 16 | (buf[i * 3 + 1] & 0xFF) << 8 | (buf[i * 3 + 2] & 0xFF);
// // }
// // }
// // }
// }
// } else {
// // Data was compressed with zlib.
// zlibDataLen, err := readCompactLen(conn.c)
// fmt.Printf("compactlen=%d\n", zlibDataLen)
// if err != nil {
// return nil, err
// }
// //byte[] zlibData = new byte[zlibDataLen];
// //rfb.readFully(zlibData);
// readBytes(conn.c, zlibDataLen)
// // if (rfb.rec != null) {
// // rfb.rec.write(zlibData);
// // }
// // int stream_id = comp_ctl & 0x03;
// // if (tightInflaters[stream_id] == null) {
// // tightInflaters[stream_id] = new Inflater();
// // }
// // Inflater myInflater = tightInflaters[stream_id];
// // myInflater.setInput(zlibData);
// // byte[] buf = new byte[dataSize];
// // myInflater.inflate(buf);
// // if (rfb.rec != null && !rfb.recordFromBeginning) {
// // rfb.recordCompressedData(buf);
// // }
// // if (numColors != 0) {
// // // Indexed colors.
// // if (numColors == 2) {
// // // Two colors.
// // if (bytesPixel == 1) {
// // decodeMonoData(x, y, w, h, buf, palette8);
// // } else {
// // decodeMonoData(x, y, w, h, buf, palette24);
// // }
// // } else {
// // // More than two colors (assuming bytesPixel == 4).
// // int i = 0;
// // for (int dy = y; dy < y + h; dy++) {
// // for (int dx = x; dx < x + w; dx++) {
// // pixels24[dy * rfb.framebufferWidth + dx] = palette24[buf[i++] & 0xFF];
// // }
// // }
// // }
// // } else if (useGradient) {
// // // Compressed "Gradient"-filtered data (assuming bytesPixel == 4).
// // decodeGradientData(x, y, w, h, buf);
// // } else {
// // // Compressed truecolor data.
// // if (bytesPixel == 1) {
// // int destOffset = y * rfb.framebufferWidth + x;
// // for (int dy = 0; dy < h; dy++) {
// // System.arraycopy(buf, dy * w, pixels8, destOffset, w);
// // destOffset += rfb.framebufferWidth;
// // }
// // } else {
// // int srcOffset = 0;
// // int destOffset, i;
// // for (int dy = 0; dy < h; dy++) {
// // myInflater.inflate(buf);
// // destOffset = (y + dy) * rfb.framebufferWidth + x;
// // for (i = 0; i < w; i++) {
// // pixels24[destOffset + i] = (buf[srcOffset] & 0xFF) << 16 | (buf[srcOffset + 1] & 0xFF) << 8
// // | (buf[srcOffset + 2] & 0xFF);
// // srcOffset += 3;
// // }
// // }
// // }
// // }
// }
return
}

24
encodings/enc-zlib.go Normal file
View File

@ -0,0 +1,24 @@
package encodings
import "io"
import "vncproxy/common"
type ZLibEncoding struct {
//Colors []Color
}
func (z *ZLibEncoding) Type() int32 {
return 6
}
func (z *ZLibEncoding) Read(pixelFmt *common.PixelFormat, rect *common.Rectangle, r io.Reader) (common.Encoding, error) {
conn := common.RfbReadHelper{r}
//conn := &DataSource{conn: conn.c, PixelFormat: conn.PixelFormat}
//bytesPerPixel := c.PixelFormat.BPP / 8
len, _ := conn.ReadUint32()
_, err := conn.ReadBytes(int(len))
if err != nil {
return nil, err
}
return z, nil
}

24
encodings/enc-zrle.go Normal file
View File

@ -0,0 +1,24 @@
package encodings
import "io"
import "vncproxy/common"
type ZRLEEncoding struct {
//Colors []Color
}
func (z *ZRLEEncoding) Type() int32 {
return 16
}
func (z *ZRLEEncoding) Read(pixelFmt *common.PixelFormat, rect *common.Rectangle, r io.Reader) (common.Encoding, error) {
conn := common.RfbReadHelper{r}
//conn := &DataSource{conn: conn.c, PixelFormat: conn.PixelFormat}
//bytesPerPixel := c.PixelFormat.BPP / 8
len, _ := conn.ReadUint32()
_, err := conn.ReadBytes(int(len))
if err != nil {
return nil, err
}
return z, nil
}

19
main.go
View File

@ -5,11 +5,13 @@ import (
"net"
"os"
"time"
"vncproxy/common"
"vncproxy/encodings"
"vncproxy/vnc"
)
func main() {
fmt.Println("")
//fmt.Println("")
//nc, err := net.Dial("tcp", "192.168.1.101:5903")
nc, err := net.Dial("tcp", "localhost:5903")
@ -29,17 +31,18 @@ func main() {
// fmt.Printf("error requesting fb update: %s\n", err)
// }
tight := vnc.TightEncoding{}
//rre := vnc.RREEncoding{}
//zlib := vnc.ZLibEncoding{}
//zrle := vnc.ZRLEEncoding{}
cpyRect := vnc.CopyRectEncoding{}
//hextile := vnc.HextileEncoding{}
tight := encodings.TightEncoding{}
//rre := encodings.RREEncoding{}
//zlib := encodings.ZLibEncoding{}
//zrle := encodings.ZRLEEncoding{}
cpyRect := encodings.CopyRectEncoding{}
//coRRE := encodings.CoRREEncoding{}
//hextile := encodings.HextileEncoding{}
file, _ := os.OpenFile("stam.bin", os.O_CREATE|os.O_RDWR, 0755)
defer file.Close()
tight.SetOutput(file)
clientConn.SetEncodings([]vnc.Encoding{&cpyRect, &tight})
clientConn.SetEncodings([]common.Encoding{&cpyRect, &tight})
go func() {
for {

View File

@ -7,6 +7,7 @@ import (
"io"
"net"
"unicode"
"vncproxy/common"
)
// A ServerMessage implements a message sent from the server to the client.
@ -32,9 +33,7 @@ type ClientAuth interface {
}
type ClientConn struct {
conn net.Conn
output io.Writer
passThrough bool
conn net.Conn
//c net.Conn
config *ClientConfig
@ -46,7 +45,7 @@ type ClientConn struct {
// Encodings supported by the client. This should not be modified
// directly. Instead, SetEncodings should be used.
Encs []Encoding
Encs []common.Encoding
// Width of the frame buffer in pixels, sent from the server.
FrameBufferWidth uint16
@ -60,7 +59,7 @@ type ClientConn struct {
// The pixel format associated with the connection. This shouldn't
// be modified. If you wish to set a new pixel format, use the
// SetPixelFormat method.
PixelFormat PixelFormat
PixelFormat common.PixelFormat
}
// A ClientConfig structure is used to configure a ClientConn. After
@ -246,7 +245,7 @@ func (c *ClientConn) PointerEvent(mask ButtonMask, x, y uint16) error {
// given should not be modified.
//
// See RFC 6143 Section 7.5.2
func (c *ClientConn) SetEncodings(encs []Encoding) error {
func (c *ClientConn) SetEncodings(encs []common.Encoding) error {
data := make([]interface{}, 3+len(encs))
data[0] = uint8(2)
data[1] = uint8(0)
@ -277,7 +276,7 @@ func (c *ClientConn) SetEncodings(encs []Encoding) error {
// in FramebufferUpdate messages from the server.
//
// See RFC 6143 Section 7.5.1
func (c *ClientConn) SetPixelFormat(format *PixelFormat) error {
func (c *ClientConn) SetPixelFormat(format *common.PixelFormat) error {
var keyEvent [20]byte
keyEvent[0] = 0

View File

@ -1,75 +0,0 @@
// Package vnc implements a VNC client.
//
// References:
// [PROTOCOL]: http://tools.ietf.org/html/rfc6143
package vnc
import (
"encoding/binary"
"io"
)
// type DataSource struct {
// conn io.Reader
// output io.Writer
// passThrough bool
// PixelFormat PixelFormat
// }Color
func (d *ClientConn) readBytes(count int) ([]byte, error) {
buff := make([]byte, count)
_, err := io.ReadFull(d.conn, buff)
if err != nil {
//if err := binary.Read(d.conn, binary.BigEndian, &buff); err != nil {
return nil, err
}
return buff, nil
}
func (d *ClientConn) readUint8() (uint8, error) {
var myUint uint8
if err := binary.Read(d.conn, binary.BigEndian, &myUint); err != nil {
return 0, err
}
//fmt.Printf("myUint=%d", myUint)
return myUint, nil
}
func (d *ClientConn) readUint16() (uint16, error) {
var myUint uint16
if err := binary.Read(d.conn, binary.BigEndian, &myUint); err != nil {
return 0, err
}
//fmt.Printf("myUint=%d", myUint)
return myUint, nil
}
func (d *ClientConn) readUint32() (uint32, error) {
var myUint uint32
if err := binary.Read(d.conn, binary.BigEndian, &myUint); err != nil {
return 0, err
}
//fmt.Printf("myUint=%d", myUint)
return myUint, nil
}
func (d *ClientConn) readCompactLen() (int, error) {
var err error
part, err := d.readUint8()
//byteCount := 1
len := uint32(part & 0x7F)
if (part & 0x80) != 0 {
part, err = d.readUint8()
//byteCount++
len |= uint32(part&0x7F) << 7
if (part & 0x80) != 0 {
part, err = d.readUint8()
//byteCount++
len |= uint32(part&0xFF) << 14
}
}
// for i := 0; i < byteCount; i++{
// rec.writeByte(portion[i]);
// }
return int(len), err
}

View File

@ -1,69 +0,0 @@
package vnc
import "io"
type RREEncoding struct {
Colors []Color
}
func (z *RREEncoding) Type() int32 {
return 2
}
func (z *RREEncoding) Read(conn *ClientConn, rect *Rectangle, r io.Reader) (Encoding, error) {
bytesPerPixel := int(conn.PixelFormat.BPP / 8)
numOfSubrectangles, _ := conn.readUint32()
//read whole rect background color
conn.readBytes(bytesPerPixel)
//read all individual rects (color=BPP + x=16b + y=16b + w=16b + h=16b)
_, err := conn.readBytes(int(numOfSubrectangles) * (bytesPerPixel + 8))
if err != nil {
return nil, err
}
return z, nil
}
type CoRREEncoding struct {
Colors []Color
}
func (z *CoRREEncoding) Type() int32 {
return 4
}
func (z *CoRREEncoding) Read(conn *ClientConn, rect *Rectangle, r io.Reader) (Encoding, error) {
bytesPerPixel := int(conn.PixelFormat.BPP / 8)
numOfSubrectangles, _ := conn.readUint32()
//read whole rect background color
conn.readBytes(bytesPerPixel)
//read all individual rects (color=BPP + x=16b + y=16b + w=16b + h=16b)
_, err := conn.readBytes(int(numOfSubrectangles) * (bytesPerPixel + 4))
if err != nil {
return nil, err
}
return z, nil
//int nSubrects = rfb.readU32();
//byte[] bg_buf = new byte[bytesPerPixel];
//rfb.readFully(bytesPerPixel);
//Color pixel;
// if (bytesPixel == 1) {
// pixel = colors[bg_buf[0] & 0xFF];
// } else {
// pixel = new Color(bg_buf[2] & 0xFF, bg_buf[1] & 0xFF, bg_buf[0] & 0xFF);
// }
// memGraphics.setColor(pixel);
// memGraphics.fillRect(x, y, w, h);
// byte[] buf = new byte[nSubrects * (bytesPixel + 4)];
// rfb.readFully(buf);
}

View File

@ -1,22 +0,0 @@
package vnc
import "io"
type ZLibEncoding struct {
Colors []Color
}
func (z *ZLibEncoding) Type() int32 {
return 6
}
func (z *ZLibEncoding) Read(conn *ClientConn, rect *Rectangle, r io.Reader) (Encoding, error) {
//conn := &DataSource{conn: conn.c, PixelFormat: conn.PixelFormat}
//bytesPerPixel := c.PixelFormat.BPP / 8
len, _ := conn.readUint32()
_, err := conn.readBytes(int(len))
if err != nil {
return nil, err
}
return z, nil
}

View File

@ -1,22 +0,0 @@
package vnc
import "io"
type ZRLEEncoding struct {
Colors []Color
}
func (z *ZRLEEncoding) Type() int32 {
return 16
}
func (z *ZRLEEncoding) Read(conn *ClientConn, rect *Rectangle, r io.Reader) (Encoding, error) {
//conn := &DataSource{conn: conn.c, PixelFormat: conn.PixelFormat}
//bytesPerPixel := c.PixelFormat.BPP / 8
len, _ := conn.readUint32()
_, err := conn.readBytes(int(len))
if err != nil {
return nil, err
}
return z, nil
}

View File

@ -1,45 +0,0 @@
package vnc
import "io"
// An Encoding implements a method for encoding pixel data that is
// sent by the server to the client.
type Encoding interface {
// The number that uniquely identifies this encoding type.
Type() int32
// Read reads the contents of the encoded pixel data from the reader.
// This should return a new Encoding implementation that contains
// the proper data.
Read(*ClientConn, *Rectangle, io.Reader) (Encoding, error)
}
const (
EncodingRaw = 0
EncodingCopyRect = 1
EncodingRRE = 2
EncodingCoRRE = 4
EncodingHextile = 5
EncodingZlib = 6
EncodingTight = 7
EncodingZRLE = 16
)
type CopyRectEncoding struct {
Colors []Color
copyRectSrcX uint16
copyRectSrcY uint16
}
func (z *CopyRectEncoding) Type() int32 {
return 1
}
func (z *CopyRectEncoding) Read(conn *ClientConn, rect *Rectangle, r io.Reader) (Encoding, error) {
//conn := &DataSource{conn: conn.c, PixelFormat: conn.PixelFormat}
//bytesPerPixel := c.PixelFormat.BPP / 8
z.copyRectSrcX, _ = conn.readUint16()
z.copyRectSrcY, _ = conn.readUint16()
return z, nil
}
//////////

View File

@ -4,9 +4,10 @@ import (
"bytes"
"encoding/binary"
"io"
"vncproxy/common"
)
func readPixelFormat(r io.Reader, result *PixelFormat) error {
func readPixelFormat(r io.Reader, result *common.PixelFormat) error {
var rawPixelFormat [16]byte
if _, err := io.ReadFull(r, rawPixelFormat[:]); err != nil {
return err
@ -67,7 +68,7 @@ func readPixelFormat(r io.Reader, result *PixelFormat) error {
return nil
}
func writePixelFormat(format *PixelFormat) ([]byte, error) {
func writePixelFormat(format *common.PixelFormat) ([]byte, error) {
var buf bytes.Buffer
// Byte 1

View File

@ -2,15 +2,16 @@ package vnc
import (
"os"
"vncproxy/common"
)
type Recorder struct {
RBSFileName string
fileHandle *os.File
logger Logger
logger common.Logger
}
func NewRecorder(saveFilePath string, logger Logger) *Recorder {
func NewRecorder(saveFilePath string, logger common.Logger) *Recorder {
rec := Recorder{RBSFileName: saveFilePath}
var err error
rec.fileHandle, err = os.OpenFile(saveFilePath, os.O_RDWR|os.O_CREATE, 0755)

View File

@ -5,18 +5,14 @@ import (
"encoding/json"
"fmt"
"io"
"vncproxy/common"
"vncproxy/encodings"
)
// FramebufferUpdateMessage consists of a sequence of rectangles of
// pixel data that the client should put into its framebuffer.
type FramebufferUpdateMessage struct {
Rectangles []Rectangle
}
func (r *Rectangle) String() string {
return fmt.Sprintf("(%d,%d) (width: %d, height: %d), Enc= %d", r.X, r.Y, r.Width, r.Height, r.Enc.Type())
Rectangles []common.Rectangle
}
func (m *FramebufferUpdateMessage) String() string {
@ -44,17 +40,17 @@ func (*FramebufferUpdateMessage) Read(c *ClientConn, r io.Reader) (ServerMessage
}
// Build the map of encodings supported
encMap := make(map[int32]Encoding)
encMap := make(map[int32]common.Encoding)
for _, enc := range c.Encs {
encMap[enc.Type()] = enc
}
// We must always support the raw encoding
rawEnc := new(RawEncoding)
rawEnc := new(encodings.RawEncoding)
encMap[rawEnc.Type()] = rawEnc
fmt.Printf("numrects= %d\n", numRects)
rects := make([]Rectangle, numRects)
rects := make([]common.Rectangle, numRects)
for i := uint16(0); i < numRects; i++ {
fmt.Printf("###############rect################: %d\n", i)
var encodingType int32
@ -84,7 +80,7 @@ func (*FramebufferUpdateMessage) Read(c *ClientConn, r io.Reader) (ServerMessage
}
var err error
rect.Enc, err = enc.Read(c, rect, r)
rect.Enc, err = enc.Read(&c.PixelFormat, rect, r)
if err != nil {
return nil, err
}
@ -184,7 +180,7 @@ func (*ServerCutTextMessage) Type() uint8 {
return 3
}
func (*ServerCutTextMessage) Read(c *ClientConn, r io.Reader) (ServerMessage, error) {
func (*ServerCutTextMessage) Read(conn *ClientConn, r io.Reader) (ServerMessage, error) {
// Read off the padding
var padding [1]byte
if _, err := io.ReadFull(r, padding[:]); err != nil {