├── .dockerignore ├── cmd ├── transcode │ ├── VERSION │ ├── .gitignore │ ├── Dockerfile │ ├── builder.dockerfile │ ├── Makefile │ └── README.md └── simplevnc │ ├── simplevnc │ └── main.go ├── vendor └── github.com │ ├── pixiv │ └── go-libjpeg │ │ ├── .gitignore │ │ ├── jpeg │ │ ├── jpeg.h │ │ ├── jpeg_darwin.go │ │ ├── panic_c.c │ │ ├── panic.go │ │ ├── jpeg.go │ │ └── destinationManager.go │ │ ├── test │ │ ├── images │ │ │ ├── cosmos.jpg │ │ │ ├── cosmos.png │ │ │ ├── kinkaku.jpg │ │ │ ├── kinkaku.png │ │ │ ├── checkerboard.png │ │ │ ├── checkerboard_420.jpg │ │ │ ├── checkerboard_422.jpg │ │ │ ├── checkerboard_440.jpg │ │ │ ├── checkerboard_444.jpg │ │ │ ├── testdata │ │ │ │ ├── video-001.png │ │ │ │ ├── video-001.jpeg │ │ │ │ ├── video-001.cmyk.png │ │ │ │ ├── video-001.rgb.jpeg │ │ │ │ ├── video-001.rgb.png │ │ │ │ ├── video-005.gray.png │ │ │ │ ├── video-001.221212.png │ │ │ │ ├── video-001.cmyk.jpeg │ │ │ │ ├── video-005.gray.jpeg │ │ │ │ ├── video-001.221212.jpeg │ │ │ │ ├── video-001.q50.410.jpeg │ │ │ │ ├── video-001.q50.411.jpeg │ │ │ │ ├── video-001.q50.420.jpeg │ │ │ │ ├── video-001.q50.422.jpeg │ │ │ │ ├── video-001.q50.440.jpeg │ │ │ │ ├── video-001.q50.444.jpeg │ │ │ │ ├── video-005.gray.q50.jpeg │ │ │ │ ├── video-001.progressive.jpeg │ │ │ │ ├── video-005.gray.q50.2x2.jpeg │ │ │ │ ├── video-001.q50.410.progressive.jpeg │ │ │ │ ├── video-001.q50.411.progressive.jpeg │ │ │ │ ├── video-001.q50.420.progressive.jpeg │ │ │ │ ├── video-001.q50.422.progressive.jpeg │ │ │ │ ├── video-001.q50.440.progressive.jpeg │ │ │ │ ├── video-001.q50.444.progressive.jpeg │ │ │ │ ├── video-005.gray.q50.progressive.jpeg │ │ │ │ ├── video-001.separate.dc.progression.jpeg │ │ │ │ ├── video-005.gray.q50.2x2.progressive.jpeg │ │ │ │ └── video-001.separate.dc.progression.progressive.jpeg │ │ │ └── README.md │ │ └── util │ │ │ └── util.go │ │ ├── travis-install-libjpeg-turbo.sh │ │ ├── .travis.yml │ │ ├── example │ │ └── decoder │ │ │ └── main.go │ │ ├── LICENSE │ │ ├── rgb │ │ └── rgb.go │ │ └── README.md │ ├── go-gl │ ├── glfw │ │ ├── v3.2 │ │ │ └── glfw │ │ │ │ ├── GLFW_C_REVISION.txt │ │ │ │ ├── error.c │ │ │ │ ├── c_glfw.go │ │ │ │ ├── c_glfw_darwin.go │ │ │ │ ├── c_glfw_windows.go │ │ │ │ ├── monitor.c │ │ │ │ ├── vulkan.go │ │ │ │ ├── util.go │ │ │ │ ├── c_glfw_linbsd.go │ │ │ │ ├── native_windows.go │ │ │ │ ├── native_darwin.go │ │ │ │ ├── glfw │ │ │ │ ├── COPYING.txt │ │ │ │ ├── src │ │ │ │ │ ├── xkb_unicode.h │ │ │ │ │ ├── posix_time.h │ │ │ │ │ ├── posix_tls.h │ │ │ │ │ ├── cocoa_joystick.h │ │ │ │ │ ├── cocoa_time.c │ │ │ │ │ ├── nsgl_context.h │ │ │ │ │ ├── linux_joystick.h │ │ │ │ │ ├── win32_joystick.h │ │ │ │ │ ├── posix_tls.c │ │ │ │ │ ├── win32_tls.c │ │ │ │ │ ├── win32_time.c │ │ │ │ │ ├── posix_time.c │ │ │ │ │ └── mir_platform.h │ │ │ │ └── deps │ │ │ │ │ ├── getopt.h │ │ │ │ │ ├── mingw │ │ │ │ │ └── _mingw_dxhelper.h │ │ │ │ │ └── vulkan │ │ │ │ │ └── vk_platform.h │ │ │ │ ├── native_linbsd.go │ │ │ │ ├── build.go │ │ │ │ ├── time.go │ │ │ │ ├── window.c │ │ │ │ ├── input.c │ │ │ │ ├── context.go │ │ │ │ └── glfw.go │ │ └── LICENSE │ └── gl │ │ ├── v2.1 │ │ └── gl │ │ │ ├── debug.go │ │ │ ├── procaddr.go │ │ │ └── conversions.go │ │ └── LICENSE │ ├── op │ └── go-logging │ │ ├── .travis.yml │ │ ├── CONTRIBUTORS │ │ ├── CHANGELOG.md │ │ ├── syslog_fallback.go │ │ ├── backend.go │ │ ├── LICENSE │ │ ├── syslog.go │ │ ├── multi.go │ │ ├── log_nix.go │ │ ├── README.md │ │ ├── log_windows.go │ │ └── level.go │ ├── cheggaaa │ └── pb │ │ ├── .travis.yml │ │ ├── pb_solaris.go │ │ ├── pb_nix.go │ │ ├── termios_nix.go │ │ ├── termios_bsd.go │ │ ├── pb_appengine.go │ │ ├── runecount.go │ │ ├── pool_x.go │ │ ├── reader.go │ │ ├── pool_win.go │ │ ├── LICENSE │ │ ├── pool.go │ │ ├── format.go │ │ ├── pb_x.go │ │ └── README.md │ └── juju │ └── errors │ ├── Makefile │ ├── .gitignore │ ├── path.go │ ├── doc.go │ └── error.go ├── .gitignore ├── vncclient ├── README.md ├── color.go ├── pointer.go ├── quickbuf.go ├── client_test.go ├── client_auth.go ├── client_auth_test.go └── pixel_format.go ├── Godeps ├── Readme └── Godeps.json ├── MANIFEST.in ├── no_gl.go ├── gymvnc ├── renderer.go ├── screen.go ├── logging.go └── action.go ├── __init__.py ├── gl.go ├── Makefile ├── examples └── usage.py ├── flexzlib ├── inflator.go └── inflator_test.go ├── flexflate ├── inflate_test.go ├── copy.go ├── copy_test.go ├── flate_test.go ├── reverse_bits.go ├── writer_test.go ├── reader_test.go ├── token.go └── fixedhuff.go ├── tests ├── test_profile.py └── test_smoke.py ├── LICENSE ├── .travis.yml ├── README.md └── setup.py /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | -------------------------------------------------------------------------------- /cmd/transcode/VERSION: -------------------------------------------------------------------------------- 1 | 0.0.3 2 | -------------------------------------------------------------------------------- /cmd/transcode/.gitignore: -------------------------------------------------------------------------------- 1 | transcode 2 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | /test/out/* 4 | -------------------------------------------------------------------------------- /cmd/simplevnc/simplevnc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/cmd/simplevnc/simplevnc -------------------------------------------------------------------------------- /cmd/transcode/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM scratch 2 | ADD transcode /transcode 3 | ENTRYPOINT ["/transcode"] 4 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/GLFW_C_REVISION.txt: -------------------------------------------------------------------------------- 1 | f2ba78e04bf8e2cab04388fa8b12c133abb24001 2 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.0 5 | - 1.1 6 | - tip 7 | -------------------------------------------------------------------------------- /vendor/github.com/cheggaaa/pb/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.4.2 4 | sudo: false 5 | os: 6 | - linux 7 | - osx 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.so 2 | go_vncdriver.h 3 | *.dSYM 4 | /build 5 | /dist 6 | /.build 7 | /*.egg-info 8 | __pycache__ 9 | .cache 10 | -------------------------------------------------------------------------------- /vncclient/README.md: -------------------------------------------------------------------------------- 1 | # VNC Library for Go 2 | 3 | Client forked from: 4 | 5 | ``` 6 | $ go get github.com/mitchellh/vncclient 7 | ``` 8 | -------------------------------------------------------------------------------- /vendor/github.com/cheggaaa/pb/pb_solaris.go: -------------------------------------------------------------------------------- 1 | // +build solaris 2 | // +build !appengine 3 | 4 | package pb 5 | 6 | const sysIoctl = 54 7 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/jpeg/jpeg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // the dimension multiple to which data buffers should be aligned. 4 | #define ALIGN_SIZE 16 5 | -------------------------------------------------------------------------------- /Godeps/Readme: -------------------------------------------------------------------------------- 1 | This directory tree is generated automatically by godep. 2 | 3 | Please do not edit. 4 | 5 | See https://github.com/tools/godep for more information. 6 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/cosmos.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/cosmos.jpg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/cosmos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/cosmos.png -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/kinkaku.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/kinkaku.jpg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/kinkaku.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/kinkaku.png -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/checkerboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/checkerboard.png -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include Makefile build.py 2 | include Godeps/Godeps.json 3 | recursive-include vendor *.h *.m 4 | global-include *.go *.c 5 | prune .build 6 | prune dist 7 | prune build 8 | -------------------------------------------------------------------------------- /no_gl.go: -------------------------------------------------------------------------------- 1 | // +build no_gl 2 | 3 | package main 4 | 5 | const compiledWithGL = false 6 | 7 | func (b *sessionInfo) initRenderer(name string) error { 8 | return nil 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/checkerboard_420.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/checkerboard_420.jpg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/checkerboard_422.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/checkerboard_422.jpg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/checkerboard_440.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/checkerboard_440.jpg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/checkerboard_444.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/checkerboard_444.jpg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.png -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.cmyk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.cmyk.png -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.rgb.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.rgb.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.rgb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.rgb.png -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-005.gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-005.gray.png -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.221212.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.221212.png -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.cmyk.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.cmyk.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-005.gray.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-005.gray.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.221212.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.221212.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.410.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.410.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.411.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.411.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.420.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.420.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.422.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.422.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.440.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.440.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.444.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.444.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-005.gray.q50.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-005.gray.q50.jpeg -------------------------------------------------------------------------------- /vendor/github.com/cheggaaa/pb/pb_nix.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin freebsd netbsd openbsd dragonfly 2 | // +build !appengine 3 | 4 | package pb 5 | 6 | import "syscall" 7 | 8 | const sysIoctl = syscall.SYS_IOCTL 9 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.progressive.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.progressive.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-005.gray.q50.2x2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-005.gray.q50.2x2.jpeg -------------------------------------------------------------------------------- /vendor/github.com/cheggaaa/pb/termios_nix.go: -------------------------------------------------------------------------------- 1 | // +build linux solaris 2 | // +build !appengine 3 | 4 | package pb 5 | 6 | const ioctlReadTermios = 0x5401 // syscall.TCGETS 7 | const ioctlWriteTermios = 0x5402 // syscall.TCSETS 8 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.410.progressive.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.410.progressive.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.411.progressive.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.411.progressive.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.420.progressive.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.420.progressive.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.422.progressive.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.422.progressive.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.440.progressive.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.440.progressive.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.444.progressive.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.q50.444.progressive.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-005.gray.q50.progressive.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-005.gray.q50.progressive.jpeg -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.separate.dc.progression.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.separate.dc.progression.jpeg -------------------------------------------------------------------------------- /vncclient/color.go: -------------------------------------------------------------------------------- 1 | package vncclient 2 | 3 | import "unsafe" 4 | 5 | const colorSize = int(unsafe.Sizeof(Color{})) 6 | 7 | // Color represents a single color in a color map. 8 | type Color struct { 9 | R, G, B uint8 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/jpeg/jpeg_darwin.go: -------------------------------------------------------------------------------- 1 | // +build darwin 2 | 3 | package jpeg 4 | 5 | /* 6 | #cgo LDFLAGS: -L/usr/local/opt/jpeg-turbo/lib 7 | #cgo CFLAGS: -I/usr/local/opt/jpeg-turbo/include 8 | */ 9 | import "C" 10 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-005.gray.q50.2x2.progressive.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-005.gray.q50.2x2.progressive.jpeg -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Alec Thomas 2 | Guilhem Lettron 3 | Ivan Daniluk 4 | Nimi Wariboko Jr 5 | Róbert Selvek 6 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.separate.dc.progression.progressive.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/go-vncdriver/HEAD/vendor/github.com/pixiv/go-libjpeg/test/images/testdata/video-001.separate.dc.progression.progressive.jpeg -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/error.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | void glfwErrorCB(int code, const char *desc) { 4 | goErrorCB(code, (char*)desc); 5 | } 6 | 7 | void glfwSetErrorCallbackCB() { 8 | glfwSetErrorCallback(glfwErrorCB); 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/cheggaaa/pb/termios_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd netbsd openbsd dragonfly 2 | // +build !appengine 3 | 4 | package pb 5 | 6 | import "syscall" 7 | 8 | const ioctlReadTermios = syscall.TIOCGETA 9 | const ioctlWriteTermios = syscall.TIOCSETA 10 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/jpeg/panic_c.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | void error_panic(j_common_ptr cinfo) { 4 | struct { const char *p; } a; 5 | char buffer[JMSG_LENGTH_MAX]; 6 | (*cinfo->err->format_message) (cinfo, buffer); 7 | goPanic(buffer); 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/c_glfw.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | #include "glfw/src/context.c" 5 | #include "glfw/src/init.c" 6 | #include "glfw/src/input.c" 7 | #include "glfw/src/monitor.c" 8 | #include "glfw/src/vulkan.c" 9 | #include "glfw/src/window.c" 10 | */ 11 | import "C" 12 | -------------------------------------------------------------------------------- /gymvnc/renderer.go: -------------------------------------------------------------------------------- 1 | package gymvnc 2 | 3 | import "github.com/openai/go-vncdriver/vncclient" 4 | 5 | type Renderer interface { 6 | Init(width, height uint16, name string, screen []vncclient.Color) error 7 | Apply(colors []*vncclient.FramebufferUpdateMessage) 8 | Render() 9 | Close() error 10 | } 11 | -------------------------------------------------------------------------------- /cmd/transcode/builder.dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang 2 | RUN apt-get update \ 3 | && apt-get install -y libjpeg62-turbo-dev \ 4 | && apt-get clean \ 5 | && rm -rf /var/lib/apt/lists/* 6 | COPY . /go/src/github.com/openai/go-vncdriver 7 | RUN go install --ldflags '-extldflags "-static"' github.com/openai/go-vncdriver/cmd/transcode 8 | -------------------------------------------------------------------------------- /vncclient/pointer.go: -------------------------------------------------------------------------------- 1 | package vncclient 2 | 3 | // ButtonMask represents a mask of pointer presses/releases. 4 | type ButtonMask uint8 5 | 6 | // All available button mask components. 7 | const ( 8 | ButtonLeft ButtonMask = 1 << iota 9 | ButtonMiddle 10 | ButtonRight 11 | Button4 12 | Button5 13 | Button6 14 | Button7 15 | Button8 16 | ) 17 | -------------------------------------------------------------------------------- /vendor/github.com/cheggaaa/pb/pb_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package pb 4 | 5 | import "errors" 6 | 7 | // terminalWidth returns width of the terminal, which is not supported 8 | // and should always failed on appengine classic which is a sandboxed PaaS. 9 | func terminalWidth() (int, error) { 10 | return 0, errors.New("Not supported") 11 | } 12 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | import sys 3 | 4 | # We need to ensure this gets imported before tensorflow. 5 | # This at least ensures we're not failing for import ordering reasons. 6 | if 'tensorflow' in sys.modules: 7 | raise RuntimeError('go_vncdriver must be imported before tensorflow') 8 | 9 | from go_vncdriver.go_vncdriver import * 10 | -------------------------------------------------------------------------------- /vendor/github.com/juju/errors/Makefile: -------------------------------------------------------------------------------- 1 | default: check 2 | 3 | check: 4 | go test && go test -compiler gccgo 5 | 6 | docs: 7 | godoc2md github.com/juju/errors > README.md 8 | sed -i 's|\[godoc-link-here\]|[![GoDoc](https://godoc.org/github.com/juju/errors?status.svg)](https://godoc.org/github.com/juju/errors)|' README.md 9 | 10 | 11 | .PHONY: default check docs 12 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/travis-install-libjpeg-turbo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -eux 2 | 3 | if [ "$1" != "" ]; then 4 | cd /tmp 5 | wget http://downloads.sourceforge.net/project/libjpeg-turbo/1.3.1/libjpeg-turbo-official_$1_amd64.deb 6 | sudo dpkg -i libjpeg-turbo-official_$1_amd64.deb 7 | find /opt/libjpeg-turbo/lib64 8 | find /opt/libjpeg-turbo/include 9 | fi 10 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/jpeg/panic.go: -------------------------------------------------------------------------------- 1 | package jpeg 2 | 3 | /* 4 | #include 5 | #include 6 | #include "jpeglib.h" 7 | 8 | // export from golang 9 | void goPanic(char*); 10 | 11 | void error_panic(j_common_ptr dinfo); 12 | 13 | */ 14 | import "C" 15 | 16 | //export goPanic 17 | func goPanic(msg *C.char) { 18 | panic(C.GoString(msg)) 19 | } 20 | -------------------------------------------------------------------------------- /gymvnc/screen.go: -------------------------------------------------------------------------------- 1 | package gymvnc 2 | 3 | import "github.com/openai/go-vncdriver/vncclient" 4 | 5 | type Screen struct { 6 | Data []vncclient.Color 7 | Width uint16 8 | Height uint16 9 | } 10 | 11 | func NewScreen(width, height uint16) *Screen { 12 | return &Screen{ 13 | Data: make([]vncclient.Color, uint32(width)*uint32(height)), 14 | Width: width, 15 | Height: height, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/juju/errors/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/c_glfw_darwin.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | #cgo CFLAGS: -x objective-c 5 | #include "glfw/src/cocoa_init.m" 6 | #include "glfw/src/cocoa_joystick.m" 7 | #include "glfw/src/cocoa_monitor.m" 8 | #include "glfw/src/cocoa_window.m" 9 | #include "glfw/src/cocoa_time.c" 10 | #include "glfw/src/posix_tls.c" 11 | #include "glfw/src/nsgl_context.m" 12 | */ 13 | import "C" 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/c_glfw_windows.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | #include "glfw/src/win32_init.c" 5 | #include "glfw/src/win32_joystick.c" 6 | #include "glfw/src/win32_monitor.c" 7 | #include "glfw/src/win32_time.c" 8 | #include "glfw/src/win32_tls.c" 9 | #include "glfw/src/win32_window.c" 10 | #include "glfw/src/wgl_context.c" 11 | #include "glfw/src/egl_context.c" 12 | */ 13 | import "C" 14 | -------------------------------------------------------------------------------- /gl.go: -------------------------------------------------------------------------------- 1 | // +build !no_gl 2 | 3 | package main 4 | 5 | import "github.com/openai/go-vncdriver/vncgl" 6 | 7 | const compiledWithGL = true 8 | 9 | func (b *sessionInfo) initRenderer(name string) error { 10 | if b.rendererSet { 11 | return nil 12 | } 13 | b.rendererSet = true 14 | 15 | // Make sure we've initialized glfw 16 | vncgl.SetupRendering() 17 | return b.batch.SetRenderer(name, &vncgl.VNCGL{}) 18 | } 19 | -------------------------------------------------------------------------------- /gymvnc/logging.go: -------------------------------------------------------------------------------- 1 | package gymvnc 2 | 3 | import ( 4 | "os" 5 | 6 | logging "github.com/op/go-logging" 7 | ) 8 | 9 | func ConfigureLogging() { 10 | if os.Getenv("GYM_LOGLEVEL") == "DEBUG" { 11 | logging.SetLevel(logging.DEBUG, "") 12 | } else { 13 | logging.SetLevel(logging.INFO, "") 14 | } 15 | logging.SetFormatter(logging.MustStringFormatter("%{level:.1s}%{time:0102 15:04:05.999999} %{pid} %{shortfile}] %{message}")) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/cheggaaa/pb/runecount.go: -------------------------------------------------------------------------------- 1 | package pb 2 | 3 | import ( 4 | "regexp" 5 | "unicode/utf8" 6 | ) 7 | 8 | // Finds the control character sequences (like colors) 9 | var ctrlFinder = regexp.MustCompile("\x1b\x5b[0-9]+\x6d") 10 | 11 | func escapeAwareRuneCountInString(s string) int { 12 | n := utf8.RuneCountInString(s) 13 | for _, sm := range ctrlFinder.FindAllString(s, -1) { 14 | n -= len(sm) 15 | } 16 | return n 17 | } 18 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: build no_gl clean upload install test 2 | 3 | build: 4 | ./build.py 5 | 6 | no_gl: 7 | GO_VNCDRIVER_NOGL=true ./build.py 8 | 9 | install: 10 | pip install -r requirements.txt 11 | 12 | upload: clean 13 | rm -rf dist go_vncdriver.egg-info 14 | python setup.py sdist 15 | twine upload dist/* 16 | rm -rf dist 17 | 18 | clean: 19 | rm -rf *.so *.h *~ build 20 | 21 | test: 22 | python -c 'import go_vncdriver; go_vncdriver.VNCSession()' 23 | -------------------------------------------------------------------------------- /vendor/github.com/cheggaaa/pb/pool_x.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin freebsd netbsd openbsd solaris dragonfly 2 | 3 | package pb 4 | 5 | import "fmt" 6 | 7 | func (p *Pool) print(first bool) bool { 8 | var out string 9 | if !first { 10 | out = fmt.Sprintf("\033[%dA", len(p.bars)) 11 | } 12 | isFinished := true 13 | for _, bar := range p.bars { 14 | if !bar.isFinish { 15 | isFinished = false 16 | } 17 | bar.Update() 18 | out += fmt.Sprintf("\r%s\n", bar.String()) 19 | } 20 | fmt.Print(out) 21 | return isFinished 22 | } 23 | -------------------------------------------------------------------------------- /cmd/transcode/Makefile: -------------------------------------------------------------------------------- 1 | URL ?= docker.openai.com/transcode 2 | 3 | transcode: 4 | go build 5 | 6 | build: transcode 7 | 8 | image: 9 | cd ../.. && docker build --tag transcode-builder -f cmd/transcode/builder.dockerfile . 10 | docker run --rm transcode-builder cat /go/bin/transcode > transcode 11 | chmod +x transcode 12 | docker build -t $(URL):latest . 13 | docker tag $(URL):latest $(URL):$$(cat VERSION) 14 | 15 | push: 16 | docker push $(URL):latest 17 | docker push $(URL):$$(cat VERSION) 18 | 19 | 20 | .PHONY: transcode image push 21 | -------------------------------------------------------------------------------- /vendor/github.com/cheggaaa/pb/reader.go: -------------------------------------------------------------------------------- 1 | package pb 2 | 3 | import ( 4 | "io" 5 | ) 6 | 7 | // It's proxy reader, implement io.Reader 8 | type Reader struct { 9 | io.Reader 10 | bar *ProgressBar 11 | } 12 | 13 | func (r *Reader) Read(p []byte) (n int, err error) { 14 | n, err = r.Reader.Read(p) 15 | r.bar.Add(n) 16 | return 17 | } 18 | 19 | // Close the reader when it implements io.Closer 20 | func (r *Reader) Close() (err error) { 21 | if closer, ok := r.Reader.(io.Closer); ok { 22 | return closer.Close() 23 | } 24 | return 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | sudo: true 4 | 5 | go: 6 | - 1.4 7 | - 1.5 8 | - 1.6 9 | - tip 10 | 11 | env: 12 | - TURBO_VER="" 13 | - TURBO_VER="1.3.1" CGO_LDFLAGS="-L/opt/libjpeg-turbo/lib64" CGO_CFLAGS="-I/opt/libjpeg-turbo/include" LD_LIBRARY_PATH="/opt/libjpeg-turbo/lib64" 14 | 15 | before_install: 16 | - ./travis-install-libjpeg-turbo.sh "$TURBO_VER" 17 | - cd $HOME/gopath/src/github.com/pixiv/go-libjpeg 18 | 19 | script: 20 | - go test -a -test.v ./... 21 | - cd jpeg && go test -a -bench . -benchtime 10s 22 | -------------------------------------------------------------------------------- /gymvnc/action.go: -------------------------------------------------------------------------------- 1 | package gymvnc 2 | 3 | import "github.com/openai/go-vncdriver/vncclient" 4 | 5 | type VNCEvent interface { 6 | Execute(c *vncclient.ClientConn) error 7 | } 8 | 9 | type KeyEvent struct { 10 | Keysym uint32 11 | Down bool 12 | } 13 | 14 | func (k KeyEvent) Execute(c *vncclient.ClientConn) error { 15 | return c.KeyEvent(k.Keysym, k.Down) 16 | } 17 | 18 | type PointerEvent struct { 19 | Mask vncclient.ButtonMask 20 | X, Y uint16 21 | } 22 | 23 | func (k PointerEvent) Execute(c *vncclient.ClientConn) error { 24 | return c.PointerEvent(k.Mask, k.X, k.Y) 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/cheggaaa/pb/pool_win.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package pb 4 | 5 | import ( 6 | "fmt" 7 | "log" 8 | ) 9 | 10 | func (p *Pool) print(first bool) bool { 11 | var out string 12 | if !first { 13 | coords, err := getCursorPos() 14 | if err != nil { 15 | log.Panic(err) 16 | } 17 | coords.Y -= int16(len(p.bars)) 18 | coords.X = 0 19 | 20 | err = setCursorPos(coords) 21 | if err != nil { 22 | log.Panic(err) 23 | } 24 | } 25 | isFinished := true 26 | for _, bar := range p.bars { 27 | if !bar.isFinish { 28 | isFinished = false 29 | } 30 | bar.Update() 31 | out += fmt.Sprintf("\r%s\n", bar.String()) 32 | } 33 | fmt.Print(out) 34 | return isFinished 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/monitor.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | GLFWmonitor *GetMonitorAtIndex(GLFWmonitor **monitors, int index) { 4 | return monitors[index]; 5 | } 6 | 7 | GLFWvidmode GetVidmodeAtIndex(GLFWvidmode *vidmodes, int index) { 8 | return vidmodes[index]; 9 | } 10 | 11 | void glfwMonitorCB(GLFWmonitor* monitor, int event) { 12 | goMonitorCB(monitor, event); 13 | } 14 | 15 | void glfwSetMonitorCallbackCB() { 16 | glfwSetMonitorCallback(glfwMonitorCB); 17 | } 18 | 19 | unsigned int GetGammaAtIndex(unsigned short *color, int i) { 20 | return color[i]; 21 | } 22 | 23 | void SetGammaAtIndex(unsigned short *color, int i, unsigned short value) { 24 | color[i] = value; 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/vulkan.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#include "glfw/include/GLFW/glfw3.h" 4 | import "C" 5 | 6 | // VulkanSupported returns whether the Vulkan loader has been found. This check is performed by Init. 7 | // 8 | // The availability of a Vulkan loader does not by itself guarantee that window surface creation or 9 | // even device creation is possible. Call GetRequiredInstanceExtensions to check whether the 10 | // extensions necessary for Vulkan surface creation are available and GetPhysicalDevicePresentationSupport 11 | // to check whether a queue family of a physical device supports image presentation. 12 | func VulkanSupported() bool { 13 | return glfwbool(C.glfwVulkanSupported()) 14 | } 15 | -------------------------------------------------------------------------------- /examples/usage.py: -------------------------------------------------------------------------------- 1 | import go_vncdriver 2 | import time 3 | 4 | from PIL import Image 5 | 6 | from gym.envs.classic_control import rendering 7 | 8 | # res = go_vncdriver.example(1, 2) 9 | # res = go_vncdriver.connect(["hi", "tester"]) 10 | # import ipdb;ipdb.set_trace() 11 | 12 | go_vncdriver.setup() 13 | h = go_vncdriver.VNCSession(["localhost:5900"], None) 14 | print(h.remotes) 15 | 16 | viewer = rendering.SimpleImageViewer() 17 | while True: 18 | observation, info = h.flip() 19 | if any(i['vnc.updates.n'] for i in info): 20 | for ob in observation: 21 | viewer.imshow(ob) 22 | # Image.fromarray(ob).show() 23 | # print(ob.shape) 24 | time.sleep(1/10) 25 | 26 | h.close() 27 | -------------------------------------------------------------------------------- /cmd/transcode/README.md: -------------------------------------------------------------------------------- 1 | This command reads in an FBS 1.2 file (OpenAI-specific format) of messages sent 2 | from a server to a client in a VNC session. It transcodes FramebufferUpdate 3 | messages from their original encoding to an equivalent message with raw 4 | encoding. 5 | 6 | `Dockerfile` defines a tiny docker image that contains only the `transcode` 7 | executable. The resulting image is about 6MB. 8 | 9 | Use the image like so: 10 | 11 | ``` 12 | $ cd out/demo/ 13 | $ docker run -v $(pwd):/tmp docker.openai.com/transcode -in=/tmp/server.fbs.orig -out=/tmp/transcoded.fbs 14 | ``` 15 | 16 | It is recommended to first `mv` the tight-encoded `server.fbs` file to `server.fbs.orig` to keep track of the original demo. -------------------------------------------------------------------------------- /flexzlib/inflator.go: -------------------------------------------------------------------------------- 1 | package flexzlib 2 | 3 | import ( 4 | "bytes" 5 | "io/ioutil" 6 | ) 7 | 8 | type Inflator struct { 9 | r *Reader 10 | } 11 | 12 | func NewInflator() *Inflator { 13 | return &Inflator{} 14 | } 15 | 16 | func (i *Inflator) Inflate(p []byte) ([]byte, error) { 17 | buf := bytes.NewBuffer(p) 18 | if i.r == nil { 19 | // Need to do this lazily since we need to make sure 20 | // we have a complete zlib header. 21 | r, err := NewReader(buf) 22 | if err != nil { 23 | return nil, err 24 | } 25 | i.r = r 26 | } else { 27 | i.r.SwapReader(buf) 28 | } 29 | 30 | r, e := ioutil.ReadAll(i.r) 31 | return r, e 32 | } 33 | 34 | func (i *Inflator) Read(p []byte) (int, error) { 35 | return i.r.Read(p) 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/util.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#include 4 | //#include "glfw/include/GLFW/glfw3.h" 5 | import "C" 6 | 7 | import ( 8 | "reflect" 9 | "unsafe" 10 | ) 11 | 12 | func glfwbool(b C.int) bool { 13 | if b == C.GL_TRUE { 14 | return true 15 | } 16 | return false 17 | } 18 | 19 | func bytes(origin []byte) (pointer *uint8, free func()) { 20 | n := len(origin) 21 | 22 | if n == 0 { 23 | return nil, func() {} 24 | } 25 | 26 | data := C.malloc(C.size_t(n)) 27 | 28 | dataSlice := *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{ 29 | Data: uintptr(data), 30 | Len: n, 31 | Cap: n, 32 | })) 33 | 34 | copy(dataSlice, origin) 35 | 36 | return &dataSlice[0], func() { C.free(data) } 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/gl/v2.1/gl/debug.go: -------------------------------------------------------------------------------- 1 | // Glow automatically generated OpenGL binding: http://github.com/go-gl/glow 2 | 3 | package gl 4 | 5 | import "C" 6 | import "unsafe" 7 | 8 | type DebugProc func( 9 | source uint32, 10 | gltype uint32, 11 | id uint32, 12 | severity uint32, 13 | length int32, 14 | message string, 15 | userParam unsafe.Pointer) 16 | 17 | var userDebugCallback DebugProc 18 | 19 | //export glowDebugCallback_gl21 20 | func glowDebugCallback_gl21( 21 | source uint32, 22 | gltype uint32, 23 | id uint32, 24 | severity uint32, 25 | length int32, 26 | message *uint8, 27 | userParam unsafe.Pointer) { 28 | if userDebugCallback != nil { 29 | userDebugCallback(source, gltype, id, severity, length, GoStr(message), userParam) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /flexzlib/inflator_test.go: -------------------------------------------------------------------------------- 1 | package flexzlib 2 | 3 | import ( 4 | "bytes" 5 | "encoding/base64" 6 | "testing" 7 | ) 8 | 9 | func TestInflator(t *testing.T) { 10 | inflator := NewInflator() 11 | 12 | for i := range dataCompressed { 13 | compressed, err := base64.StdEncoding.DecodeString(dataCompressed[i]) 14 | if err != nil { 15 | t.Fatal(err) 16 | } 17 | 18 | inflated, err := inflator.Inflate(compressed) 19 | if err != nil { 20 | t.Fatal(err) 21 | } 22 | 23 | expectedInflated, err := base64.StdEncoding.DecodeString(dataInflated[i]) 24 | if err != nil { 25 | t.Fatal(err) 26 | } 27 | 28 | if !bytes.Equal(inflated, expectedInflated) { 29 | t.Fatalf("Incorrect inflation: actual=%q expected=%q", inflated, expectedInflated) 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 2.0.0-rc1 (2016-02-11) 4 | 5 | Time flies and it has been three years since this package was first released. 6 | There have been a couple of API changes I have wanted to do for some time but 7 | I've tried to maintain backwards compatibility. Some inconsistencies in the 8 | API have started to show, proper vendor support in Go out of the box and 9 | the fact that `go vet` will give warnings -- I have decided to bump the major 10 | version. 11 | 12 | * Make eg. `Info` and `Infof` do different things. You want to change all calls 13 | to `Info` with a string format go to `Infof` etc. In many cases, `go vet` will 14 | guide you. 15 | * `Id` in `Record` is now called `ID` 16 | 17 | ## 1.0.0 (2013-02-21) 18 | 19 | Initial release 20 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/c_glfw_linbsd.go: -------------------------------------------------------------------------------- 1 | // +build linux freebsd 2 | 3 | package glfw 4 | 5 | /* 6 | #ifdef _GLFW_MIR 7 | #include "glfw/src/mir_init.c" 8 | #include "glfw/src/mir_monitor.c" 9 | #include "glfw/src/mir_window.c" 10 | #endif 11 | #ifdef _GLFW_WAYLAND 12 | #include "glfw/src/wl_init.c" 13 | #include "glfw/src/wl_monitor.c" 14 | #include "glfw/src/wl_window.c" 15 | #endif 16 | #ifdef _GLFW_X11 17 | #include "glfw/src/x11_init.c" 18 | #include "glfw/src/x11_monitor.c" 19 | #include "glfw/src/x11_window.c" 20 | #include "glfw/src/glx_context.c" 21 | #endif 22 | #include "glfw/src/linux_joystick.c" 23 | #include "glfw/src/posix_time.c" 24 | #include "glfw/src/posix_tls.c" 25 | #include "glfw/src/xkb_unicode.c" 26 | #include "glfw/src/egl_context.c" 27 | */ 28 | import "C" 29 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/native_windows.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#define GLFW_EXPOSE_NATIVE_WIN32 4 | //#define GLFW_EXPOSE_NATIVE_WGL 5 | //#include "glfw/include/GLFW/glfw3.h" 6 | //#include "glfw/include/GLFW/glfw3native.h" 7 | import "C" 8 | 9 | func (m *Monitor) GetWin32Adapter() string { 10 | ret := C.glfwGetWin32Adapter(m.data) 11 | panicError() 12 | return C.GoString(ret) 13 | } 14 | 15 | func (m *Monitor) GetWin32Monitor() string { 16 | ret := C.glfwGetWin32Monitor(m.data) 17 | panicError() 18 | return C.GoString(ret) 19 | } 20 | 21 | func (w *Window) GetWin32Window() C.HWND { 22 | ret := C.glfwGetWin32Window(w.data) 23 | panicError() 24 | return ret 25 | } 26 | 27 | func (w *Window) GetWGLContext() C.HGLRC { 28 | ret := C.glfwGetWGLContext(w.data) 29 | panicError() 30 | return ret 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/example/decoder/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "image" 6 | "log" 7 | "os" 8 | 9 | "github.com/pixiv/go-libjpeg/jpeg" 10 | ) 11 | 12 | func main() { 13 | flag.Parse() 14 | file := flag.Arg(0) 15 | 16 | io, err := os.Open(file) 17 | if err != nil { 18 | log.Fatalln("Can't open file: ", file) 19 | } 20 | 21 | img, err := jpeg.Decode(io, &jpeg.DecoderOptions{}) 22 | if img == nil { 23 | log.Fatalln("Got nil") 24 | } 25 | if err != nil { 26 | log.Fatalln("Got Error: %v", err) 27 | } 28 | 29 | // 30 | // write your code here ... 31 | // 32 | 33 | switch img.(type) { 34 | case *image.YCbCr: 35 | log.Println("decoded YCbCr") 36 | case *image.Gray: 37 | log.Println("decoded Gray") 38 | default: 39 | log.Println("unknown format") 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/syslog_fallback.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013, Örjan Persson. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //+build windows plan9 6 | 7 | package logging 8 | 9 | import ( 10 | "fmt" 11 | ) 12 | 13 | type Priority int 14 | 15 | type SyslogBackend struct { 16 | } 17 | 18 | func NewSyslogBackend(prefix string) (b *SyslogBackend, err error) { 19 | return nil, fmt.Errorf("Platform does not support syslog") 20 | } 21 | 22 | func NewSyslogBackendPriority(prefix string, priority Priority) (b *SyslogBackend, err error) { 23 | return nil, fmt.Errorf("Platform does not support syslog") 24 | } 25 | 26 | func (b *SyslogBackend) Log(level Level, calldepth int, rec *Record) error { 27 | return fmt.Errorf("Platform does not support syslog") 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/jpeg/jpeg.go: -------------------------------------------------------------------------------- 1 | // Package jpeg decodes JPEG image to image.YCbCr using libjpeg (or libjpeg-turbo). 2 | package jpeg 3 | 4 | // 5 | // Original codes are bollowed from go-thumber. 6 | // Copyright (c) 2014 pixiv Inc. All rights reserved. 7 | // 8 | // See: https://github.com/pixiv/go-thumber 9 | // 10 | 11 | /* 12 | #cgo LDFLAGS: -ljpeg 13 | #include 14 | #include 15 | #include 16 | 17 | */ 18 | import "C" 19 | 20 | // Y/Cb/Cr Planes 21 | const ( 22 | Y = 0 23 | Cb = 1 24 | Cr = 2 25 | ) 26 | 27 | // DCTMethod is the DCT/IDCT method type. 28 | type DCTMethod C.J_DCT_METHOD 29 | 30 | const ( 31 | // DCTISlow is slow but accurate integer algorithm 32 | DCTISlow DCTMethod = C.JDCT_ISLOW 33 | // DCTIFast is faster, less accurate integer method 34 | DCTIFast DCTMethod = C.JDCT_IFAST 35 | // DCTFloat is floating-point: accurate, fast on fast HW 36 | DCTFloat DCTMethod = C.JDCT_FLOAT 37 | ) 38 | -------------------------------------------------------------------------------- /flexflate/inflate_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package flexflate 6 | 7 | import ( 8 | "bytes" 9 | "io" 10 | "testing" 11 | ) 12 | 13 | func TestReset(t *testing.T) { 14 | ss := []string{ 15 | "lorem ipsum izzle fo rizzle", 16 | "the quick brown fox jumped over", 17 | } 18 | 19 | deflated := make([]bytes.Buffer, 2) 20 | for i, s := range ss { 21 | w, _ := NewWriter(&deflated[i], 1) 22 | w.Write([]byte(s)) 23 | w.Close() 24 | } 25 | 26 | inflated := make([]bytes.Buffer, 2) 27 | 28 | f := NewReader(&deflated[0]) 29 | io.Copy(&inflated[0], f) 30 | f.(Resetter).Reset(&deflated[1], nil) 31 | io.Copy(&inflated[1], f) 32 | f.Close() 33 | 34 | for i, s := range ss { 35 | if s != inflated[i].String() { 36 | t.Errorf("inflated[%d]:\ngot %q\nwant %q", i, inflated[i], s) 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/test_profile.py: -------------------------------------------------------------------------------- 1 | import gc 2 | import go_vncdriver 3 | import time 4 | 5 | session = go_vncdriver.VNCSession() 6 | session.start_profile("/tmp/profile.pprof") 7 | session.connect("conn1", address="127.0.0.1:5900", encoding="tight") 8 | 9 | 10 | for i in range(10000): 11 | # observations, infos, errors = session.step({"conn1": [("KeyEvent", 1, 2)]}) 12 | # session.render("conn1") 13 | # print(observations, infos, errors) 14 | # time.sleep(0.016) 15 | 16 | observations, infos, errors = session.step({"conn1": [("KeyEvent", 1, 2)]}) 17 | # gc.collect() 18 | # print(observations, infos, errors) 19 | # session.connect("conn1", address="127.0.0.1:5900", encoding="tight") 20 | 21 | session.end_profile() 22 | 23 | # session.close("conn1") 24 | # for i in range(10): 25 | # observations, infos, errors = session.step({"conn2": [("KeyEvent", 1, 2)]}) 26 | # print(observations, infos, errors) 27 | # time.sleep(0.016) 28 | 29 | # session.render("first") 30 | -------------------------------------------------------------------------------- /vendor/github.com/juju/errors/path.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013, 2014 Canonical Ltd. 2 | // Licensed under the LGPLv3, see LICENCE file for details. 3 | 4 | package errors 5 | 6 | import ( 7 | "runtime" 8 | "strings" 9 | ) 10 | 11 | // prefixSize is used internally to trim the user specific path from the 12 | // front of the returned filenames from the runtime call stack. 13 | var prefixSize int 14 | 15 | // goPath is the deduced path based on the location of this file as compiled. 16 | var goPath string 17 | 18 | func init() { 19 | _, file, _, ok := runtime.Caller(0) 20 | if ok { 21 | // We know that the end of the file should be: 22 | // github.com/juju/errors/path.go 23 | size := len(file) 24 | suffix := len("github.com/juju/errors/path.go") 25 | goPath = file[:size-suffix] 26 | prefixSize = len(goPath) 27 | } 28 | } 29 | 30 | func trimGoPath(filename string) string { 31 | if strings.HasPrefix(filename, goPath) { 32 | return filename[prefixSize:] 33 | } 34 | return filename 35 | } 36 | -------------------------------------------------------------------------------- /flexflate/copy.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package flexflate 6 | 7 | // forwardCopy is like the built-in copy function except that it always goes 8 | // forward from the start, even if the dst and src overlap. 9 | // It is equivalent to: 10 | // for i := 0; i < n; i++ { 11 | // mem[dst+i] = mem[src+i] 12 | // } 13 | func forwardCopy(mem []byte, dst, src, n int) { 14 | if dst <= src { 15 | copy(mem[dst:dst+n], mem[src:src+n]) 16 | return 17 | } 18 | for { 19 | if dst >= src+n { 20 | copy(mem[dst:dst+n], mem[src:src+n]) 21 | return 22 | } 23 | // There is some forward overlap. The destination 24 | // will be filled with a repeated pattern of mem[src:src+k]. 25 | // We copy one instance of the pattern here, then repeat. 26 | // Each time around this loop k will double. 27 | k := dst - src 28 | copy(mem[dst:dst+k], mem[src:src+k]) 29 | n -= k 30 | dst += k 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/native_darwin.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | #define GLFW_EXPOSE_NATIVE_COCOA 5 | #define GLFW_EXPOSE_NATIVE_NSGL 6 | #include "glfw/include/GLFW/glfw3.h" 7 | #include "glfw/include/GLFW/glfw3native.h" 8 | 9 | // workaround wrappers needed due to a cgo and/or LLVM bug. 10 | // See: https://github.com/go-gl/glfw/issues/136 11 | void *workaround_glfwGetCocoaWindow(GLFWwindow *w) { 12 | return (void *)glfwGetCocoaWindow(w); 13 | } 14 | void *workaround_glfwGetNSGLContext(GLFWwindow *w) { 15 | return (void *)glfwGetNSGLContext(w); 16 | } 17 | */ 18 | import "C" 19 | 20 | func (m *Monitor) GetCocoaMonitor() uintptr { 21 | ret := uintptr(C.glfwGetCocoaMonitor(m.data)) 22 | panicError() 23 | return ret 24 | } 25 | 26 | func (w *Window) GetCocoaWindow() uintptr { 27 | ret := uintptr(C.workaround_glfwGetCocoaWindow(w.data)) 28 | panicError() 29 | return ret 30 | } 31 | 32 | func (w *Window) GetNSGLContext() uintptr { 33 | ret := uintptr(C.workaround_glfwGetNSGLContext(w.data)) 34 | panicError() 35 | return ret 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/COPYING.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002-2006 Marcus Geelnard 2 | Copyright (c) 2006-2016 Camilla Berglund 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely, subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not 13 | claim that you wrote the original software. If you use this software 14 | in a product, an acknowledgment in the product documentation would 15 | be appreciated but is not required. 16 | 17 | 2. Altered source versions must be plainly marked as such, and must not 18 | be misrepresented as being the original software. 19 | 20 | 3. This notice may not be removed or altered from any source 21 | distribution. 22 | 23 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/native_linbsd.go: -------------------------------------------------------------------------------- 1 | // +build linux freebsd 2 | 3 | package glfw 4 | 5 | //#define GLFW_EXPOSE_NATIVE_X11 6 | //#define GLFW_EXPOSE_NATIVE_GLX 7 | //#include "glfw/include/GLFW/glfw3.h" 8 | //#include "glfw/include/GLFW/glfw3native.h" 9 | import "C" 10 | 11 | func GetX11Display() *C.Display { 12 | ret := C.glfwGetX11Display() 13 | panicError() 14 | return ret 15 | } 16 | 17 | func (m *Monitor) GetX11Adapter() C.RRCrtc { 18 | ret := C.glfwGetX11Adapter(m.data) 19 | panicError() 20 | return ret 21 | } 22 | 23 | func (m *Monitor) GetX11Monitor() C.RROutput { 24 | ret := C.glfwGetX11Monitor(m.data) 25 | panicError() 26 | return ret 27 | } 28 | 29 | func (w *Window) GetX11Window() C.Window { 30 | ret := C.glfwGetX11Window(w.data) 31 | panicError() 32 | return ret 33 | } 34 | 35 | func (w *Window) GetGLXContext() C.GLXContext { 36 | ret := C.glfwGetGLXContext(w.data) 37 | panicError() 38 | return ret 39 | } 40 | 41 | func (w *Window) GetGLXWindow() C.GLXWindow { 42 | ret := C.glfwGetGLXWindow(w.data) 43 | panicError() 44 | return ret 45 | } 46 | -------------------------------------------------------------------------------- /tests/test_smoke.py: -------------------------------------------------------------------------------- 1 | import gc 2 | import go_vncdriver 3 | import time 4 | 5 | session = go_vncdriver.VNCSession() 6 | session.connect("conn1", address="172.16.163.128:5900", encoding="tight", subscription=[(0, 100, 0, 100)]) 7 | # session.connect("conn2", address="172.16.163.128:5900", encoding="tight") 8 | 9 | for i in range(10): 10 | session.render("conn1") 11 | observations, infos, errors = session.step({"conn1": [("KeyEvent", 1, 2)]}) 12 | if errors.get("conn1"): 13 | print("error", errors.get("conn1")) 14 | time.sleep(0.2) 15 | 16 | session.update("conn1", [(200, 100, 200, 100), (400, 100, 400, 100)]) 17 | 18 | for i in range(10): 19 | session.render("conn1") 20 | observations, infos, errors = session.step({"conn1": [("KeyEvent", 1, 2)]}) 21 | if errors.get("conn1"): 22 | print("error", errors.get("conn1")) 23 | time.sleep(0.2) 24 | 25 | 26 | # session.close("conn1") 27 | # for i in range(10): 28 | # observations, infos, errors = session.step({"conn2": [("KeyEvent", 1, 2)]}) 29 | # print(observations, infos, errors) 30 | # time.sleep(0.016) 31 | 32 | # session.render("first") 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2017 OpenAI (http://openai.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/gl/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Eric Woroshow 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: trusty 2 | language: python 3 | python: 4 | - "3.5" 5 | before_install: 6 | - which go 7 | - sudo apt-get install python-dev 8 | - sudo bash -c "curl https://storage.googleapis.com/golang/go1.8rc3.linux-amd64.tar.gz | tar -zvx -C /usr/local && ln -s /usr/local/go/bin/go /usr/bin" 9 | - which go 10 | script: "make build test" 11 | 12 | notifications: 13 | slack: 14 | secure: h/Mxm8K+avH/2W0818zCHmLloRPMFN4NJL01+VShvAkH80/acfjeq/+mMdWXXPL/oOB6kSHDk+GDhwR6+s03ZcPMn5INTFvFYqUc6UWmT+NXtOPxGTN0xda6MdYUkWQUKaMyjFrweZQOMOASFBIzPOq4XeVbM5aB8s4EJhnfAcYZhp/idwKbToVihN4KZgxlvZIFc8iEp1o9uSl5qrsaeYYYXRkb6mauacAwOo4/Chu+cOnoLUOnvhBFE3rV3doDNrbnoalO8XiExtgx5CIAYWrlMni7r2Q+LlzgwdyTH19ZtybPxJTZIIWSBQ2UtcoYdIEDcc36GcUwz1VUGg32mLJJnY2xw80CWR4ixFPpLwwP5Y99WTn8v094B4nmFTWOwNWXp3EkqtTN9XcJoRBqXB5ArucIPqrx57dOCljSKx22gL6WaF2p3stSAxIGFektGyGnisaELrFZG1C63aHoUPicj3gUlijmAoUmYaDRf6P1wnpXqBpKDAWWhAMSatvx1ekmEJgR7OQklQnnfjx9kENDUygNUWS4IQwN2qYieuzHFL3of7/30mTM43+Vt/vWN8GI7j01BXu6FNGGloHxjH1pt3bLP/+uj5BJsT2HWF+Z8XR4VE6cyVuKsQAFgCXwOkoDHALbcwsspONDIt/9ixkesgh1oFt4CzU3UuU5wYs= 15 | on_success: change 16 | webhooks: 17 | urls: 18 | - https://hooks.zapier.com/hooks/catch/1711022/6ztmzh/ 19 | - https://hooks.zapier.com/hooks/catch/1711022/6zhc8p/ 20 | on_success: always 21 | on_failure: always 22 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/backend.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013, Örjan Persson. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package logging 6 | 7 | // defaultBackend is the backend used for all logging calls. 8 | var defaultBackend LeveledBackend 9 | 10 | // Backend is the interface which a log backend need to implement to be able to 11 | // be used as a logging backend. 12 | type Backend interface { 13 | Log(Level, int, *Record) error 14 | } 15 | 16 | // SetBackend replaces the backend currently set with the given new logging 17 | // backend. 18 | func SetBackend(backends ...Backend) LeveledBackend { 19 | var backend Backend 20 | if len(backends) == 1 { 21 | backend = backends[0] 22 | } else { 23 | backend = MultiLogger(backends...) 24 | } 25 | 26 | defaultBackend = AddModuleLevel(backend) 27 | return defaultBackend 28 | } 29 | 30 | // SetLevel sets the logging level for the specified module. The module 31 | // corresponds to the string specified in GetLogger. 32 | func SetLevel(level Level, module string) { 33 | defaultBackend.SetLevel(level, module) 34 | } 35 | 36 | // GetLevel returns the logging level for the specified module. 37 | func GetLevel(module string) Level { 38 | return defaultBackend.GetLevel(module) 39 | } 40 | -------------------------------------------------------------------------------- /vncclient/quickbuf.go: -------------------------------------------------------------------------------- 1 | package vncclient 2 | 3 | import ( 4 | "io" 5 | "reflect" 6 | "unsafe" 7 | ) 8 | 9 | type QuickBuf struct { 10 | buf []byte 11 | off int 12 | } 13 | 14 | func (b *QuickBuf) Len() int { return len(b.buf) - b.off } 15 | 16 | func (b *QuickBuf) ReadByte() (byte, error) { 17 | if b.off >= len(b.buf) { 18 | return 0, io.EOF 19 | } 20 | o := b.buf[b.off] 21 | 22 | b.off++ 23 | return o, nil 24 | } 25 | 26 | func (b *QuickBuf) ReadColors(n int) ([]Color, error) { 27 | skip := colorSize * n 28 | if b.off+skip > len(b.buf) { 29 | return nil, io.EOF 30 | } 31 | ptr := unsafe.Pointer(&b.buf[b.off]) 32 | 33 | // raw := b.buf[b.off : b.off+skip] 34 | 35 | // Convert memory into a Color slice without copying 36 | // (https://github.com/golang/go/issues/13656#issuecomment-165618599) 37 | h := reflect.SliceHeader{ 38 | Data: uintptr(ptr), 39 | Len: n, 40 | Cap: n, 41 | } 42 | colors := *(*[]Color)(unsafe.Pointer(&h)) 43 | // colors := (*[(1 << 31) / colorSize]Color)(ptr)[:n:n] 44 | 45 | b.off += skip 46 | return colors, nil 47 | } 48 | 49 | func (b *QuickBuf) ReadColor() (Color, error) { 50 | c := Color{ 51 | R: b.buf[b.off], 52 | G: b.buf[b.off+1], 53 | B: b.buf[b.off+2], 54 | } 55 | b.off += colorSize 56 | return c, nil 57 | } 58 | 59 | func NewQuickBuf(buf []byte) *QuickBuf { return &QuickBuf{buf: buf} } 60 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/build.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | // Windows Build Tags 5 | // ---------------- 6 | // GLFW Options: 7 | #cgo windows CFLAGS: -D_GLFW_WIN32 8 | 9 | // Linker Options: 10 | #cgo windows LDFLAGS: -lopengl32 -lgdi32 11 | 12 | 13 | // Darwin Build Tags 14 | // ---------------- 15 | // GLFW Options: 16 | #cgo darwin CFLAGS: -D_GLFW_COCOA -D_GLFW_USE_CHDIR -D_GLFW_USE_MENUBAR -D_GLFW_USE_RETINA -Wno-deprecated-declarations 17 | 18 | // Linker Options: 19 | #cgo darwin LDFLAGS: -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo 20 | 21 | 22 | // Linux Build Tags 23 | // ---------------- 24 | // GLFW Options: 25 | #cgo linux,!wayland CFLAGS: -D_GLFW_X11 26 | #cgo linux,wayland CFLAGS: -D_GLFW_WAYLAND 27 | 28 | // Linker Options: 29 | #cgo linux,!wayland LDFLAGS: -lGL -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lm -lXinerama -ldl -lrt 30 | #cgo linux,wayland LDFLAGS: -lGL -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lm -lXinerama -ldl -lrt 31 | 32 | 33 | // FreeBSD Build Tags 34 | // ---------------- 35 | // GLFW Options: 36 | #cgo freebsd,!wayland CFLAGS: -D_GLFW_X11 -D_GLFW_HAS_GLXGETPROCADDRESSARB -D_GLFW_HAS_DLOPEN 37 | #cgo freebsd,wayland CFLAGS: -D_GLFW_WAYLAND -D_GLFW_HAS_DLOPEN 38 | 39 | // Linker Options: 40 | #cgo freebsd,!wayland LDFLAGS: -lGL -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lm -lXinerama 41 | #cgo freebsd,wayland LDFLAGS: -lGL -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lm -lXinerama 42 | */ 43 | import "C" 44 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/time.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#include "glfw/include/GLFW/glfw3.h" 4 | import "C" 5 | 6 | // GetTime returns the value of the GLFW timer. Unless the timer has been set 7 | // using SetTime, the timer measures time elapsed since GLFW was initialized. 8 | // 9 | // The resolution of the timer is system dependent, but is usually on the order 10 | // of a few micro- or nanoseconds. It uses the highest-resolution monotonic time 11 | // source on each supported platform. 12 | func GetTime() float64 { 13 | ret := float64(C.glfwGetTime()) 14 | panicError() 15 | return ret 16 | } 17 | 18 | // SetTime sets the value of the GLFW timer. It then continues to count up from 19 | // that value. 20 | // 21 | // The resolution of the timer is system dependent, but is usually on the order 22 | // of a few micro- or nanoseconds. It uses the highest-resolution monotonic time 23 | // source on each supported platform. 24 | func SetTime(time float64) { 25 | C.glfwSetTime(C.double(time)) 26 | panicError() 27 | } 28 | 29 | // GetTimerFrequency returns frequency of the timer, in Hz, or zero if an error occurred. 30 | func GetTimerFrequency() uint64 { 31 | ret := uint64(C.glfwGetTimerFrequency()) 32 | panicError() 33 | return ret 34 | } 35 | 36 | // GetTimerValue returns the current value of the raw timer, measured in 1 / frequency seconds. 37 | func GetTimerValue() uint64 { 38 | ret := uint64(C.glfwGetTimerValue()) 39 | panicError() 40 | return ret 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/xkb_unicode.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 Linux - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2014 Jonas Ådahl 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_xkb_unicode_h_ 28 | #define _glfw3_xkb_unicode_h_ 29 | 30 | 31 | long _glfwKeySym2Unicode(unsigned int keysym); 32 | 33 | #endif // _glfw3_xkb_unicode_h_ 34 | -------------------------------------------------------------------------------- /vendor/github.com/cheggaaa/pb/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2015, Sergey Cherepanov 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | 8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 9 | 10 | * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 11 | 12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /flexflate/copy_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package flexflate 6 | 7 | import ( 8 | "testing" 9 | ) 10 | 11 | func TestForwardCopy(t *testing.T) { 12 | testCases := []struct { 13 | dst0, dst1 int 14 | src0, src1 int 15 | want string 16 | }{ 17 | {0, 9, 0, 9, "012345678"}, 18 | {0, 5, 4, 9, "45678"}, 19 | {4, 9, 0, 5, "01230"}, 20 | {1, 6, 3, 8, "34567"}, 21 | {3, 8, 1, 6, "12121"}, 22 | {0, 9, 3, 6, "345"}, 23 | {3, 6, 0, 9, "012"}, 24 | {1, 6, 0, 9, "00000"}, 25 | {0, 4, 7, 8, "7"}, 26 | {0, 1, 6, 8, "6"}, 27 | {4, 4, 6, 9, ""}, 28 | {2, 8, 6, 6, ""}, 29 | {0, 0, 0, 0, ""}, 30 | } 31 | for _, tc := range testCases { 32 | b := []byte("0123456789") 33 | n := tc.dst1 - tc.dst0 34 | if tc.src1-tc.src0 < n { 35 | n = tc.src1 - tc.src0 36 | } 37 | forwardCopy(b, tc.dst0, tc.src0, n) 38 | got := string(b[tc.dst0 : tc.dst0+n]) 39 | if got != tc.want { 40 | t.Errorf("dst=b[%d:%d], src=b[%d:%d]: got %q, want %q", 41 | tc.dst0, tc.dst1, tc.src0, tc.src1, got, tc.want) 42 | } 43 | // Check that the bytes outside of dst[:n] were not modified. 44 | for i, x := range b { 45 | if i >= tc.dst0 && i < tc.dst0+n { 46 | continue 47 | } 48 | if int(x) != '0'+i { 49 | t.Errorf("dst=b[%d:%d], src=b[%d:%d]: copy overrun at b[%d]: got '%c', want '%c'", 50 | tc.dst0, tc.dst1, tc.src0, tc.src1, i, x, '0'+i) 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Godeps/Godeps.json: -------------------------------------------------------------------------------- 1 | { 2 | "ImportPath": "github.com/openai/universe/go-vncdriver", 3 | "GoVersion": "go1.6", 4 | "GodepVersion": "v75", 5 | "Packages": [ 6 | "./..." 7 | ], 8 | "Deps": [ 9 | { 10 | "ImportPath": "github.com/cheggaaa/pb", 11 | "Comment": "v1.0.6", 12 | "Rev": "dd61faab99a777c652bb680e37715fe0cb549856" 13 | }, 14 | { 15 | "ImportPath": "github.com/go-gl/gl/v2.1/gl", 16 | "Rev": "cd1cf4a9b229045e8a41d5945fc597617e8bae4f" 17 | }, 18 | { 19 | "ImportPath": "github.com/go-gl/glfw/v3.2/glfw", 20 | "Rev": "82775019c87191e4eebfb7d046d44e71a58ea21d" 21 | }, 22 | { 23 | "ImportPath": "github.com/juju/errors", 24 | "Rev": "4567a5e69fd3130ca0d89f69478e7ac025b67452" 25 | }, 26 | { 27 | "ImportPath": "github.com/op/go-logging", 28 | "Comment": "v1-7-g970db52", 29 | "Rev": "970db520ece77730c7e4724c61121037378659d9" 30 | }, 31 | { 32 | "ImportPath": "github.com/pixiv/go-libjpeg/example/decoder", 33 | "Comment": "v0.1-49-g511e95d", 34 | "Rev": "511e95d51610f96479307fcf5f662068f33662d9" 35 | }, 36 | { 37 | "ImportPath": "github.com/pixiv/go-libjpeg/jpeg", 38 | "Comment": "v0.1-49-g511e95d", 39 | "Rev": "511e95d51610f96479307fcf5f662068f33662d9" 40 | }, 41 | { 42 | "ImportPath": "github.com/pixiv/go-libjpeg/rgb", 43 | "Comment": "v0.1-49-g511e95d", 44 | "Rev": "511e95d51610f96479307fcf5f662068f33662d9" 45 | }, 46 | { 47 | "ImportPath": "github.com/pixiv/go-libjpeg/test/util", 48 | "Comment": "v0.1-49-g511e95d", 49 | "Rev": "511e95d51610f96479307fcf5f662068f33662d9" 50 | } 51 | ] 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Örjan Persson. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 pixiv Inc. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of pixiv Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 The glfw3-go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/cheggaaa/pb/pool.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin freebsd netbsd openbsd solaris dragonfly windows 2 | 3 | package pb 4 | 5 | import ( 6 | "sync" 7 | "time" 8 | ) 9 | 10 | // Create and start new pool with given bars 11 | // You need call pool.Stop() after work 12 | func StartPool(pbs ...*ProgressBar) (pool *Pool, err error) { 13 | pool = new(Pool) 14 | if err = pool.start(); err != nil { 15 | return 16 | } 17 | pool.Add(pbs...) 18 | return 19 | } 20 | 21 | type Pool struct { 22 | RefreshRate time.Duration 23 | bars []*ProgressBar 24 | quit chan int 25 | finishOnce sync.Once 26 | } 27 | 28 | // Add progress bars. 29 | func (p *Pool) Add(pbs ...*ProgressBar) { 30 | for _, bar := range pbs { 31 | bar.ManualUpdate = true 32 | bar.NotPrint = true 33 | bar.Start() 34 | p.bars = append(p.bars, bar) 35 | } 36 | } 37 | 38 | func (p *Pool) start() (err error) { 39 | p.RefreshRate = DefaultRefreshRate 40 | quit, err := lockEcho() 41 | if err != nil { 42 | return 43 | } 44 | p.quit = make(chan int) 45 | go p.writer(quit) 46 | return 47 | } 48 | 49 | func (p *Pool) writer(finish chan int) { 50 | var first = true 51 | for { 52 | select { 53 | case <-time.After(p.RefreshRate): 54 | if p.print(first) { 55 | p.print(false) 56 | finish <- 1 57 | return 58 | } 59 | first = false 60 | case <-p.quit: 61 | finish <- 1 62 | return 63 | } 64 | } 65 | } 66 | 67 | // Restore terminal state and close pool 68 | func (p *Pool) Stop() error { 69 | // Wait until one final refresh has passed. 70 | time.Sleep(p.RefreshRate) 71 | 72 | p.finishOnce.Do(func() { 73 | close(p.quit) 74 | }) 75 | return unlockEcho() 76 | } 77 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/window.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | void glfwWindowPosCB(GLFWwindow* window, int xpos, int ypos) { 4 | goWindowPosCB(window, xpos, ypos); 5 | } 6 | 7 | void glfwWindowSizeCB(GLFWwindow* window, int width, int height) { 8 | goWindowSizeCB(window, width, height); 9 | } 10 | 11 | void glfwFramebufferSizeCB(GLFWwindow* window, int width, int height) { 12 | goFramebufferSizeCB(window, width, height); 13 | } 14 | 15 | void glfwWindowCloseCB(GLFWwindow* window) { 16 | goWindowCloseCB(window); 17 | } 18 | 19 | void glfwWindowRefreshCB(GLFWwindow* window) { 20 | goWindowRefreshCB(window); 21 | } 22 | 23 | void glfwWindowFocusCB(GLFWwindow* window, int focused) { 24 | goWindowFocusCB(window, focused); 25 | } 26 | 27 | void glfwWindowIconifyCB(GLFWwindow* window, int iconified) { 28 | goWindowIconifyCB(window, iconified); 29 | } 30 | 31 | void glfwSetWindowPosCallbackCB(GLFWwindow* window) { 32 | glfwSetWindowPosCallback(window, glfwWindowPosCB); 33 | } 34 | 35 | void glfwSetWindowSizeCallbackCB(GLFWwindow* window) { 36 | glfwSetWindowSizeCallback(window, glfwWindowSizeCB); 37 | } 38 | 39 | void glfwSetFramebufferSizeCallbackCB(GLFWwindow* window) { 40 | glfwSetFramebufferSizeCallback(window, glfwFramebufferSizeCB); 41 | } 42 | 43 | void glfwSetWindowCloseCallbackCB(GLFWwindow* window) { 44 | glfwSetWindowCloseCallback(window, glfwWindowCloseCB); 45 | } 46 | 47 | void glfwSetWindowRefreshCallbackCB(GLFWwindow* window) { 48 | glfwSetWindowRefreshCallback(window, glfwWindowRefreshCB); 49 | } 50 | 51 | void glfwSetWindowFocusCallbackCB(GLFWwindow* window) { 52 | glfwSetWindowFocusCallback(window, glfwWindowFocusCB); 53 | } 54 | 55 | void glfwSetWindowIconifyCallbackCB(GLFWwindow* window) { 56 | glfwSetWindowIconifyCallback(window, glfwWindowIconifyCB); 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/syslog.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013, Örjan Persson. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //+build !windows,!plan9 6 | 7 | package logging 8 | 9 | import "log/syslog" 10 | 11 | // SyslogBackend is a simple logger to syslog backend. It automatically maps 12 | // the internal log levels to appropriate syslog log levels. 13 | type SyslogBackend struct { 14 | Writer *syslog.Writer 15 | } 16 | 17 | // NewSyslogBackend connects to the syslog daemon using UNIX sockets with the 18 | // given prefix. If prefix is not given, the prefix will be derived from the 19 | // launched command. 20 | func NewSyslogBackend(prefix string) (b *SyslogBackend, err error) { 21 | var w *syslog.Writer 22 | w, err = syslog.New(syslog.LOG_CRIT, prefix) 23 | return &SyslogBackend{w}, err 24 | } 25 | 26 | // NewSyslogBackendPriority is the same as NewSyslogBackend, but with custom 27 | // syslog priority, like syslog.LOG_LOCAL3|syslog.LOG_DEBUG etc. 28 | func NewSyslogBackendPriority(prefix string, priority syslog.Priority) (b *SyslogBackend, err error) { 29 | var w *syslog.Writer 30 | w, err = syslog.New(priority, prefix) 31 | return &SyslogBackend{w}, err 32 | } 33 | 34 | // Log implements the Backend interface. 35 | func (b *SyslogBackend) Log(level Level, calldepth int, rec *Record) error { 36 | line := rec.Formatted(calldepth + 1) 37 | switch level { 38 | case CRITICAL: 39 | return b.Writer.Crit(line) 40 | case ERROR: 41 | return b.Writer.Err(line) 42 | case WARNING: 43 | return b.Writer.Warning(line) 44 | case NOTICE: 45 | return b.Writer.Notice(line) 46 | case INFO: 47 | return b.Writer.Info(line) 48 | case DEBUG: 49 | return b.Writer.Debug(line) 50 | default: 51 | } 52 | panic("unhandled log level") 53 | } 54 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/posix_time.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2016 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #ifndef _glfw3_posix_time_h_ 29 | #define _glfw3_posix_time_h_ 30 | 31 | #define _GLFW_PLATFORM_LIBRARY_TIME_STATE _GLFWtimePOSIX posix_time 32 | 33 | #include 34 | 35 | 36 | // POSIX-specific global timer data 37 | // 38 | typedef struct _GLFWtimePOSIX 39 | { 40 | GLFWbool monotonic; 41 | uint64_t frequency; 42 | 43 | } _GLFWtimePOSIX; 44 | 45 | 46 | void _glfwInitTimerPOSIX(void); 47 | 48 | #endif // _glfw3_posix_time_h_ 49 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/posix_tls.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2016 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #ifndef _glfw3_posix_tls_h_ 29 | #define _glfw3_posix_tls_h_ 30 | 31 | #include 32 | 33 | #define _GLFW_PLATFORM_LIBRARY_TLS_STATE _GLFWtlsPOSIX posix_tls 34 | 35 | 36 | // POSIX-specific global TLS data 37 | // 38 | typedef struct _GLFWtlsPOSIX 39 | { 40 | GLFWbool allocated; 41 | pthread_key_t context; 42 | 43 | } _GLFWtlsPOSIX; 44 | 45 | 46 | GLFWbool _glfwInitThreadLocalStoragePOSIX(void); 47 | void _glfwTerminateThreadLocalStoragePOSIX(void); 48 | 49 | #endif // _glfw3_posix_tls_h_ 50 | -------------------------------------------------------------------------------- /cmd/simplevnc/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | "os" 6 | "runtime/pprof" 7 | "time" 8 | 9 | "github.com/openai/go-vncdriver/gymvnc" 10 | ) 11 | import _ "net/http/pprof" 12 | 13 | type foo struct { 14 | bar string 15 | } 16 | 17 | func main() { 18 | f, err := os.Create("/tmp/profile-tight.pprof") 19 | if err != nil { 20 | panic(err) 21 | } 22 | pprof.StartCPUProfile(f) 23 | defer pprof.StopCPUProfile() 24 | 25 | gymvnc.ConfigureLogging() 26 | 27 | batch := gymvnc.NewVNCBatch() 28 | err = batch.Open("conn", gymvnc.VNCSessionConfig{ 29 | // Address: "127.0.0.1:5900", 30 | Address: "3.public-devbox.sci.openai-tech.com:20000", 31 | Password: "openai", 32 | Encoding: "tight", 33 | FineQualityLevel: 100, 34 | }) 35 | if err != nil { 36 | panic(err) 37 | } 38 | 39 | start := time.Now() 40 | updates := 0 41 | errs := 0 42 | for i := 0; i < 200000; i++ { 43 | elapsed := time.Now().Sub(start) 44 | if elapsed >= time.Duration(1)*time.Second { 45 | delta := float64(elapsed / time.Second) 46 | log.Printf("Received: updates=%.2f errs=%.2f", float64(updates)/delta, float64(errs)/delta) 47 | 48 | start = time.Now() 49 | updates = 0 50 | errs = 0 51 | } 52 | 53 | batchEvents := map[string][]gymvnc.VNCEvent{ 54 | "conn": []gymvnc.VNCEvent{}, 55 | } 56 | _, updatesN, errN := batch.Step(batchEvents) 57 | if errN["conn"] != nil { 58 | log.Fatalf("error: %+v", errN["conn"]) 59 | } 60 | 61 | updates += len(updatesN["conn"]) 62 | time.Sleep(16 * time.Millisecond) 63 | } 64 | 65 | // f, err := os.Create("/tmp/hi.prof") 66 | // if err != nil { 67 | // log.Fatal("could not create memory profile: ", err) 68 | // } 69 | // runtime.GC() // get up-to-date statistics 70 | // if err := pprof.WriteHeapProfile(f); err != nil { 71 | // log.Fatal("could not write memory profile: ", err) 72 | // } 73 | // f.Close() 74 | } 75 | -------------------------------------------------------------------------------- /flexflate/flate_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // This test tests some internals of the flate package. 6 | // The tests in package compress/gzip serve as the 7 | // end-to-end test of the decompressor. 8 | 9 | package flexflate 10 | 11 | import ( 12 | "bytes" 13 | "testing" 14 | ) 15 | 16 | func TestUncompressedSource(t *testing.T) { 17 | decoder := NewReader(bytes.NewReader([]byte{0x01, 0x01, 0x00, 0xfe, 0xff, 0x11})) 18 | output := make([]byte, 1) 19 | n, error := decoder.Read(output) 20 | if n != 1 || error != nil { 21 | t.Fatalf("decoder.Read() = %d, %v, want 1, nil", n, error) 22 | } 23 | if output[0] != 0x11 { 24 | t.Errorf("output[0] = %x, want 0x11", output[0]) 25 | } 26 | } 27 | 28 | // The following test should not panic. 29 | func TestIssue5915(t *testing.T) { 30 | bits := []int{4, 0, 0, 6, 4, 3, 2, 3, 3, 4, 4, 5, 0, 0, 0, 0, 5, 5, 6, 31 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 6, 0, 11, 0, 8, 0, 6, 6, 10, 8} 33 | h := new(huffmanDecoder) 34 | ok := h.init(bits) 35 | if ok == true { 36 | t.Fatalf("Given sequence of bits is bad, and should not succeed.") 37 | } 38 | } 39 | 40 | // The following test should not panic. 41 | func TestIssue5962(t *testing.T) { 42 | bits := []int{4, 0, 0, 6, 4, 3, 2, 3, 3, 4, 4, 5, 0, 0, 0, 0, 43 | 5, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11} 44 | h := new(huffmanDecoder) 45 | ok := h.init(bits) 46 | if ok == true { 47 | t.Fatalf("Given sequence of bits is bad, and should not succeed.") 48 | } 49 | } 50 | 51 | // The following test should not panic. 52 | func TestIssue6255(t *testing.T) { 53 | bits1 := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11} 54 | bits2 := []int{11, 13} 55 | h := new(huffmanDecoder) 56 | if !h.init(bits1) { 57 | t.Fatalf("Given sequence of bits is good and should succeed.") 58 | } 59 | if h.init(bits2) { 60 | t.Fatalf("Given sequence of bits is bad and should not succeed.") 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/gl/v2.1/gl/procaddr.go: -------------------------------------------------------------------------------- 1 | // This file implements GlowGetProcAddress for every supported platform. The 2 | // correct version is chosen automatically based on build tags: 3 | // windows: WGL 4 | // darwin: CGL 5 | // linux: GLX 6 | // Use of EGL instead of the platform's default (listed above) is made possible 7 | // via the "egl" build tag. 8 | // It is also possible to install your own function outside this package for 9 | // retrieving OpenGL function pointers, to do this see InitWithProcAddrFunc. 10 | package gl 11 | 12 | /* 13 | #cgo windows CFLAGS: -DTAG_WINDOWS 14 | #cgo windows LDFLAGS: -lopengl32 15 | #cgo darwin CFLAGS: -DTAG_DARWIN 16 | #cgo darwin LDFLAGS: -framework OpenGL 17 | #cgo linux CFLAGS: -DTAG_LINUX 18 | #cgo linux LDFLAGS: -lGL 19 | #cgo egl CFLAGS: -DTAG_EGL 20 | #cgo egl LDFLAGS: -lEGL 21 | // Check the EGL tag first as it takes priority over the platform's default 22 | // configuration of WGL/GLX/CGL. 23 | #if defined(TAG_EGL) 24 | #include 25 | #include 26 | void* GlowGetProcAddress(const char* name) { 27 | return eglGetProcAddress(name); 28 | } 29 | #elif defined(TAG_WINDOWS) 30 | #define WIN32_LEAN_AND_MEAN 1 31 | #include 32 | #include 33 | static HMODULE ogl32dll = NULL; 34 | void* GlowGetProcAddress(const char* name) { 35 | void* pf = wglGetProcAddress((LPCSTR) name); 36 | if (pf) { 37 | return pf; 38 | } 39 | if (ogl32dll == NULL) { 40 | ogl32dll = LoadLibraryA("opengl32.dll"); 41 | } 42 | return GetProcAddress(ogl32dll, (LPCSTR) name); 43 | } 44 | #elif defined(TAG_DARWIN) 45 | #include 46 | #include 47 | void* GlowGetProcAddress(const char* name) { 48 | return dlsym(RTLD_DEFAULT, name); 49 | } 50 | #elif defined(TAG_LINUX) 51 | #include 52 | #include 53 | void* GlowGetProcAddress(const char* name) { 54 | return glXGetProcAddress(name); 55 | } 56 | #endif 57 | */ 58 | import "C" 59 | import "unsafe" 60 | 61 | func getProcAddress(namea string) unsafe.Pointer { 62 | cname := C.CString(namea) 63 | defer C.free(unsafe.Pointer(cname)) 64 | return C.GlowGetProcAddress(cname) 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/cheggaaa/pb/format.go: -------------------------------------------------------------------------------- 1 | package pb 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | "time" 7 | ) 8 | 9 | type Units int 10 | 11 | const ( 12 | // U_NO are default units, they represent a simple value and are not formatted at all. 13 | U_NO Units = iota 14 | // U_BYTES units are formatted in a human readable way (b, Bb, Mb, ...) 15 | U_BYTES 16 | // U_DURATION units are formatted in a human readable way (3h14m15s) 17 | U_DURATION 18 | ) 19 | 20 | func Format(i int64) *formatter { 21 | return &formatter{n: i} 22 | } 23 | 24 | type formatter struct { 25 | n int64 26 | unit Units 27 | width int 28 | perSec bool 29 | } 30 | 31 | func (f *formatter) Value(n int64) *formatter { 32 | f.n = n 33 | return f 34 | } 35 | 36 | func (f *formatter) To(unit Units) *formatter { 37 | f.unit = unit 38 | return f 39 | } 40 | 41 | func (f *formatter) Width(width int) *formatter { 42 | f.width = width 43 | return f 44 | } 45 | 46 | func (f *formatter) PerSec() *formatter { 47 | f.perSec = true 48 | return f 49 | } 50 | 51 | func (f *formatter) String() (out string) { 52 | switch f.unit { 53 | case U_BYTES: 54 | out = formatBytes(f.n) 55 | case U_DURATION: 56 | d := time.Duration(f.n) 57 | if d > time.Hour*24 { 58 | out = fmt.Sprintf("%dd", d/24/time.Hour) 59 | d -= (d / time.Hour / 24) * (time.Hour * 24) 60 | } 61 | out = fmt.Sprintf("%s%v", out, d) 62 | default: 63 | out = fmt.Sprintf(fmt.Sprintf("%%%dd", f.width), f.n) 64 | } 65 | if f.perSec { 66 | out += "/s" 67 | } 68 | return 69 | } 70 | 71 | // Convert bytes to human readable string. Like a 2 MB, 64.2 KB, 52 B 72 | func formatBytes(i int64) (result string) { 73 | switch { 74 | case i > (1024 * 1024 * 1024 * 1024): 75 | result = fmt.Sprintf("%.02f TB", float64(i)/1024/1024/1024/1024) 76 | case i > (1024 * 1024 * 1024): 77 | result = fmt.Sprintf("%.02f GB", float64(i)/1024/1024/1024) 78 | case i > (1024 * 1024): 79 | result = fmt.Sprintf("%.02f MB", float64(i)/1024/1024) 80 | case i > 1024: 81 | result = fmt.Sprintf("%.02f KB", float64(i)/1024) 82 | default: 83 | result = fmt.Sprintf("%d B", i) 84 | } 85 | result = strings.Trim(result, " ") 86 | return 87 | } 88 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/multi.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013, Örjan Persson. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package logging 6 | 7 | // TODO remove Level stuff from the multi logger. Do one thing. 8 | 9 | // multiLogger is a log multiplexer which can be used to utilize multiple log 10 | // backends at once. 11 | type multiLogger struct { 12 | backends []LeveledBackend 13 | } 14 | 15 | // MultiLogger creates a logger which contain multiple loggers. 16 | func MultiLogger(backends ...Backend) LeveledBackend { 17 | var leveledBackends []LeveledBackend 18 | for _, backend := range backends { 19 | leveledBackends = append(leveledBackends, AddModuleLevel(backend)) 20 | } 21 | return &multiLogger{leveledBackends} 22 | } 23 | 24 | // Log passes the log record to all backends. 25 | func (b *multiLogger) Log(level Level, calldepth int, rec *Record) (err error) { 26 | for _, backend := range b.backends { 27 | if backend.IsEnabledFor(level, rec.Module) { 28 | // Shallow copy of the record for the formatted cache on Record and get the 29 | // record formatter from the backend. 30 | r2 := *rec 31 | if e := backend.Log(level, calldepth+1, &r2); e != nil { 32 | err = e 33 | } 34 | } 35 | } 36 | return 37 | } 38 | 39 | // GetLevel returns the highest level enabled by all backends. 40 | func (b *multiLogger) GetLevel(module string) Level { 41 | var level Level 42 | for _, backend := range b.backends { 43 | if backendLevel := backend.GetLevel(module); backendLevel > level { 44 | level = backendLevel 45 | } 46 | } 47 | return level 48 | } 49 | 50 | // SetLevel propagates the same level to all backends. 51 | func (b *multiLogger) SetLevel(level Level, module string) { 52 | for _, backend := range b.backends { 53 | backend.SetLevel(level, module) 54 | } 55 | } 56 | 57 | // IsEnabledFor returns true if any of the backends are enabled for it. 58 | func (b *multiLogger) IsEnabledFor(level Level, module string) bool { 59 | for _, backend := range b.backends { 60 | if backend.IsEnabledFor(level, module) { 61 | return true 62 | } 63 | } 64 | return false 65 | } 66 | -------------------------------------------------------------------------------- /flexflate/reverse_bits.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package flexflate 6 | 7 | var reverseByte = [256]byte{ 8 | 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 9 | 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 10 | 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 11 | 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 12 | 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 13 | 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, 14 | 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 15 | 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 16 | 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 17 | 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 18 | 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 19 | 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 20 | 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 21 | 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, 22 | 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 23 | 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, 24 | 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 25 | 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, 26 | 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 27 | 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 28 | 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 29 | 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 30 | 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 31 | 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 32 | 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 33 | 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, 34 | 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 35 | 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 36 | 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 37 | 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 38 | 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 39 | 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff, 40 | } 41 | 42 | func reverseUint16(v uint16) uint16 { 43 | return uint16(reverseByte[v>>8]) | uint16(reverseByte[v&0xFF])<<8 44 | } 45 | 46 | func reverseBits(number uint16, bitLength byte) uint16 { 47 | return reverseUint16(number << uint8(16-bitLength)) 48 | } 49 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/cocoa_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 Cocoa - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2006-2016 Camilla Berglund 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_cocoa_joystick_h_ 28 | #define _glfw3_cocoa_joystick_h_ 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \ 36 | _GLFWjoystickNS ns_js[GLFW_JOYSTICK_LAST + 1] 37 | 38 | 39 | // Cocoa-specific per-joystick data 40 | // 41 | typedef struct _GLFWjoystickNS 42 | { 43 | GLFWbool present; 44 | char name[256]; 45 | 46 | IOHIDDeviceRef deviceRef; 47 | 48 | CFMutableArrayRef axisElements; 49 | CFMutableArrayRef buttonElements; 50 | CFMutableArrayRef hatElements; 51 | 52 | float* axes; 53 | unsigned char* buttons; 54 | } _GLFWjoystickNS; 55 | 56 | 57 | void _glfwInitJoysticksNS(void); 58 | void _glfwTerminateJoysticksNS(void); 59 | 60 | #endif // _glfw3_cocoa_joystick_h_ 61 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/rgb/rgb.go: -------------------------------------------------------------------------------- 1 | // Package rgb provides RGB image which implements image.Image interface. 2 | package rgb 3 | 4 | import ( 5 | "image" 6 | "image/color" 7 | ) 8 | 9 | // Image represent image data which has RGB colors. 10 | // Image is compatible with image.RGBA, but does not have alpha channel to reduce using memory. 11 | type Image struct { 12 | // Pix holds the image's stream, in R, G, B order. 13 | Pix []uint8 14 | // Stride is the Pix stride (in bytes) between vertically adjacent pixels. 15 | Stride int 16 | // Rect is the image's bounds. 17 | Rect image.Rectangle 18 | } 19 | 20 | // NewImage allocates and returns RGB image 21 | func NewImage(r image.Rectangle) *Image { 22 | w, h := r.Dx(), r.Dy() 23 | return &Image{Pix: make([]uint8, 3*w*h), Stride: 3 * w, Rect: r} 24 | } 25 | 26 | // ColorModel returns RGB color model. 27 | func (p *Image) ColorModel() color.Model { 28 | return ColorModel 29 | } 30 | 31 | // Bounds implements image.Image.At 32 | func (p *Image) Bounds() image.Rectangle { 33 | return p.Rect 34 | } 35 | 36 | // At implements image.Image.At 37 | func (p *Image) At(x, y int) color.Color { 38 | return p.RGBAAt(x, y) 39 | } 40 | 41 | // RGBAAt returns the color of the pixel at (x, y) as RGBA. 42 | func (p *Image) RGBAAt(x, y int) color.RGBA { 43 | if !(image.Point{x, y}.In(p.Rect)) { 44 | return color.RGBA{} 45 | } 46 | i := (y-p.Rect.Min.Y)*p.Stride + (x-p.Rect.Min.X)*3 47 | return color.RGBA{p.Pix[i+0], p.Pix[i+1], p.Pix[i+2], 0xFF} 48 | } 49 | 50 | // ColorModel is RGB color model instance 51 | var ColorModel = color.ModelFunc(rgbModel) 52 | 53 | func rgbModel(c color.Color) color.Color { 54 | if _, ok := c.(RGB); ok { 55 | return c 56 | } 57 | r, g, b, _ := c.RGBA() 58 | return RGB{uint8(r >> 8), uint8(g >> 8), uint8(b >> 8)} 59 | } 60 | 61 | // RGB color 62 | type RGB struct { 63 | R, G, B uint8 64 | } 65 | 66 | // RGBA implements Color.RGBA 67 | func (c RGB) RGBA() (r, g, b, a uint32) { 68 | r = uint32(c.R) 69 | r |= r << 8 70 | g = uint32(c.G) 71 | g |= g << 8 72 | b = uint32(c.B) 73 | b |= b << 8 74 | a = uint32(0xFFFF) 75 | return 76 | } 77 | 78 | // Make sure Image implements image.Image. 79 | // See https://golang.org/doc/effective_go.html#blank_implements. 80 | var _ image.Image = new(Image) 81 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/cocoa_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 OS X - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2009-2016 Camilla Berglund 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #include "internal.h" 28 | 29 | #include 30 | 31 | 32 | ////////////////////////////////////////////////////////////////////////// 33 | ////// GLFW internal API ////// 34 | ////////////////////////////////////////////////////////////////////////// 35 | 36 | // Initialise timer 37 | // 38 | void _glfwInitTimerNS(void) 39 | { 40 | mach_timebase_info_data_t info; 41 | mach_timebase_info(&info); 42 | 43 | _glfw.ns_time.frequency = (info.denom * 1e9) / info.numer; 44 | } 45 | 46 | 47 | ////////////////////////////////////////////////////////////////////////// 48 | ////// GLFW platform API ////// 49 | ////////////////////////////////////////////////////////////////////////// 50 | 51 | uint64_t _glfwPlatformGetTimerValue(void) 52 | { 53 | return mach_absolute_time(); 54 | } 55 | 56 | uint64_t _glfwPlatformGetTimerFrequency(void) 57 | { 58 | return _glfw.ns_time.frequency; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/nsgl_context.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 OS X - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2009-2016 Camilla Berglund 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_nsgl_context_h_ 28 | #define _glfw3_nsgl_context_h_ 29 | 30 | #define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextNSGL nsgl 31 | #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryNSGL nsgl 32 | 33 | 34 | // NSGL-specific per-context data 35 | // 36 | typedef struct _GLFWcontextNSGL 37 | { 38 | id pixelFormat; 39 | id object; 40 | 41 | } _GLFWcontextNSGL; 42 | 43 | // NSGL-specific global data 44 | // 45 | typedef struct _GLFWlibraryNSGL 46 | { 47 | // dlopen handle for OpenGL.framework (for glfwGetProcAddress) 48 | CFBundleRef framework; 49 | 50 | } _GLFWlibraryNSGL; 51 | 52 | 53 | GLFWbool _glfwInitNSGL(void); 54 | void _glfwTerminateNSGL(void); 55 | GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window, 56 | const _GLFWctxconfig* ctxconfig, 57 | const _GLFWfbconfig* fbconfig); 58 | void _glfwDestroyContextNSGL(_GLFWwindow* window); 59 | 60 | #endif // _glfw3_nsgl_context_h_ 61 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/deps/getopt.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, Kim Gräsman 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * * Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * * Neither the name of Kim Gräsman nor the names of contributors may be used 12 | * to endorse or promote products derived from this software without specific 13 | * prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL KIM GRÄSMAN BE LIABLE FOR ANY DIRECT, 19 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef INCLUDED_GETOPT_PORT_H 28 | #define INCLUDED_GETOPT_PORT_H 29 | 30 | #if defined(__cplusplus) 31 | extern "C" { 32 | #endif 33 | 34 | extern const int no_argument; 35 | extern const int required_argument; 36 | extern const int optional_argument; 37 | 38 | extern char* optarg; 39 | extern int optind, opterr, optopt; 40 | 41 | struct option { 42 | const char* name; 43 | int has_arg; 44 | int* flag; 45 | int val; 46 | }; 47 | 48 | int getopt(int argc, char* const argv[], const char* optstring); 49 | 50 | int getopt_long(int argc, char* const argv[], 51 | const char* optstring, const struct option* longopts, int* longindex); 52 | 53 | #if defined(__cplusplus) 54 | } 55 | #endif 56 | 57 | #endif // INCLUDED_GETOPT_PORT_H 58 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/input.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | void glfwJoystickCB(int joy, int event) { 4 | goJoystickCB(joy, event); 5 | } 6 | 7 | void glfwMouseButtonCB(GLFWwindow* window, int button, int action, int mods) { 8 | goMouseButtonCB(window, button, action, mods); 9 | } 10 | 11 | void glfwCursorPosCB(GLFWwindow* window, double xpos, double ypos) { 12 | goCursorPosCB(window, xpos, ypos); 13 | } 14 | 15 | void glfwCursorEnterCB(GLFWwindow* window, int entered) { 16 | goCursorEnterCB(window, entered); 17 | } 18 | 19 | void glfwScrollCB(GLFWwindow* window, double xoff, double yoff) { 20 | goScrollCB(window, xoff, yoff); 21 | } 22 | 23 | void glfwKeyCB(GLFWwindow* window, int key, int scancode, int action, int mods) { 24 | goKeyCB(window, key, scancode, action, mods); 25 | } 26 | 27 | void glfwCharCB(GLFWwindow* window, unsigned int character) { 28 | goCharCB(window, character); 29 | } 30 | 31 | void glfwCharModsCB(GLFWwindow* window, unsigned int character, int mods) { 32 | goCharModsCB(window, character, mods); 33 | } 34 | 35 | void glfwDropCB(GLFWwindow* window, int count, const char **names) { 36 | goDropCB(window, count, (char**)names); 37 | } 38 | 39 | void glfwSetJoystickCallbackCB() { 40 | glfwSetJoystickCallback(glfwJoystickCB); 41 | } 42 | 43 | void glfwSetKeyCallbackCB(GLFWwindow *window) { 44 | glfwSetKeyCallback(window, glfwKeyCB); 45 | } 46 | 47 | void glfwSetCharCallbackCB(GLFWwindow *window) { 48 | glfwSetCharCallback(window, glfwCharCB); 49 | } 50 | 51 | void glfwSetCharModsCallbackCB(GLFWwindow *window) { 52 | glfwSetCharModsCallback(window, glfwCharModsCB); 53 | } 54 | 55 | void glfwSetMouseButtonCallbackCB(GLFWwindow *window) { 56 | glfwSetMouseButtonCallback(window, glfwMouseButtonCB); 57 | } 58 | 59 | void glfwSetCursorPosCallbackCB(GLFWwindow *window) { 60 | glfwSetCursorPosCallback(window, glfwCursorPosCB); 61 | } 62 | 63 | void glfwSetCursorEnterCallbackCB(GLFWwindow *window) { 64 | glfwSetCursorEnterCallback(window, glfwCursorEnterCB); 65 | } 66 | 67 | void glfwSetScrollCallbackCB(GLFWwindow *window) { 68 | glfwSetScrollCallback(window, glfwScrollCB); 69 | } 70 | 71 | void glfwSetDropCallbackCB(GLFWwindow *window) { 72 | glfwSetDropCallback(window, glfwDropCB); 73 | } 74 | 75 | float GetAxisAtIndex(float *axis, int i) { 76 | return axis[i]; 77 | } 78 | 79 | unsigned char GetButtonsAtIndex(unsigned char *buttons, int i) { 80 | return buttons[i]; 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/linux_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 Linux - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2014 Jonas Ådahl 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_linux_joystick_h_ 28 | #define _glfw3_linux_joystick_h_ 29 | 30 | #include 31 | 32 | #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE _GLFWjoylistLinux linux_js 33 | 34 | 35 | // Linux-specific joystick data 36 | // 37 | typedef struct _GLFWjoystickLinux 38 | { 39 | GLFWbool present; 40 | int fd; 41 | float* axes; 42 | int axisCount; 43 | unsigned char* buttons; 44 | int buttonCount; 45 | char* name; 46 | char* path; 47 | } _GLFWjoystickLinux; 48 | 49 | // Linux-specific joystick API data 50 | // 51 | typedef struct _GLFWjoylistLinux 52 | { 53 | _GLFWjoystickLinux js[GLFW_JOYSTICK_LAST + 1]; 54 | 55 | #if defined(__linux__) 56 | int inotify; 57 | int watch; 58 | regex_t regex; 59 | #endif /*__linux__*/ 60 | } _GLFWjoylistLinux; 61 | 62 | 63 | GLFWbool _glfwInitJoysticksLinux(void); 64 | void _glfwTerminateJoysticksLinux(void); 65 | 66 | void _glfwPollJoystickEvents(void); 67 | 68 | #endif // _glfw3_linux_joystick_h_ 69 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **Status:** Archive (code is provided as-is, no updates expected) 2 | 3 | # go-vncdriver 4 | 5 | A fast VNC driver. 6 | 7 | ## Installation on Ubuntu: 8 | 9 | If you have Ubuntu 14, get the latest Go compiler: 10 | ```sh 11 | # Needed for Ubuntu 14, not Ubuntu 16 12 | $ sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable # for newer golang 13 | $ sudo apt-get update 14 | ``` 15 | Then 16 | ```sh 17 | $ sudo apt-get install -y python-dev make golang libjpeg-turbo8-dev 18 | ``` 19 | And if you want OpenGL rendering support (you probably do, unless you're running on a headless server): 20 | ```sh 21 | $ sudo apt-get install libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev \ 22 | libxxf86vm-dev libgl1-mesa-dev mesa-common-dev 23 | ``` 24 | NOTE: If you're using a Python named something other than `python`, such as `python3`, replace both `python` and `pip` below with the commands for the corresponding Python 25 | ```sh 26 | $ git clone https://github.com/openai/go-vncdriver.git 27 | $ cd go-vncdriver 28 | $ python build.py 29 | $ pip install -e . 30 | ``` 31 | 32 | ## Installation on OSX: 33 | 34 | ``` 35 | $ brew install libjpeg-turbo golang 36 | ``` 37 | 38 | (On OSX newer than El Capitan, you may need to 39 | [install golang](https://golang.org/doc/install) from their site, and 40 | then just install `brew install libjpeg-turbo`.) 41 | 42 | Then 43 | ``` 44 | $ git clone https://github.com/openai/go-vncdriver.git 45 | $ cd go-vncdriver 46 | $ python build.py 47 | $ pip install -e . 48 | ``` 49 | 50 | ## OpenGL viewer 51 | 52 | The OpenGL renderer is optional. If you get an error of the form: 53 | 54 | ``` 55 | go_vncdriver was installed without OpenGL support. See https://github.com/openai/go-vncdriver for details on how debug. 56 | ``` 57 | 58 | That means that your `go-vncdriver` was built without OpenGL 59 | support. (The installer will first try to install with OpenGL, but 60 | will fall back to installing without it.) 61 | 62 | Do the installation steps above, including the extra dependencies to add OpenGL rendering. 63 | 64 | If you get errors like below, the dependencies aren't installed properly: 65 | ``` 66 | fatal error: X11/Xcursor/Xcursor.h: No such file or directory 67 | fatal error: X11/extensions/Xrandr.h: No such file or directory 68 | fatal error: X11/extensions/XInput.h: No such file or directory 69 | fatal error: GL/gl.h: No such file or directory 70 | ``` 71 | 72 | ## Python versions 73 | 74 | `go_vncdriver` has been tested on Python 2.7 and 3.5. 75 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/util/util.go: -------------------------------------------------------------------------------- 1 | // Package util contains utility code for demosntration of go-libjpeg. 2 | package util 3 | 4 | import ( 5 | "bufio" 6 | "fmt" 7 | "image" 8 | "image/png" 9 | "io" 10 | "io/ioutil" 11 | "os" 12 | "path/filepath" 13 | "strings" 14 | ) 15 | 16 | // SubsampledImages contains example images which have subsampling colors. 17 | var SubsampledImages = []string{ 18 | "checkerboard_444.jpg", 19 | "checkerboard_440.jpg", 20 | "checkerboard_422.jpg", 21 | "checkerboard_420.jpg", 22 | } 23 | 24 | // GetExFilePath returns the path of specified example file. 25 | func GetExFilePath(name string) string { 26 | for _, gopath := range strings.Split(os.Getenv("GOPATH"), ":") { 27 | path := filepath.Join(gopath, "src/github.com/pixiv/go-libjpeg/test/images", name) 28 | if _, err := os.Stat(path); err == nil { 29 | return path 30 | } 31 | } 32 | panic(fmt.Errorf("%v does not exist in any directory which contains in $GOPATH", name)) 33 | } 34 | 35 | // GetOutFilePath returns the path of specified out file. 36 | func GetOutFilePath(name string) string { 37 | for _, gopath := range strings.Split(os.Getenv("GOPATH"), ":") { 38 | path := filepath.Join(gopath, "src/github.com/pixiv/go-libjpeg/test/out") 39 | if _, err := os.Stat(path); err == nil { 40 | return filepath.Join(path, name) 41 | } 42 | } 43 | panic(fmt.Errorf("out directory does not exist in any directory which contains in $GOPATH")) 44 | } 45 | 46 | // OpenFile opens specified example file 47 | func OpenFile(name string) (io io.Reader) { 48 | io, err := os.Open(GetExFilePath(name)) 49 | if err != nil { 50 | panic(err) 51 | } 52 | return 53 | } 54 | 55 | // ReadFile reads and returns data bytes of specified example file. 56 | func ReadFile(name string) (data []byte) { 57 | data, err := ioutil.ReadFile(GetExFilePath(name)) 58 | if err != nil { 59 | panic(err) 60 | } 61 | return 62 | } 63 | 64 | // CreateFile opens specified example file 65 | func CreateFile(name string) (f *os.File) { 66 | f, err := os.Create(GetOutFilePath(name)) 67 | if err != nil { 68 | panic(err) 69 | } 70 | return 71 | } 72 | 73 | // WritePNG encodes and writes image into PNG file. 74 | func WritePNG(img image.Image, name string) { 75 | f, err := os.Create(GetOutFilePath(name)) 76 | if err != nil { 77 | panic(err) 78 | } 79 | b := bufio.NewWriter(f) 80 | defer func() { 81 | b.Flush() 82 | f.Close() 83 | }() 84 | 85 | if err := png.Encode(b, img); err != nil { 86 | panic(err) 87 | } 88 | return 89 | } 90 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/win32_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2006-2016 Camilla Berglund 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_win32_joystick_h_ 28 | #define _glfw3_win32_joystick_h_ 29 | 30 | #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \ 31 | _GLFWjoystickWin32 win32_js[GLFW_JOYSTICK_LAST + 1] 32 | 33 | // Joystick element (axis, button or slider) 34 | // 35 | typedef struct _GLFWjoyobjectWin32 36 | { 37 | int offset; 38 | int type; 39 | } _GLFWjoyobjectWin32; 40 | 41 | // Win32-specific per-joystick data 42 | // 43 | typedef struct _GLFWjoystickWin32 44 | { 45 | GLFWbool present; 46 | float* axes; 47 | int axisCount; 48 | unsigned char* buttons; 49 | int buttonCount; 50 | _GLFWjoyobjectWin32* objects; 51 | int objectCount; 52 | char* name; 53 | IDirectInputDevice8W* device; 54 | DWORD index; 55 | GUID guid; 56 | } _GLFWjoystickWin32; 57 | 58 | 59 | void _glfwInitJoysticksWin32(void); 60 | void _glfwTerminateJoysticksWin32(void); 61 | void _glfwDetectJoystickConnectionWin32(void); 62 | void _glfwDetectJoystickDisconnectionWin32(void); 63 | 64 | #endif // _glfw3_win32_joystick_h_ 65 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/README.md: -------------------------------------------------------------------------------- 1 | go-libjpeg 2 | ========== 3 | 4 | [![Build Status](https://travis-ci.org/pixiv/go-libjpeg.svg?branch=master)](https://travis-ci.org/pixiv/go-libjpeg) 5 | 6 | An implementation of Go binding for LibJpeg (preferably libjpeg-turbo). 7 | 8 | The core codes are picked from [go-thumber](http://github.com/pixiv/go-thumber) 9 | and rewritten to compatible with image.Image interface. 10 | 11 | ## Usage 12 | 13 | ``` 14 | import "github.com/pixiv/go-libjpeg/jpeg" 15 | 16 | func main() { 17 | // Decoding JPEG into image.Image 18 | io, err := os.Open("in.jpg") 19 | if err != nil { 20 | log.Fatal(err) 21 | } 22 | img, err := jpeg.Decode(io, &jpeg.DecoderOptions{}) 23 | if err != nil { 24 | log.Fatalf("Decode returns error: %v\n", err) 25 | } 26 | 27 | // Encode JPEG 28 | f, err := os.Create("out.jpg") 29 | if err != nil { 30 | panic(err) 31 | } 32 | w := bufio.NewWriter(f) 33 | if err := jpeg.Encode(w, img, &jpeg.EncoderOptions{Quality: 90}); err != nil { 34 | log.Printf("Encode returns error: %v\n", err) 35 | return 36 | } 37 | w.Flush() 38 | f.Close() 39 | } 40 | ``` 41 | 42 | See [test code](./jpeg/jpeg_test.go) to read full features. 43 | 44 | ## Features 45 | 46 | - Raw JPEG decoding in YCbCr color. 47 | - Decoding with color conversion into RGB/RGBA (RGBA conversion is only supported with libjpeg-turbo). 48 | - Scaled decoding. 49 | - Encoding from some color models (YCbCr, RGB and RGBA). 50 | 51 | ## Benchmark 52 | 53 | ``` 54 | $ go test -bench . -benchtime 10s 55 | ... 56 | BenchmarkDecode 1000 26345730 ns/op 57 | BenchmarkDecodeIntoRGB 500 30886383 ns/op 58 | BenchmarkDecodeWithNativeJPEG 300 49815928 ns/op 59 | ... 60 | ``` 61 | 62 | With libjpeg-turbo: 63 | ``` 64 | BenchmarkDecode 2000 9557646 ns/op 65 | BenchmarkDecodeIntoRGB 1000 12676414 ns/op 66 | BenchmarkDecodeWithNativeJPEG 300 45836153 ns/op 67 | ``` 68 | 69 | go-libjpeg is about 1.9x faster than image/jpeg. 70 | With libjpeg-turbo, it can make more faster (about 4.8x faster than image/jpeg). 71 | 72 | ### Dependencies 73 | 74 | * Go 1.3 (needed for cgo features) 75 | * libjpeg (preferably libjpeg-turbo) 76 | 77 | DecodeIntoRGBA can only work if go-libjpeg is built with libjpeg-turbo. 78 | Because DecdeIntoRGBA uses `JCS_ALPHA_EXTENSIONS`. You can use 79 | DecodeIntoRGB and convert to image.RGBA if can not use libjpeg-turbo. 80 | 81 | ## License 82 | 83 | Copyright (c) 2014 pixiv Inc. All rights reserved. 84 | 85 | See [LICENSE](./LICENSE). 86 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/posix_tls.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2016 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include "internal.h" 29 | 30 | 31 | ////////////////////////////////////////////////////////////////////////// 32 | ////// GLFW internal API ////// 33 | ////////////////////////////////////////////////////////////////////////// 34 | 35 | GLFWbool _glfwInitThreadLocalStoragePOSIX(void) 36 | { 37 | if (pthread_key_create(&_glfw.posix_tls.context, NULL) != 0) 38 | { 39 | _glfwInputError(GLFW_PLATFORM_ERROR, 40 | "POSIX: Failed to create context TLS"); 41 | return GLFW_FALSE; 42 | } 43 | 44 | _glfw.posix_tls.allocated = GLFW_TRUE; 45 | return GLFW_TRUE; 46 | } 47 | 48 | void _glfwTerminateThreadLocalStoragePOSIX(void) 49 | { 50 | if (_glfw.posix_tls.allocated) 51 | pthread_key_delete(_glfw.posix_tls.context); 52 | } 53 | 54 | 55 | ////////////////////////////////////////////////////////////////////////// 56 | ////// GLFW platform API ////// 57 | ////////////////////////////////////////////////////////////////////////// 58 | 59 | void _glfwPlatformSetCurrentContext(_GLFWwindow* context) 60 | { 61 | pthread_setspecific(_glfw.posix_tls.context, context); 62 | } 63 | 64 | _GLFWwindow* _glfwPlatformGetCurrentContext(void) 65 | { 66 | return pthread_getspecific(_glfw.posix_tls.context); 67 | } 68 | 69 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/win32_tls.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2016 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include "internal.h" 29 | 30 | 31 | ////////////////////////////////////////////////////////////////////////// 32 | ////// GLFW internal API ////// 33 | ////////////////////////////////////////////////////////////////////////// 34 | 35 | GLFWbool _glfwInitThreadLocalStorageWin32(void) 36 | { 37 | _glfw.win32_tls.context = TlsAlloc(); 38 | if (_glfw.win32_tls.context == TLS_OUT_OF_INDEXES) 39 | { 40 | _glfwInputError(GLFW_PLATFORM_ERROR, 41 | "Win32: Failed to allocate TLS index"); 42 | return GLFW_FALSE; 43 | } 44 | 45 | _glfw.win32_tls.allocated = GLFW_TRUE; 46 | return GLFW_TRUE; 47 | } 48 | 49 | void _glfwTerminateThreadLocalStorageWin32(void) 50 | { 51 | if (_glfw.win32_tls.allocated) 52 | TlsFree(_glfw.win32_tls.context); 53 | } 54 | 55 | 56 | ////////////////////////////////////////////////////////////////////////// 57 | ////// GLFW platform API ////// 58 | ////////////////////////////////////////////////////////////////////////// 59 | 60 | void _glfwPlatformSetCurrentContext(_GLFWwindow* context) 61 | { 62 | TlsSetValue(_glfw.win32_tls.context, context); 63 | } 64 | 65 | _GLFWwindow* _glfwPlatformGetCurrentContext(void) 66 | { 67 | return TlsGetValue(_glfw.win32_tls.context); 68 | } 69 | 70 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/win32_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2016 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include "internal.h" 29 | 30 | 31 | ////////////////////////////////////////////////////////////////////////// 32 | ////// GLFW internal API ////// 33 | ////////////////////////////////////////////////////////////////////////// 34 | 35 | // Initialise timer 36 | // 37 | void _glfwInitTimerWin32(void) 38 | { 39 | uint64_t frequency; 40 | 41 | if (QueryPerformanceFrequency((LARGE_INTEGER*) &frequency)) 42 | { 43 | _glfw.win32_time.hasPC = GLFW_TRUE; 44 | _glfw.win32_time.frequency = frequency; 45 | } 46 | else 47 | { 48 | _glfw.win32_time.hasPC = GLFW_FALSE; 49 | _glfw.win32_time.frequency = 1000; 50 | } 51 | } 52 | 53 | 54 | ////////////////////////////////////////////////////////////////////////// 55 | ////// GLFW platform API ////// 56 | ////////////////////////////////////////////////////////////////////////// 57 | 58 | uint64_t _glfwPlatformGetTimerValue(void) 59 | { 60 | if (_glfw.win32_time.hasPC) 61 | { 62 | uint64_t value; 63 | QueryPerformanceCounter((LARGE_INTEGER*) &value); 64 | return value; 65 | } 66 | else 67 | return (uint64_t) _glfw_timeGetTime(); 68 | } 69 | 70 | uint64_t _glfwPlatformGetTimerFrequency(void) 71 | { 72 | return _glfw.win32_time.frequency; 73 | } 74 | 75 | -------------------------------------------------------------------------------- /flexflate/writer_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package flexflate 6 | 7 | import ( 8 | "io/ioutil" 9 | "runtime" 10 | "testing" 11 | ) 12 | 13 | func benchmarkEncoder(b *testing.B, testfile, level, n int) { 14 | b.StopTimer() 15 | b.SetBytes(int64(n)) 16 | buf0, err := ioutil.ReadFile(testfiles[testfile]) 17 | if err != nil { 18 | b.Fatal(err) 19 | } 20 | if len(buf0) == 0 { 21 | b.Fatalf("test file %q has no data", testfiles[testfile]) 22 | } 23 | buf1 := make([]byte, n) 24 | for i := 0; i < n; i += len(buf0) { 25 | if len(buf0) > n-i { 26 | buf0 = buf0[:n-i] 27 | } 28 | copy(buf1[i:], buf0) 29 | } 30 | buf0 = nil 31 | runtime.GC() 32 | b.StartTimer() 33 | for i := 0; i < b.N; i++ { 34 | w, err := NewWriter(ioutil.Discard, level) 35 | if err != nil { 36 | b.Fatal(err) 37 | } 38 | w.Write(buf1) 39 | w.Close() 40 | } 41 | } 42 | 43 | func BenchmarkEncodeDigitsSpeed1e4(b *testing.B) { benchmarkEncoder(b, digits, speed, 1e4) } 44 | func BenchmarkEncodeDigitsSpeed1e5(b *testing.B) { benchmarkEncoder(b, digits, speed, 1e5) } 45 | func BenchmarkEncodeDigitsSpeed1e6(b *testing.B) { benchmarkEncoder(b, digits, speed, 1e6) } 46 | func BenchmarkEncodeDigitsDefault1e4(b *testing.B) { benchmarkEncoder(b, digits, default_, 1e4) } 47 | func BenchmarkEncodeDigitsDefault1e5(b *testing.B) { benchmarkEncoder(b, digits, default_, 1e5) } 48 | func BenchmarkEncodeDigitsDefault1e6(b *testing.B) { benchmarkEncoder(b, digits, default_, 1e6) } 49 | func BenchmarkEncodeDigitsCompress1e4(b *testing.B) { benchmarkEncoder(b, digits, compress, 1e4) } 50 | func BenchmarkEncodeDigitsCompress1e5(b *testing.B) { benchmarkEncoder(b, digits, compress, 1e5) } 51 | func BenchmarkEncodeDigitsCompress1e6(b *testing.B) { benchmarkEncoder(b, digits, compress, 1e6) } 52 | func BenchmarkEncodeTwainSpeed1e4(b *testing.B) { benchmarkEncoder(b, twain, speed, 1e4) } 53 | func BenchmarkEncodeTwainSpeed1e5(b *testing.B) { benchmarkEncoder(b, twain, speed, 1e5) } 54 | func BenchmarkEncodeTwainSpeed1e6(b *testing.B) { benchmarkEncoder(b, twain, speed, 1e6) } 55 | func BenchmarkEncodeTwainDefault1e4(b *testing.B) { benchmarkEncoder(b, twain, default_, 1e4) } 56 | func BenchmarkEncodeTwainDefault1e5(b *testing.B) { benchmarkEncoder(b, twain, default_, 1e5) } 57 | func BenchmarkEncodeTwainDefault1e6(b *testing.B) { benchmarkEncoder(b, twain, default_, 1e6) } 58 | func BenchmarkEncodeTwainCompress1e4(b *testing.B) { benchmarkEncoder(b, twain, compress, 1e4) } 59 | func BenchmarkEncodeTwainCompress1e5(b *testing.B) { benchmarkEncoder(b, twain, compress, 1e5) } 60 | func BenchmarkEncodeTwainCompress1e6(b *testing.B) { benchmarkEncoder(b, twain, compress, 1e6) } 61 | -------------------------------------------------------------------------------- /vendor/github.com/cheggaaa/pb/pb_x.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin freebsd netbsd openbsd solaris dragonfly 2 | // +build !appengine 3 | 4 | package pb 5 | 6 | import ( 7 | "errors" 8 | "fmt" 9 | "os" 10 | "os/signal" 11 | "runtime" 12 | "sync" 13 | "syscall" 14 | "unsafe" 15 | ) 16 | 17 | const ( 18 | TIOCGWINSZ = 0x5413 19 | TIOCGWINSZ_OSX = 1074295912 20 | ) 21 | 22 | var tty *os.File 23 | 24 | var ErrPoolWasStarted = errors.New("Bar pool was started") 25 | 26 | var echoLocked bool 27 | var echoLockMutex sync.Mutex 28 | 29 | func init() { 30 | var err error 31 | tty, err = os.Open("/dev/tty") 32 | if err != nil { 33 | tty = os.Stdin 34 | } 35 | } 36 | 37 | // terminalWidth returns width of the terminal. 38 | func terminalWidth() (int, error) { 39 | w := new(window) 40 | tio := syscall.TIOCGWINSZ 41 | if runtime.GOOS == "darwin" { 42 | tio = TIOCGWINSZ_OSX 43 | } 44 | res, _, err := syscall.Syscall(sysIoctl, 45 | tty.Fd(), 46 | uintptr(tio), 47 | uintptr(unsafe.Pointer(w)), 48 | ) 49 | if int(res) == -1 { 50 | return 0, err 51 | } 52 | return int(w.Col), nil 53 | } 54 | 55 | var oldState syscall.Termios 56 | 57 | func lockEcho() (quit chan int, err error) { 58 | echoLockMutex.Lock() 59 | defer echoLockMutex.Unlock() 60 | if echoLocked { 61 | err = ErrPoolWasStarted 62 | return 63 | } 64 | echoLocked = true 65 | 66 | fd := tty.Fd() 67 | if _, _, e := syscall.Syscall6(sysIoctl, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&oldState)), 0, 0, 0); e != 0 { 68 | err = fmt.Errorf("Can't get terminal settings: %v", e) 69 | return 70 | } 71 | 72 | newState := oldState 73 | newState.Lflag &^= syscall.ECHO 74 | newState.Lflag |= syscall.ICANON | syscall.ISIG 75 | newState.Iflag |= syscall.ICRNL 76 | if _, _, e := syscall.Syscall6(sysIoctl, fd, ioctlWriteTermios, uintptr(unsafe.Pointer(&newState)), 0, 0, 0); e != 0 { 77 | err = fmt.Errorf("Can't set terminal settings: %v", e) 78 | return 79 | } 80 | quit = make(chan int, 1) 81 | go catchTerminate(quit) 82 | return 83 | } 84 | 85 | func unlockEcho() (err error) { 86 | echoLockMutex.Lock() 87 | defer echoLockMutex.Unlock() 88 | if !echoLocked { 89 | return 90 | } 91 | echoLocked = false 92 | fd := tty.Fd() 93 | if _, _, e := syscall.Syscall6(sysIoctl, fd, ioctlWriteTermios, uintptr(unsafe.Pointer(&oldState)), 0, 0, 0); e != 0 { 94 | err = fmt.Errorf("Can't set terminal settings") 95 | } 96 | return 97 | } 98 | 99 | // listen exit signals and restore terminal state 100 | func catchTerminate(quit chan int) { 101 | sig := make(chan os.Signal, 1) 102 | signal.Notify(sig, os.Interrupt, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGKILL) 103 | defer signal.Stop(sig) 104 | select { 105 | case <-quit: 106 | unlockEcho() 107 | case <-sig: 108 | unlockEcho() 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /vendor/github.com/juju/errors/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013, 2014 Canonical Ltd. 2 | // Licensed under the LGPLv3, see LICENCE file for details. 3 | 4 | /* 5 | [godoc-link-here] 6 | 7 | The juju/errors provides an easy way to annotate errors without losing the 8 | orginal error context. 9 | 10 | The exported `New` and `Errorf` functions are designed to replace the 11 | `errors.New` and `fmt.Errorf` functions respectively. The same underlying 12 | error is there, but the package also records the location at which the error 13 | was created. 14 | 15 | A primary use case for this library is to add extra context any time an 16 | error is returned from a function. 17 | 18 | if err := SomeFunc(); err != nil { 19 | return err 20 | } 21 | 22 | This instead becomes: 23 | 24 | if err := SomeFunc(); err != nil { 25 | return errors.Trace(err) 26 | } 27 | 28 | which just records the file and line number of the Trace call, or 29 | 30 | if err := SomeFunc(); err != nil { 31 | return errors.Annotate(err, "more context") 32 | } 33 | 34 | which also adds an annotation to the error. 35 | 36 | When you want to check to see if an error is of a particular type, a helper 37 | function is normally exported by the package that returned the error, like the 38 | `os` package does. The underlying cause of the error is available using the 39 | `Cause` function. 40 | 41 | os.IsNotExist(errors.Cause(err)) 42 | 43 | The result of the `Error()` call on an annotated error is the annotations joined 44 | with colons, then the result of the `Error()` method for the underlying error 45 | that was the cause. 46 | 47 | err := errors.Errorf("original") 48 | err = errors.Annotatef(err, "context") 49 | err = errors.Annotatef(err, "more context") 50 | err.Error() -> "more context: context: original" 51 | 52 | Obviously recording the file, line and functions is not very useful if you 53 | cannot get them back out again. 54 | 55 | errors.ErrorStack(err) 56 | 57 | will return something like: 58 | 59 | first error 60 | github.com/juju/errors/annotation_test.go:193: 61 | github.com/juju/errors/annotation_test.go:194: annotation 62 | github.com/juju/errors/annotation_test.go:195: 63 | github.com/juju/errors/annotation_test.go:196: more context 64 | github.com/juju/errors/annotation_test.go:197: 65 | 66 | The first error was generated by an external system, so there was no location 67 | associated. The second, fourth, and last lines were generated with Trace calls, 68 | and the other two through Annotate. 69 | 70 | Sometimes when responding to an error you want to return a more specific error 71 | for the situation. 72 | 73 | if err := FindField(field); err != nil { 74 | return errors.Wrap(err, errors.NotFoundf(field)) 75 | } 76 | 77 | This returns an error where the complete error stack is still available, and 78 | `errors.Cause()` will return the `NotFound` error. 79 | 80 | */ 81 | package errors 82 | -------------------------------------------------------------------------------- /vncclient/client_test.go: -------------------------------------------------------------------------------- 1 | package vncclient 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | "testing" 7 | ) 8 | 9 | func newMockServer(t *testing.T, version string) string { 10 | ln, err := net.Listen("tcp", "127.0.0.1:0") 11 | if err != nil { 12 | t.Fatalf("error listening: %s", err) 13 | } 14 | 15 | go func() { 16 | defer ln.Close() 17 | c, err := ln.Accept() 18 | if err != nil { 19 | t.Fatalf("error accepting conn: %s", err) 20 | } 21 | defer c.Close() 22 | 23 | _, err = c.Write([]byte(fmt.Sprintf("RFB %s\n", version))) 24 | if err != nil { 25 | t.Fatal("failed writing version") 26 | } 27 | }() 28 | 29 | return ln.Addr().String() 30 | } 31 | 32 | func TestClient_LowMajorVersion(t *testing.T) { 33 | nc, err := net.Dial("tcp", newMockServer(t, "002.009")) 34 | if err != nil { 35 | t.Fatalf("error connecting to mock server: %s", err) 36 | } 37 | 38 | _, err = Client(nc, &ClientConfig{}) 39 | if err == nil { 40 | t.Fatal("error expected") 41 | } 42 | 43 | if err.Error() != "unsupported major version, less than 3: 2" { 44 | t.Fatalf("unexpected error: %s", err) 45 | } 46 | } 47 | 48 | func TestClient_LowMinorVersion(t *testing.T) { 49 | nc, err := net.Dial("tcp", newMockServer(t, "003.007")) 50 | if err != nil { 51 | t.Fatalf("error connecting to mock server: %s", err) 52 | } 53 | 54 | _, err = Client(nc, &ClientConfig{}) 55 | if err == nil { 56 | t.Fatal("error expected") 57 | } 58 | 59 | if err.Error() != "unsupported minor version, less than 8: 7" { 60 | t.Fatalf("unexpected error: %s", err) 61 | } 62 | } 63 | 64 | func TestParseProtocolVersion(t *testing.T) { 65 | tests := []struct { 66 | proto []byte 67 | major, minor uint 68 | isErr bool 69 | }{ 70 | // Valid ProtocolVersion messages. 71 | {[]byte{82, 70, 66, 32, 48, 48, 51, 46, 48, 48, 56, 10}, 3, 8, false}, // RFB 003.008\n 72 | {[]byte{82, 70, 66, 32, 48, 48, 51, 46, 56, 56, 57, 10}, 3, 889, false}, // RFB 003.889\n -- OS X 10.10.3 73 | {[]byte{82, 70, 66, 32, 48, 48, 48, 46, 48, 48, 48, 10}, 0, 0, false}, // RFB 000.0000\n 74 | // Invalid messages. 75 | {[]byte{82, 70, 66, 32, 51, 46, 56, 10}, 0, 0, true}, // RFB 3.8\n -- too short; not zero padded 76 | {[]byte{82, 70, 66, 10}, 0, 0, true}, // RFB\n -- too short 77 | {[]byte{}, 0, 0, true}, // (empty) -- too short 78 | } 79 | 80 | for _, tt := range tests { 81 | major, minor, err := parseProtocolVersion(tt.proto) 82 | if err != nil && !tt.isErr { 83 | t.Fatalf("parseProtocolVersion(%v) unexpected error %v", tt.proto, err) 84 | } 85 | if err == nil && tt.isErr { 86 | t.Fatalf("parseProtocolVersion(%v) expected error", tt.proto) 87 | } 88 | if major != tt.major { 89 | t.Errorf("parseProtocolVersion(%v) major = %v, want %v", tt.proto, major, tt.major) 90 | } 91 | if major != tt.major { 92 | t.Errorf("parseProtocolVersion(%v) minor = %v, want %v", tt.proto, minor, tt.minor) 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/context.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#include 4 | //#include "glfw/include/GLFW/glfw3.h" 5 | import "C" 6 | 7 | import ( 8 | "unsafe" 9 | ) 10 | 11 | // MakeContextCurrent makes the context of the window current. 12 | // Originally GLFW 3 passes a null pointer to detach the context. 13 | // But since we're using receievers, DetachCurrentContext should 14 | // be used instead. 15 | func (w *Window) MakeContextCurrent() { 16 | C.glfwMakeContextCurrent(w.data) 17 | panicError() 18 | } 19 | 20 | // DetachCurrentContext detaches the current context. 21 | func DetachCurrentContext() { 22 | C.glfwMakeContextCurrent(nil) 23 | panicError() 24 | } 25 | 26 | // GetCurrentContext returns the window whose context is current. 27 | func GetCurrentContext() *Window { 28 | w := C.glfwGetCurrentContext() 29 | panicError() 30 | if w == nil { 31 | return nil 32 | } 33 | return windows.get(w) 34 | } 35 | 36 | // SwapBuffers swaps the front and back buffers of the window. If the 37 | // swap interval is greater than zero, the GPU driver waits the specified number 38 | // of screen updates before swapping the buffers. 39 | func (w *Window) SwapBuffers() { 40 | C.glfwSwapBuffers(w.data) 41 | panicError() 42 | } 43 | 44 | // SwapInterval sets the swap interval for the current context, i.e. the number 45 | // of screen updates to wait before swapping the buffers of a window and 46 | // returning from SwapBuffers. This is sometimes called 47 | // 'vertical synchronization', 'vertical retrace synchronization' or 'vsync'. 48 | // 49 | // Contexts that support either of the WGL_EXT_swap_control_tear and 50 | // GLX_EXT_swap_control_tear extensions also accept negative swap intervals, 51 | // which allow the driver to swap even if a frame arrives a little bit late. 52 | // You can check for the presence of these extensions using 53 | // ExtensionSupported. For more information about swap tearing, 54 | // see the extension specifications. 55 | // 56 | // Some GPU drivers do not honor the requested swap interval, either because of 57 | // user settings that override the request or due to bugs in the driver. 58 | func SwapInterval(interval int) { 59 | C.glfwSwapInterval(C.int(interval)) 60 | panicError() 61 | } 62 | 63 | // ExtensionSupported returns whether the specified OpenGL or context creation 64 | // API extension is supported by the current context. For example, on Windows 65 | // both the OpenGL and WGL extension strings are checked. 66 | // 67 | // As this functions searches one or more extension strings on each call, it is 68 | // recommended that you cache its results if it's going to be used frequently. 69 | // The extension strings will not change during the lifetime of a context, so 70 | // there is no danger in doing this. 71 | func ExtensionSupported(extension string) bool { 72 | e := C.CString(extension) 73 | defer C.free(unsafe.Pointer(e)) 74 | ret := glfwbool(C.glfwExtensionSupported(e)) 75 | panicError() 76 | return ret 77 | } 78 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import sys 3 | 4 | from distutils.command.build import build as DistutilsBuild 5 | from distutils.command.build_ext import build_ext as DistutilsBuildExt 6 | from setuptools import setup, Extension 7 | 8 | import build 9 | 10 | class BuildExt(DistutilsBuildExt): 11 | def run(self): 12 | pass 13 | 14 | def build_extension(self, ext): 15 | pass 16 | 17 | class BuildError(Exception): 18 | pass 19 | 20 | class Build(DistutilsBuild): 21 | def run(self): 22 | self.check_version() 23 | self.build() 24 | 25 | def check_version(self): 26 | cmd = ['go', 'help', 'build'] 27 | try: 28 | build_help = subprocess.check_output(cmd, stderr=subprocess.STDOUT).rstrip() 29 | except OSError as e: 30 | raise BuildError(""" 31 | 32 | Unable to execute '{}'. HINT: are you sure `go` is installed? 33 | 34 | go_vncdriver requires Go version 1.5 or newer. Here are some hints for Go installation: 35 | 36 | - Ubuntu 14.04: The default golang is too old, but you can get a modern one via: "sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable && sudo apt-get update && sudo apt-get install golang" 37 | - Ubuntu 16:04: "sudo apt-get install golang" 38 | - OSX, El Capitan or newer: "brew install golang" 39 | - Other: you can obtain a recent Go build from https://golang.org/doc/install 40 | 41 | (DETAIL: original error: {}.)""".format(' '.join(cmd), e)) 42 | else: 43 | if 'buildmode' not in str(build_help): 44 | raise RuntimeError(""" 45 | 46 | Your Go installation looks too old: go_vncdriver requires Go version 1.5 or newer. Here are some hints for Go installation: 47 | 48 | - Ubuntu 14.04: The default golang is too old, but you can get a modern one via: "sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable && sudo apt-get update && sudo apt-get install golang" 49 | - Ubuntu 16:04: "sudo apt-get install golang" 50 | - OSX, El Capitan or newer: "brew install golang" 51 | - Other: you can obtain a recent Go build from https://golang.org/doc/install 52 | 53 | You can obtain a recent Go build from https://golang.org/doc/install. If on Ubuntu, you can follow: https://github.com/golang/go/wiki/Ubuntu. 54 | 55 | (DETAIL: the output of 'go help build' did not include 'buildmode'.) 56 | """) 57 | 58 | def build(self): 59 | try: 60 | sys.stderr.write('Running new build\n') 61 | build.build() 62 | except build.BuildException as e: 63 | sys.stderr.write('Could not build go_vncdriver: %s\n' % e) 64 | raise 65 | DistutilsBuild.run(self) 66 | 67 | setup(name='go_vncdriver', 68 | version='0.4.19', 69 | cmdclass={'build': Build, 'build_ext': BuildExt}, 70 | ext_modules=[Extension('go_vncdriver', [])], 71 | packages=['go_vncdriver'], 72 | package_dir={'go_vncdriver': '.'}, 73 | package_data={'go_vncdriver': ['go_vncdriver.so']}, 74 | setup_requires=['numpy'], 75 | install_requires=['numpy'], 76 | ) 77 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/posix_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2016 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include "internal.h" 29 | 30 | #include 31 | #include 32 | 33 | 34 | ////////////////////////////////////////////////////////////////////////// 35 | ////// GLFW internal API ////// 36 | ////////////////////////////////////////////////////////////////////////// 37 | 38 | // Initialise timer 39 | // 40 | void _glfwInitTimerPOSIX(void) 41 | { 42 | #if defined(CLOCK_MONOTONIC) 43 | struct timespec ts; 44 | 45 | if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) 46 | { 47 | _glfw.posix_time.monotonic = GLFW_TRUE; 48 | _glfw.posix_time.frequency = 1000000000; 49 | } 50 | else 51 | #endif 52 | { 53 | _glfw.posix_time.monotonic = GLFW_FALSE; 54 | _glfw.posix_time.frequency = 1000000; 55 | } 56 | } 57 | 58 | 59 | ////////////////////////////////////////////////////////////////////////// 60 | ////// GLFW platform API ////// 61 | ////////////////////////////////////////////////////////////////////////// 62 | 63 | uint64_t _glfwPlatformGetTimerValue(void) 64 | { 65 | #if defined(CLOCK_MONOTONIC) 66 | if (_glfw.posix_time.monotonic) 67 | { 68 | struct timespec ts; 69 | clock_gettime(CLOCK_MONOTONIC, &ts); 70 | return (uint64_t) ts.tv_sec * (uint64_t) 1000000000 + (uint64_t) ts.tv_nsec; 71 | } 72 | else 73 | #endif 74 | { 75 | struct timeval tv; 76 | gettimeofday(&tv, NULL); 77 | return (uint64_t) tv.tv_sec * (uint64_t) 1000000 + (uint64_t) tv.tv_usec; 78 | } 79 | } 80 | 81 | uint64_t _glfwPlatformGetTimerFrequency(void) 82 | { 83 | return _glfw.posix_time.frequency; 84 | } 85 | 86 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/log_nix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | // Copyright 2013, Örjan Persson. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | package logging 8 | 9 | import ( 10 | "bytes" 11 | "fmt" 12 | "io" 13 | "log" 14 | ) 15 | 16 | type color int 17 | 18 | const ( 19 | ColorBlack = iota + 30 20 | ColorRed 21 | ColorGreen 22 | ColorYellow 23 | ColorBlue 24 | ColorMagenta 25 | ColorCyan 26 | ColorWhite 27 | ) 28 | 29 | var ( 30 | colors = []string{ 31 | CRITICAL: ColorSeq(ColorMagenta), 32 | ERROR: ColorSeq(ColorRed), 33 | WARNING: ColorSeq(ColorYellow), 34 | NOTICE: ColorSeq(ColorGreen), 35 | DEBUG: ColorSeq(ColorCyan), 36 | } 37 | boldcolors = []string{ 38 | CRITICAL: ColorSeqBold(ColorMagenta), 39 | ERROR: ColorSeqBold(ColorRed), 40 | WARNING: ColorSeqBold(ColorYellow), 41 | NOTICE: ColorSeqBold(ColorGreen), 42 | DEBUG: ColorSeqBold(ColorCyan), 43 | } 44 | ) 45 | 46 | // LogBackend utilizes the standard log module. 47 | type LogBackend struct { 48 | Logger *log.Logger 49 | Color bool 50 | ColorConfig []string 51 | } 52 | 53 | // NewLogBackend creates a new LogBackend. 54 | func NewLogBackend(out io.Writer, prefix string, flag int) *LogBackend { 55 | return &LogBackend{Logger: log.New(out, prefix, flag)} 56 | } 57 | 58 | // Log implements the Backend interface. 59 | func (b *LogBackend) Log(level Level, calldepth int, rec *Record) error { 60 | if b.Color { 61 | col := colors[level] 62 | if len(b.ColorConfig) > int(level) && b.ColorConfig[level] != "" { 63 | col = b.ColorConfig[level] 64 | } 65 | 66 | buf := &bytes.Buffer{} 67 | buf.Write([]byte(col)) 68 | buf.Write([]byte(rec.Formatted(calldepth + 1))) 69 | buf.Write([]byte("\033[0m")) 70 | // For some reason, the Go logger arbitrarily decided "2" was the correct 71 | // call depth... 72 | return b.Logger.Output(calldepth+2, buf.String()) 73 | } 74 | 75 | return b.Logger.Output(calldepth+2, rec.Formatted(calldepth+1)) 76 | } 77 | 78 | // ConvertColors takes a list of ints representing colors for log levels and 79 | // converts them into strings for ANSI color formatting 80 | func ConvertColors(colors []int, bold bool) []string { 81 | converted := []string{} 82 | for _, i := range colors { 83 | if bold { 84 | converted = append(converted, ColorSeqBold(color(i))) 85 | } else { 86 | converted = append(converted, ColorSeq(color(i))) 87 | } 88 | } 89 | 90 | return converted 91 | } 92 | 93 | func ColorSeq(color color) string { 94 | return fmt.Sprintf("\033[%dm", int(color)) 95 | } 96 | 97 | func ColorSeqBold(color color) string { 98 | return fmt.Sprintf("\033[%d;1m", int(color)) 99 | } 100 | 101 | func doFmtVerbLevelColor(layout string, level Level, output io.Writer) { 102 | if layout == "bold" { 103 | output.Write([]byte(boldcolors[level])) 104 | } else if layout == "reset" { 105 | output.Write([]byte("\033[0m")) 106 | } else { 107 | output.Write([]byte(colors[level])) 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/glfw.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#include "glfw/include/GLFW/glfw3.h" 4 | import "C" 5 | 6 | const ( 7 | VersionMajor = C.GLFW_VERSION_MAJOR // This is incremented when the API is changed in non-compatible ways. 8 | VersionMinor = C.GLFW_VERSION_MINOR // This is incremented when features are added to the API but it remains backward-compatible. 9 | VersionRevision = C.GLFW_VERSION_REVISION // This is incremented when a bug fix release is made that does not contain any API changes. 10 | ) 11 | 12 | // Init initializes the GLFW library. Before most GLFW functions can be used, 13 | // GLFW must be initialized, and before a program terminates GLFW should be 14 | // terminated in order to free any resources allocated during or after 15 | // initialization. 16 | // 17 | // If this function fails, it calls Terminate before returning. If it succeeds, 18 | // you should call Terminate before the program exits. 19 | // 20 | // Additional calls to this function after successful initialization but before 21 | // termination will succeed but will do nothing. 22 | // 23 | // This function may take several seconds to complete on some systems, while on 24 | // other systems it may take only a fraction of a second to complete. 25 | // 26 | // On Mac OS X, this function will change the current directory of the 27 | // application to the Contents/Resources subdirectory of the application's 28 | // bundle, if present. 29 | // 30 | // This function may only be called from the main thread. 31 | func Init() error { 32 | C.glfwInit() 33 | return acceptError(APIUnavailable) 34 | } 35 | 36 | // Terminate destroys all remaining windows, frees any allocated resources and 37 | // sets the library to an uninitialized state. Once this is called, you must 38 | // again call Init successfully before you will be able to use most GLFW 39 | // functions. 40 | // 41 | // If GLFW has been successfully initialized, this function should be called 42 | // before the program exits. If initialization fails, there is no need to call 43 | // this function, as it is called by Init before it returns failure. 44 | // 45 | // This function may only be called from the main thread. 46 | func Terminate() { 47 | flushErrors() 48 | C.glfwTerminate() 49 | } 50 | 51 | // GetVersion retrieves the major, minor and revision numbers of the GLFW 52 | // library. It is intended for when you are using GLFW as a shared library and 53 | // want to ensure that you are using the minimum required version. 54 | // 55 | // This function may be called before Init. 56 | func GetVersion() (major, minor, revision int) { 57 | var ( 58 | maj C.int 59 | min C.int 60 | rev C.int 61 | ) 62 | 63 | C.glfwGetVersion(&maj, &min, &rev) 64 | return int(maj), int(min), int(rev) 65 | } 66 | 67 | // GetVersionString returns a static string generated at compile-time according 68 | // to which configuration macros were defined. This is intended for use when 69 | // submitting bug reports, to allow developers to see which code paths are 70 | // enabled in a binary. 71 | // 72 | // This function may be called before Init. 73 | func GetVersionString() string { 74 | return C.GoString(C.glfwGetVersionString()) 75 | } 76 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/README.md: -------------------------------------------------------------------------------- 1 | ## Golang logging library 2 | 3 | [![godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/op/go-logging) [![build](https://img.shields.io/travis/op/go-logging.svg?style=flat)](https://travis-ci.org/op/go-logging) 4 | 5 | Package logging implements a logging infrastructure for Go. Its output format 6 | is customizable and supports different logging backends like syslog, file and 7 | memory. Multiple backends can be utilized with different log levels per backend 8 | and logger. 9 | 10 | **_NOTE:_** backwards compatibility promise have been dropped for master. Please 11 | vendor this package or use `gopkg.in/op/go-logging.v1` for previous version. See 12 | [changelog](CHANGELOG.md) for details. 13 | 14 | ## Example 15 | 16 | Let's have a look at an [example](examples/example.go) which demonstrates most 17 | of the features found in this library. 18 | 19 | [![Example Output](examples/example.png)](examples/example.go) 20 | 21 | ```go 22 | package main 23 | 24 | import ( 25 | "os" 26 | 27 | "github.com/op/go-logging" 28 | ) 29 | 30 | var log = logging.MustGetLogger("example") 31 | 32 | // Example format string. Everything except the message has a custom color 33 | // which is dependent on the log level. Many fields have a custom output 34 | // formatting too, eg. the time returns the hour down to the milli second. 35 | var format = logging.MustStringFormatter( 36 | `%{color}%{time:15:04:05.000} %{shortfunc} ▶ %{level:.4s} %{id:03x}%{color:reset} %{message}`, 37 | ) 38 | 39 | // Password is just an example type implementing the Redactor interface. Any 40 | // time this is logged, the Redacted() function will be called. 41 | type Password string 42 | 43 | func (p Password) Redacted() interface{} { 44 | return logging.Redact(string(p)) 45 | } 46 | 47 | func main() { 48 | // For demo purposes, create two backend for os.Stderr. 49 | backend1 := logging.NewLogBackend(os.Stderr, "", 0) 50 | backend2 := logging.NewLogBackend(os.Stderr, "", 0) 51 | 52 | // For messages written to backend2 we want to add some additional 53 | // information to the output, including the used log level and the name of 54 | // the function. 55 | backend2Formatter := logging.NewBackendFormatter(backend2, format) 56 | 57 | // Only errors and more severe messages should be sent to backend1 58 | backend1Leveled := logging.AddModuleLevel(backend1) 59 | backend1Leveled.SetLevel(logging.ERROR, "") 60 | 61 | // Set the backends to be used. 62 | logging.SetBackend(backend1Leveled, backend2Formatter) 63 | 64 | log.Debugf("debug %s", Password("secret")) 65 | log.Info("info") 66 | log.Notice("notice") 67 | log.Warning("warning") 68 | log.Error("err") 69 | log.Critical("crit") 70 | } 71 | ``` 72 | 73 | ## Installing 74 | 75 | ### Using *go get* 76 | 77 | $ go get github.com/op/go-logging 78 | 79 | After this command *go-logging* is ready to use. Its source will be in: 80 | 81 | $GOPATH/src/pkg/github.com/op/go-logging 82 | 83 | You can use `go get -u` to update the package. 84 | 85 | ## Documentation 86 | 87 | For docs, see http://godoc.org/github.com/op/go-logging or run: 88 | 89 | $ godoc github.com/op/go-logging 90 | 91 | ## Additional resources 92 | 93 | * [wslog](https://godoc.org/github.com/cryptix/exp/wslog) -- exposes log messages through a WebSocket. 94 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/test/images/README.md: -------------------------------------------------------------------------------- 1 | Example Images 2 | ============== 3 | 4 | This directory contains example JPEG files and PNG source files. 5 | 6 | ## Photos by Author 7 | 8 | These images are taken by [Shunsuke Michii](https://github.com/harukasan). 9 | These photos are licensed under the Creative Commons Attribution 3.0. 10 | You can also use these images under the same as [go-libjpeg's license](../LICENSE). 11 | 12 | #### cosmos.png 13 | 14 | The cosmos taken in Nokono-shima (Nokono Island), Fukuoka, JAPAN. 15 | 16 | ![cosmos.png](cosmos.png) 17 | 18 | JPEG file is generated by following command: 19 | 20 | ```sh 21 | $ convert -quality 90 -sampling-factor 4:2:0 ./cosmos.png ./cosmos.jpg 22 | ``` 23 | 24 | #### kinkaku.png 25 | 26 | Kinkaku taken in Kyoto, JAPAN. 27 | 28 | ![kinkaku.png](kinkaku.png) 29 | 30 | JPEG file is generated by following command: 31 | 32 | ```sh 33 | $ convert -quality 90 -sampling-factor 4:2:0 ./kinkaku.png ./kinkaku.jpg 34 | ``` 35 | 36 | ## Checkerboard 37 | 38 | Blue and Red Checkerboards in each subsampling factor. 39 | 40 | Each images are converted by following commands: 41 | 42 | ``` 43 | $ convert checkerboard.png -sampling-factor 4:4:4 -quality 100 ./checkerboard_444.jpg 44 | $ convert checkerboard.png -sampling-factor 4:4:0 -quality 100 ./checkerboard_440.jpg 45 | $ convert checkerboard.png -sampling-factor 4:2:2 -quality 100 ./checkerboard_422.jpg 46 | $ convert checkerboard.png -sampling-factor 4:2:0 -quality 100 ./checkerboard_420.jpg 47 | ``` 48 | 49 | ## testdata from Go Standard library 50 | 51 | The images that included in the [testdata](./testdata/) directory are ported from [golang/go](https://github.com/golang/go). 52 | 53 | Original files are found here: https://github.com/golang/go/tree/master/src/image/testdata 54 | 55 | ``` 56 | Copyright (c) 2012 The Go Authors. All rights reserved. 57 | 58 | Redistribution and use in source and binary forms, with or without 59 | modification, are permitted provided that the following conditions are 60 | met: 61 | 62 | * Redistributions of source code must retain the above copyright 63 | notice, this list of conditions and the following disclaimer. 64 | * Redistributions in binary form must reproduce the above 65 | copyright notice, this list of conditions and the following disclaimer 66 | in the documentation and/or other materials provided with the 67 | distribution. 68 | * Neither the name of Google Inc. nor the names of its 69 | contributors may be used to endorse or promote products derived from 70 | this software without specific prior written permission. 71 | 72 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 73 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 74 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 75 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 76 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 77 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 78 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 79 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 80 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 81 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 82 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 83 | ``` 84 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/log_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | // Copyright 2013, Örjan Persson. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | package logging 7 | 8 | import ( 9 | "bytes" 10 | "io" 11 | "log" 12 | "syscall" 13 | ) 14 | 15 | var ( 16 | kernel32DLL = syscall.NewLazyDLL("kernel32.dll") 17 | setConsoleTextAttributeProc = kernel32DLL.NewProc("SetConsoleTextAttribute") 18 | ) 19 | 20 | // Character attributes 21 | // Note: 22 | // -- The attributes are combined to produce various colors (e.g., Blue + Green will create Cyan). 23 | // Clearing all foreground or background colors results in black; setting all creates white. 24 | // See https://msdn.microsoft.com/en-us/library/windows/desktop/ms682088(v=vs.85).aspx#_win32_character_attributes. 25 | const ( 26 | fgBlack = 0x0000 27 | fgBlue = 0x0001 28 | fgGreen = 0x0002 29 | fgCyan = 0x0003 30 | fgRed = 0x0004 31 | fgMagenta = 0x0005 32 | fgYellow = 0x0006 33 | fgWhite = 0x0007 34 | fgIntensity = 0x0008 35 | fgMask = 0x000F 36 | ) 37 | 38 | var ( 39 | colors = []uint16{ 40 | INFO: fgWhite, 41 | CRITICAL: fgMagenta, 42 | ERROR: fgRed, 43 | WARNING: fgYellow, 44 | NOTICE: fgGreen, 45 | DEBUG: fgCyan, 46 | } 47 | boldcolors = []uint16{ 48 | INFO: fgWhite | fgIntensity, 49 | CRITICAL: fgMagenta | fgIntensity, 50 | ERROR: fgRed | fgIntensity, 51 | WARNING: fgYellow | fgIntensity, 52 | NOTICE: fgGreen | fgIntensity, 53 | DEBUG: fgCyan | fgIntensity, 54 | } 55 | ) 56 | 57 | type file interface { 58 | Fd() uintptr 59 | } 60 | 61 | // LogBackend utilizes the standard log module. 62 | type LogBackend struct { 63 | Logger *log.Logger 64 | Color bool 65 | 66 | // f is set to a non-nil value if the underlying writer which logs writes to 67 | // implements the file interface. This makes us able to colorise the output. 68 | f file 69 | } 70 | 71 | // NewLogBackend creates a new LogBackend. 72 | func NewLogBackend(out io.Writer, prefix string, flag int) *LogBackend { 73 | b := &LogBackend{Logger: log.New(out, prefix, flag)} 74 | 75 | // Unfortunately, the API used only takes an io.Writer where the Windows API 76 | // need the actual fd to change colors. 77 | if f, ok := out.(file); ok { 78 | b.f = f 79 | } 80 | 81 | return b 82 | } 83 | 84 | func (b *LogBackend) Log(level Level, calldepth int, rec *Record) error { 85 | if b.Color && b.f != nil { 86 | buf := &bytes.Buffer{} 87 | setConsoleTextAttribute(b.f, colors[level]) 88 | buf.Write([]byte(rec.Formatted(calldepth + 1))) 89 | err := b.Logger.Output(calldepth+2, buf.String()) 90 | setConsoleTextAttribute(b.f, fgWhite) 91 | return err 92 | } 93 | return b.Logger.Output(calldepth+2, rec.Formatted(calldepth+1)) 94 | } 95 | 96 | // setConsoleTextAttribute sets the attributes of characters written to the 97 | // console screen buffer by the WriteFile or WriteConsole function. 98 | // See http://msdn.microsoft.com/en-us/library/windows/desktop/ms686047(v=vs.85).aspx. 99 | func setConsoleTextAttribute(f file, attribute uint16) bool { 100 | ok, _, _ := setConsoleTextAttributeProc.Call(f.Fd(), uintptr(attribute), 0) 101 | return ok != 0 102 | } 103 | 104 | func doFmtVerbLevelColor(layout string, level Level, output io.Writer) { 105 | // TODO not supported on Windows since the io.Writer here is actually a 106 | // bytes.Buffer. 107 | } 108 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/level.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013, Örjan Persson. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package logging 6 | 7 | import ( 8 | "errors" 9 | "strings" 10 | "sync" 11 | ) 12 | 13 | // ErrInvalidLogLevel is used when an invalid log level has been used. 14 | var ErrInvalidLogLevel = errors.New("logger: invalid log level") 15 | 16 | // Level defines all available log levels for log messages. 17 | type Level int 18 | 19 | // Log levels. 20 | const ( 21 | CRITICAL Level = iota 22 | ERROR 23 | WARNING 24 | NOTICE 25 | INFO 26 | DEBUG 27 | ) 28 | 29 | var levelNames = []string{ 30 | "CRITICAL", 31 | "ERROR", 32 | "WARNING", 33 | "NOTICE", 34 | "INFO", 35 | "DEBUG", 36 | } 37 | 38 | // String returns the string representation of a logging level. 39 | func (p Level) String() string { 40 | return levelNames[p] 41 | } 42 | 43 | // LogLevel returns the log level from a string representation. 44 | func LogLevel(level string) (Level, error) { 45 | for i, name := range levelNames { 46 | if strings.EqualFold(name, level) { 47 | return Level(i), nil 48 | } 49 | } 50 | return ERROR, ErrInvalidLogLevel 51 | } 52 | 53 | // Leveled interface is the interface required to be able to add leveled 54 | // logging. 55 | type Leveled interface { 56 | GetLevel(string) Level 57 | SetLevel(Level, string) 58 | IsEnabledFor(Level, string) bool 59 | } 60 | 61 | // LeveledBackend is a log backend with additional knobs for setting levels on 62 | // individual modules to different levels. 63 | type LeveledBackend interface { 64 | Backend 65 | Leveled 66 | } 67 | 68 | type moduleLeveled struct { 69 | levels map[string]Level 70 | backend Backend 71 | formatter Formatter 72 | once sync.Once 73 | } 74 | 75 | // AddModuleLevel wraps a log backend with knobs to have different log levels 76 | // for different modules. 77 | func AddModuleLevel(backend Backend) LeveledBackend { 78 | var leveled LeveledBackend 79 | var ok bool 80 | if leveled, ok = backend.(LeveledBackend); !ok { 81 | leveled = &moduleLeveled{ 82 | levels: make(map[string]Level), 83 | backend: backend, 84 | } 85 | } 86 | return leveled 87 | } 88 | 89 | // GetLevel returns the log level for the given module. 90 | func (l *moduleLeveled) GetLevel(module string) Level { 91 | level, exists := l.levels[module] 92 | if exists == false { 93 | level, exists = l.levels[""] 94 | // no configuration exists, default to debug 95 | if exists == false { 96 | level = DEBUG 97 | } 98 | } 99 | return level 100 | } 101 | 102 | // SetLevel sets the log level for the given module. 103 | func (l *moduleLeveled) SetLevel(level Level, module string) { 104 | l.levels[module] = level 105 | } 106 | 107 | // IsEnabledFor will return true if logging is enabled for the given module. 108 | func (l *moduleLeveled) IsEnabledFor(level Level, module string) bool { 109 | return level <= l.GetLevel(module) 110 | } 111 | 112 | func (l *moduleLeveled) Log(level Level, calldepth int, rec *Record) (err error) { 113 | if l.IsEnabledFor(level, rec.Module) { 114 | // TODO get rid of traces of formatter here. BackendFormatter should be used. 115 | rec.formatter = l.getFormatterAndCacheCurrent() 116 | err = l.backend.Log(level, calldepth+1, rec) 117 | } 118 | return 119 | } 120 | 121 | func (l *moduleLeveled) getFormatterAndCacheCurrent() Formatter { 122 | l.once.Do(func() { 123 | if l.formatter == nil { 124 | l.formatter = getFormatter() 125 | } 126 | }) 127 | return l.formatter 128 | } 129 | -------------------------------------------------------------------------------- /vncclient/client_auth.go: -------------------------------------------------------------------------------- 1 | package vncclient 2 | 3 | import ( 4 | "net" 5 | 6 | "crypto/des" 7 | "encoding/binary" 8 | ) 9 | 10 | // A ClientAuth implements a method of authenticating with a remote server. 11 | type ClientAuth interface { 12 | // SecurityType returns the byte identifier sent by the server to 13 | // identify this authentication scheme. 14 | SecurityType() uint8 15 | 16 | // Handshake is called when the authentication handshake should be 17 | // performed, as part of the general RFB handshake. (see 7.2.1) 18 | Handshake(net.Conn) error 19 | } 20 | 21 | // ClientAuthNone is the "none" authentication. See 7.2.1 22 | type ClientAuthNone byte 23 | 24 | func (*ClientAuthNone) SecurityType() uint8 { 25 | return 1 26 | } 27 | 28 | func (*ClientAuthNone) Handshake(net.Conn) error { 29 | return nil 30 | } 31 | 32 | // PasswordAuth is VNC authentication, 7.2.2 33 | type PasswordAuth struct { 34 | Password string 35 | } 36 | 37 | func (p *PasswordAuth) SecurityType() uint8 { 38 | return 2 39 | } 40 | 41 | func (p *PasswordAuth) Handshake(c net.Conn) error { 42 | randomValue := make([]uint8, 16) 43 | if err := binary.Read(c, binary.BigEndian, &randomValue); err != nil { 44 | return err 45 | } 46 | 47 | crypted, err := p.encrypt(p.Password, randomValue) 48 | 49 | if (err != nil) { 50 | return err 51 | } 52 | 53 | if err := binary.Write(c, binary.BigEndian, &crypted); err != nil { 54 | return err 55 | } 56 | 57 | return nil 58 | } 59 | 60 | func (p *PasswordAuth) reverseBits(b byte) byte { 61 | var reverse = [256]int{ 62 | 0, 128, 64, 192, 32, 160, 96, 224, 63 | 16, 144, 80, 208, 48, 176, 112, 240, 64 | 8, 136, 72, 200, 40, 168, 104, 232, 65 | 24, 152, 88, 216, 56, 184, 120, 248, 66 | 4, 132, 68, 196, 36, 164, 100, 228, 67 | 20, 148, 84, 212, 52, 180, 116, 244, 68 | 12, 140, 76, 204, 44, 172, 108, 236, 69 | 28, 156, 92, 220, 60, 188, 124, 252, 70 | 2, 130, 66, 194, 34, 162, 98, 226, 71 | 18, 146, 82, 210, 50, 178, 114, 242, 72 | 10, 138, 74, 202, 42, 170, 106, 234, 73 | 26, 154, 90, 218, 58, 186, 122, 250, 74 | 6, 134, 70, 198, 38, 166, 102, 230, 75 | 22, 150, 86, 214, 54, 182, 118, 246, 76 | 14, 142, 78, 206, 46, 174, 110, 238, 77 | 30, 158, 94, 222, 62, 190, 126, 254, 78 | 1, 129, 65, 193, 33, 161, 97, 225, 79 | 17, 145, 81, 209, 49, 177, 113, 241, 80 | 9, 137, 73, 201, 41, 169, 105, 233, 81 | 25, 153, 89, 217, 57, 185, 121, 249, 82 | 5, 133, 69, 197, 37, 165, 101, 229, 83 | 21, 149, 85, 213, 53, 181, 117, 245, 84 | 13, 141, 77, 205, 45, 173, 109, 237, 85 | 29, 157, 93, 221, 61, 189, 125, 253, 86 | 3, 131, 67, 195, 35, 163, 99, 227, 87 | 19, 147, 83, 211, 51, 179, 115, 243, 88 | 11, 139, 75, 203, 43, 171, 107, 235, 89 | 27, 155, 91, 219, 59, 187, 123, 251, 90 | 7, 135, 71, 199, 39, 167, 103, 231, 91 | 23, 151, 87, 215, 55, 183, 119, 247, 92 | 15, 143, 79, 207, 47, 175, 111, 239, 93 | 31, 159, 95, 223, 63, 191, 127, 255, 94 | } 95 | 96 | return byte(reverse[int(b)]) 97 | } 98 | 99 | func (p *PasswordAuth) encrypt(key string, bytes []byte) ([]byte, error) { 100 | keyBytes := []byte{0,0,0,0,0,0,0,0} 101 | 102 | if len(key) > 8 { 103 | key = key[:8] 104 | } 105 | 106 | for i := 0; i < len(key); i++ { 107 | keyBytes[i] = p.reverseBits(key[i]) 108 | } 109 | 110 | block, err := des.NewCipher(keyBytes) 111 | 112 | if err != nil { 113 | return nil, err 114 | } 115 | 116 | result1 := make([]byte, 8) 117 | block.Encrypt(result1, bytes) 118 | result2 := make([]byte, 8) 119 | block.Encrypt(result2, bytes[8:]) 120 | 121 | crypted := append(result1, result2...) 122 | 123 | return crypted, nil 124 | } 125 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/deps/mingw/_mingw_dxhelper.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the mingw-w64 runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | 7 | #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS) 8 | #define NONAMELESSUNION 1 9 | #endif 10 | #if defined(NONAMELESSSTRUCT) && \ 11 | !defined(NONAMELESSUNION) 12 | #define NONAMELESSUNION 1 13 | #endif 14 | #if defined(NONAMELESSUNION) && \ 15 | !defined(NONAMELESSSTRUCT) 16 | #define NONAMELESSSTRUCT 1 17 | #endif 18 | #if !defined(__GNU_EXTENSION) 19 | #if defined(__GNUC__) || defined(__GNUG__) 20 | #define __GNU_EXTENSION __extension__ 21 | #else 22 | #define __GNU_EXTENSION 23 | #endif 24 | #endif /* __extension__ */ 25 | 26 | #ifndef __ANONYMOUS_DEFINED 27 | #define __ANONYMOUS_DEFINED 28 | #if defined(__GNUC__) || defined(__GNUG__) 29 | #define _ANONYMOUS_UNION __extension__ 30 | #define _ANONYMOUS_STRUCT __extension__ 31 | #else 32 | #define _ANONYMOUS_UNION 33 | #define _ANONYMOUS_STRUCT 34 | #endif 35 | #ifndef NONAMELESSUNION 36 | #define _UNION_NAME(x) 37 | #define _STRUCT_NAME(x) 38 | #else /* NONAMELESSUNION */ 39 | #define _UNION_NAME(x) x 40 | #define _STRUCT_NAME(x) x 41 | #endif 42 | #endif /* __ANONYMOUS_DEFINED */ 43 | 44 | #ifndef DUMMYUNIONNAME 45 | # ifdef NONAMELESSUNION 46 | # define DUMMYUNIONNAME u 47 | # define DUMMYUNIONNAME1 u1 /* Wine uses this variant */ 48 | # define DUMMYUNIONNAME2 u2 49 | # define DUMMYUNIONNAME3 u3 50 | # define DUMMYUNIONNAME4 u4 51 | # define DUMMYUNIONNAME5 u5 52 | # define DUMMYUNIONNAME6 u6 53 | # define DUMMYUNIONNAME7 u7 54 | # define DUMMYUNIONNAME8 u8 55 | # define DUMMYUNIONNAME9 u9 56 | # else /* NONAMELESSUNION */ 57 | # define DUMMYUNIONNAME 58 | # define DUMMYUNIONNAME1 /* Wine uses this variant */ 59 | # define DUMMYUNIONNAME2 60 | # define DUMMYUNIONNAME3 61 | # define DUMMYUNIONNAME4 62 | # define DUMMYUNIONNAME5 63 | # define DUMMYUNIONNAME6 64 | # define DUMMYUNIONNAME7 65 | # define DUMMYUNIONNAME8 66 | # define DUMMYUNIONNAME9 67 | # endif 68 | #endif /* DUMMYUNIONNAME */ 69 | 70 | #if !defined(DUMMYUNIONNAME1) /* MinGW does not define this one */ 71 | # ifdef NONAMELESSUNION 72 | # define DUMMYUNIONNAME1 u1 /* Wine uses this variant */ 73 | # else 74 | # define DUMMYUNIONNAME1 /* Wine uses this variant */ 75 | # endif 76 | #endif /* DUMMYUNIONNAME1 */ 77 | 78 | #ifndef DUMMYSTRUCTNAME 79 | # ifdef NONAMELESSUNION 80 | # define DUMMYSTRUCTNAME s 81 | # define DUMMYSTRUCTNAME1 s1 /* Wine uses this variant */ 82 | # define DUMMYSTRUCTNAME2 s2 83 | # define DUMMYSTRUCTNAME3 s3 84 | # define DUMMYSTRUCTNAME4 s4 85 | # define DUMMYSTRUCTNAME5 s5 86 | # else 87 | # define DUMMYSTRUCTNAME 88 | # define DUMMYSTRUCTNAME1 /* Wine uses this variant */ 89 | # define DUMMYSTRUCTNAME2 90 | # define DUMMYSTRUCTNAME3 91 | # define DUMMYSTRUCTNAME4 92 | # define DUMMYSTRUCTNAME5 93 | # endif 94 | #endif /* DUMMYSTRUCTNAME */ 95 | 96 | /* These are for compatibility with the Wine source tree */ 97 | 98 | #ifndef WINELIB_NAME_AW 99 | # ifdef __MINGW_NAME_AW 100 | # define WINELIB_NAME_AW __MINGW_NAME_AW 101 | # else 102 | # ifdef UNICODE 103 | # define WINELIB_NAME_AW(func) func##W 104 | # else 105 | # define WINELIB_NAME_AW(func) func##A 106 | # endif 107 | # endif 108 | #endif /* WINELIB_NAME_AW */ 109 | 110 | #ifndef DECL_WINELIB_TYPE_AW 111 | # ifdef __MINGW_TYPEDEF_AW 112 | # define DECL_WINELIB_TYPE_AW __MINGW_TYPEDEF_AW 113 | # else 114 | # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type; 115 | # endif 116 | #endif /* DECL_WINELIB_TYPE_AW */ 117 | 118 | -------------------------------------------------------------------------------- /vncclient/client_auth_test.go: -------------------------------------------------------------------------------- 1 | package vncclient 2 | 3 | import ( 4 | "testing" 5 | "net" 6 | "time" 7 | "bytes" 8 | ) 9 | 10 | type fakeNetConnection struct { 11 | DataToSend []byte 12 | Test *testing.T 13 | ExpectData []byte 14 | Finished bool 15 | Matched bool 16 | } 17 | 18 | func (fc fakeNetConnection) Read(b []byte) (n int, err error) { 19 | for i := 0; i < 16; i++ { 20 | b[i] = fc.DataToSend[i] 21 | } 22 | 23 | fc.Finished = false 24 | 25 | return len(b), nil 26 | } 27 | 28 | func (fc *fakeNetConnection) Write(b []byte) (n int, err error) { 29 | fc.Matched = bytes.Equal(b, fc.ExpectData) 30 | fc.Finished = true 31 | 32 | return len(b), nil 33 | } 34 | 35 | func (fc *fakeNetConnection) Close() error { return nil; } 36 | func (fc *fakeNetConnection) LocalAddr() net.Addr { return nil; } 37 | func (fc *fakeNetConnection) RemoteAddr() net.Addr { return nil; } 38 | func (fc *fakeNetConnection) SetDeadline(t time.Time) error { return nil; } 39 | func (fc *fakeNetConnection) SetReadDeadline(t time.Time) error { return nil; } 40 | func (fc *fakeNetConnection) SetWriteDeadline(t time.Time) error { return nil; } 41 | 42 | func TestClientAuthNone_Impl(t *testing.T) { 43 | var raw interface{} 44 | raw = new(ClientAuthNone) 45 | if _, ok := raw.(ClientAuth); !ok { 46 | t.Fatal("ClientAuthNone doesn't implement ClientAuth") 47 | } 48 | } 49 | 50 | func TestClientAuthPasswordSuccess_Impl(t *testing.T) { 51 | // Values ripped using WireShark 52 | randomValue := []byte{ 53 | 0xa4, 54 | 0x51, 55 | 0x3f, 56 | 0xa5, 57 | 0x1f, 58 | 0x87, 59 | 0x06, 60 | 0x10, 61 | 0xa4, 62 | 0x5f, 63 | 0xae, 64 | 0xbf, 65 | 0x4d, 66 | 0xac, 67 | 0x12, 68 | 0x22, 69 | } 70 | 71 | expectedResponse := []byte{ 72 | 0x71, 73 | 0xe4, 74 | 0x41, 75 | 0x30, 76 | 0x43, 77 | 0x65, 78 | 0x4e, 79 | 0x39, 80 | 0xda, 81 | 0x6d, 82 | 0x49, 83 | 0x93, 84 | 0x43, 85 | 0xf6, 86 | 0x5e, 87 | 0x29, 88 | } 89 | 90 | raw := PasswordAuth{Password: "Ch_#!T@8"} 91 | 92 | // Only about 12 hours into Go at the moment... 93 | // if _, ok := raw.(ClientAuth); !ok { 94 | // t.Fatal("PasswordAuth doesn't implement ClientAuth") 95 | // } 96 | 97 | conn := &fakeNetConnection{DataToSend: randomValue, ExpectData: expectedResponse, Test: t} 98 | err := raw.Handshake(conn) 99 | 100 | if (err != nil) { 101 | t.Fatal(err) 102 | } 103 | 104 | if !conn.Matched { 105 | t.Fatal("PasswordAuth didn't pass the right response back to the wire") 106 | } 107 | 108 | if !conn.Finished { 109 | t.Fatal("PasswordAuth didn't complete properly") 110 | } 111 | } 112 | 113 | func TestClientAuthPasswordReject_Impl(t *testing.T) { 114 | // Values ripped using WireShark 115 | randomValue := []byte{ 116 | 0xa4, 117 | 0x51, 118 | 0x3f, 119 | 0xa5, 120 | 0x1f, 121 | 0x87, 122 | 0x06, 123 | 0x10, 124 | 0xa4, 125 | 0x5f, 126 | 0xae, 127 | 0xbf, 128 | 0x4d, 129 | 0xac, 130 | 0x12, 131 | 0x22, 132 | } 133 | 134 | expectedResponse := []byte{ 135 | 0x71, 136 | 0xe4, 137 | 0x41, 138 | 0x30, 139 | 0x43, 140 | 0x65, 141 | 0x4e, 142 | 0x39, 143 | 0xda, 144 | 0x6d, 145 | 0x49, 146 | 0x93, 147 | 0x43, 148 | 0xf6, 149 | 0x5e, 150 | 0x29, 151 | } 152 | 153 | raw := PasswordAuth{Password: "Ch_#!T@"} 154 | 155 | conn := &fakeNetConnection{DataToSend: randomValue, ExpectData: expectedResponse, Test: t} 156 | err := raw.Handshake(conn) 157 | 158 | if (err != nil) { 159 | t.Fatal(err) 160 | } 161 | 162 | if conn.Matched { 163 | t.Fatal("PasswordAuth didn't pass the right response back to the wire") 164 | } 165 | 166 | if !conn.Finished { 167 | t.Fatal("PasswordAuth didn't complete properly") 168 | } 169 | } 170 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/gl/v2.1/gl/conversions.go: -------------------------------------------------------------------------------- 1 | // Glow automatically generated OpenGL binding: http://github.com/go-gl/glow 2 | 3 | package gl 4 | 5 | import ( 6 | "fmt" 7 | "reflect" 8 | "strings" 9 | "unsafe" 10 | ) 11 | 12 | // #include 13 | import "C" 14 | 15 | // Ptr takes a slice or pointer (to a singular scalar value or the first 16 | // element of an array or slice) and returns its GL-compatible address. 17 | // 18 | // For example: 19 | // 20 | // var data []uint8 21 | // ... 22 | // gl.TexImage2D(gl.TEXTURE_2D, ..., gl.UNSIGNED_BYTE, gl.Ptr(&data[0])) 23 | func Ptr(data interface{}) unsafe.Pointer { 24 | if data == nil { 25 | return unsafe.Pointer(nil) 26 | } 27 | var addr unsafe.Pointer 28 | v := reflect.ValueOf(data) 29 | switch v.Type().Kind() { 30 | case reflect.Ptr: 31 | e := v.Elem() 32 | switch e.Kind() { 33 | case 34 | reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, 35 | reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, 36 | reflect.Float32, reflect.Float64: 37 | addr = unsafe.Pointer(e.UnsafeAddr()) 38 | default: 39 | panic(fmt.Errorf("unsupported pointer to type %s; must be a slice or pointer to a singular scalar value or the first element of an array or slice", e.Kind())) 40 | } 41 | case reflect.Uintptr: 42 | addr = unsafe.Pointer(v.Pointer()) 43 | case reflect.Slice: 44 | addr = unsafe.Pointer(v.Index(0).UnsafeAddr()) 45 | default: 46 | panic(fmt.Errorf("unsupported type %s; must be a slice or pointer to a singular scalar value or the first element of an array or slice", v.Type())) 47 | } 48 | return addr 49 | } 50 | 51 | // PtrOffset takes a pointer offset and returns a GL-compatible pointer. 52 | // Useful for functions such as glVertexAttribPointer that take pointer 53 | // parameters indicating an offset rather than an absolute memory address. 54 | func PtrOffset(offset int) unsafe.Pointer { 55 | return unsafe.Pointer(uintptr(offset)) 56 | } 57 | 58 | // Str takes a null-terminated Go string and returns its GL-compatible address. 59 | // This function reaches into Go string storage in an unsafe way so the caller 60 | // must ensure the string is not garbage collected. 61 | func Str(str string) *uint8 { 62 | if !strings.HasSuffix(str, "\x00") { 63 | panic("str argument missing null terminator: " + str) 64 | } 65 | header := (*reflect.StringHeader)(unsafe.Pointer(&str)) 66 | return (*uint8)(unsafe.Pointer(header.Data)) 67 | } 68 | 69 | // GoStr takes a null-terminated string returned by OpenGL and constructs a 70 | // corresponding Go string. 71 | func GoStr(cstr *uint8) string { 72 | return C.GoString((*C.char)(unsafe.Pointer(cstr))) 73 | } 74 | 75 | // Strs takes a list of Go strings (with or without null-termination) and 76 | // returns their C counterpart. 77 | // 78 | // The returned free function must be called once you are done using the strings 79 | // in order to free the memory. 80 | // 81 | // If no strings are provided as a parameter this function will panic. 82 | func Strs(strs ...string) (cstrs **uint8, free func()) { 83 | if len(strs) == 0 { 84 | panic("Strs: expected at least 1 string") 85 | } 86 | 87 | // Allocate a contiguous array large enough to hold all the strings' contents. 88 | n := 0 89 | for i := range strs { 90 | n += len(strs[i]) 91 | } 92 | data := C.malloc(C.size_t(n)) 93 | 94 | // Copy all the strings into data. 95 | dataSlice := *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{ 96 | Data: uintptr(data), 97 | Len: n, 98 | Cap: n, 99 | })) 100 | css := make([]*uint8, len(strs)) // Populated with pointers to each string. 101 | offset := 0 102 | for i := range strs { 103 | copy(dataSlice[offset:offset+len(strs[i])], strs[i][:]) // Copy strs[i] into proper data location. 104 | css[i] = (*uint8)(unsafe.Pointer(&dataSlice[offset])) // Set a pointer to it. 105 | offset += len(strs[i]) 106 | } 107 | 108 | return (**uint8)(&css[0]), func() { C.free(data) } 109 | } 110 | -------------------------------------------------------------------------------- /vendor/github.com/cheggaaa/pb/README.md: -------------------------------------------------------------------------------- 1 | # Terminal progress bar for Go 2 | 3 | Simple progress bar for console programs. 4 | 5 | 6 | ## Installation 7 | 8 | ``` 9 | go get gopkg.in/cheggaaa/pb.v1 10 | ``` 11 | 12 | ## Usage 13 | 14 | ```Go 15 | package main 16 | 17 | import ( 18 | "gopkg.in/cheggaaa/pb.v1" 19 | "time" 20 | ) 21 | 22 | func main() { 23 | count := 100000 24 | bar := pb.StartNew(count) 25 | for i := 0; i < count; i++ { 26 | bar.Increment() 27 | time.Sleep(time.Millisecond) 28 | } 29 | bar.FinishPrint("The End!") 30 | } 31 | 32 | ``` 33 | 34 | Result will be like this: 35 | 36 | ``` 37 | > go run test.go 38 | 37158 / 100000 [================>_______________________________] 37.16% 1m11s 39 | ``` 40 | 41 | ## Customization 42 | 43 | ```Go 44 | // create bar 45 | bar := pb.New(count) 46 | 47 | // refresh info every second (default 200ms) 48 | bar.SetRefreshRate(time.Second) 49 | 50 | // show percents (by default already true) 51 | bar.ShowPercent = true 52 | 53 | // show bar (by default already true) 54 | bar.ShowBar = true 55 | 56 | // no counters 57 | bar.ShowCounters = false 58 | 59 | // show "time left" 60 | bar.ShowTimeLeft = true 61 | 62 | // show average speed 63 | bar.ShowSpeed = true 64 | 65 | // sets the width of the progress bar 66 | bar.SetWidth(80) 67 | 68 | // sets the width of the progress bar, but if terminal size smaller will be ignored 69 | bar.SetMaxWidth(80) 70 | 71 | // convert output to readable format (like KB, MB) 72 | bar.SetUnits(pb.U_BYTES) 73 | 74 | // and start 75 | bar.Start() 76 | ``` 77 | 78 | ## Progress bar for IO Operations 79 | 80 | ```go 81 | // create and start bar 82 | bar := pb.New(myDataLen).SetUnits(pb.U_BYTES) 83 | bar.Start() 84 | 85 | // my io.Reader 86 | r := myReader 87 | 88 | // my io.Writer 89 | w := myWriter 90 | 91 | // create proxy reader 92 | reader := bar.NewProxyReader(r) 93 | 94 | // and copy from pb reader 95 | io.Copy(w, reader) 96 | 97 | ``` 98 | 99 | ```go 100 | // create and start bar 101 | bar := pb.New(myDataLen).SetUnits(pb.U_BYTES) 102 | bar.Start() 103 | 104 | // my io.Reader 105 | r := myReader 106 | 107 | // my io.Writer 108 | w := myWriter 109 | 110 | // create multi writer 111 | writer := io.MultiWriter(w, bar) 112 | 113 | // and copy 114 | io.Copy(writer, r) 115 | 116 | bar.Finish() 117 | ``` 118 | 119 | ## Custom Progress Bar Look-and-feel 120 | 121 | ```go 122 | bar.Format("<.- >") 123 | ``` 124 | 125 | ## Multiple Progress Bars (experimental and unstable) 126 | 127 | Do not print to terminal while pool is active. 128 | 129 | ```go 130 | package main 131 | 132 | import ( 133 | "math/rand" 134 | "sync" 135 | "time" 136 | 137 | "gopkg.in/cheggaaa/pb.v1" 138 | ) 139 | 140 | func main() { 141 | // create bars 142 | first := pb.New(200).Prefix("First ") 143 | second := pb.New(200).Prefix("Second ") 144 | third := pb.New(200).Prefix("Third ") 145 | // start pool 146 | pool, err := pb.StartPool(first, second, third) 147 | if err != nil { 148 | panic(err) 149 | } 150 | // update bars 151 | wg := new(sync.WaitGroup) 152 | for _, bar := range []*pb.ProgressBar{first, second, third} { 153 | wg.Add(1) 154 | go func(cb *pb.ProgressBar) { 155 | for n := 0; n < 200; n++ { 156 | cb.Increment() 157 | time.Sleep(time.Millisecond * time.Duration(rand.Intn(100))) 158 | } 159 | cb.Finish() 160 | wg.Done() 161 | }(bar) 162 | } 163 | wg.Wait() 164 | // close pool 165 | pool.Stop() 166 | } 167 | ``` 168 | 169 | The result will be as follows: 170 | 171 | ``` 172 | $ go run example/multiple.go 173 | First 141 / 1000 [===============>---------------------------------------] 14.10 % 44s 174 | Second 139 / 1000 [==============>---------------------------------------] 13.90 % 44s 175 | Third 152 / 1000 [================>--------------------------------------] 15.20 % 40s 176 | ``` 177 | -------------------------------------------------------------------------------- /flexflate/reader_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package flexflate 6 | 7 | import ( 8 | "bytes" 9 | "io" 10 | "io/ioutil" 11 | "runtime" 12 | "strings" 13 | "testing" 14 | ) 15 | 16 | func TestNlitOutOfRange(t *testing.T) { 17 | // Trying to decode this bogus flate data, which has a Huffman table 18 | // with nlit=288, should not panic. 19 | io.Copy(ioutil.Discard, NewReader(strings.NewReader( 20 | "\xfc\xfe\x36\xe7\x5e\x1c\xef\xb3\x55\x58\x77\xb6\x56\xb5\x43\xf4"+ 21 | "\x6f\xf2\xd2\xe6\x3d\x99\xa0\x85\x8c\x48\xeb\xf8\xda\x83\x04\x2a"+ 22 | "\x75\xc4\xf8\x0f\x12\x11\xb9\xb4\x4b\x09\xa0\xbe\x8b\x91\x4c"))) 23 | } 24 | 25 | const ( 26 | digits = iota 27 | twain 28 | ) 29 | 30 | var testfiles = []string{ 31 | // Digits is the digits of the irrational number e. Its decimal representation 32 | // does not repeat, but there are only 10 possible digits, so it should be 33 | // reasonably compressible. 34 | digits: "../testdata/e.txt", 35 | // Twain is Project Gutenberg's edition of Mark Twain's classic English novel. 36 | twain: "../testdata/Mark.Twain-Tom.Sawyer.txt", 37 | } 38 | 39 | func benchmarkDecode(b *testing.B, testfile, level, n int) { 40 | b.ReportAllocs() 41 | b.StopTimer() 42 | b.SetBytes(int64(n)) 43 | buf0, err := ioutil.ReadFile(testfiles[testfile]) 44 | if err != nil { 45 | b.Fatal(err) 46 | } 47 | if len(buf0) == 0 { 48 | b.Fatalf("test file %q has no data", testfiles[testfile]) 49 | } 50 | compressed := new(bytes.Buffer) 51 | w, err := NewWriter(compressed, level) 52 | if err != nil { 53 | b.Fatal(err) 54 | } 55 | for i := 0; i < n; i += len(buf0) { 56 | if len(buf0) > n-i { 57 | buf0 = buf0[:n-i] 58 | } 59 | io.Copy(w, bytes.NewReader(buf0)) 60 | } 61 | w.Close() 62 | buf1 := compressed.Bytes() 63 | buf0, compressed, w = nil, nil, nil 64 | runtime.GC() 65 | b.StartTimer() 66 | for i := 0; i < b.N; i++ { 67 | io.Copy(ioutil.Discard, NewReader(bytes.NewReader(buf1))) 68 | } 69 | } 70 | 71 | // These short names are so that gofmt doesn't break the BenchmarkXxx function 72 | // bodies below over multiple lines. 73 | const ( 74 | speed = BestSpeed 75 | default_ = DefaultCompression 76 | compress = BestCompression 77 | ) 78 | 79 | func BenchmarkDecodeDigitsSpeed1e4(b *testing.B) { benchmarkDecode(b, digits, speed, 1e4) } 80 | func BenchmarkDecodeDigitsSpeed1e5(b *testing.B) { benchmarkDecode(b, digits, speed, 1e5) } 81 | func BenchmarkDecodeDigitsSpeed1e6(b *testing.B) { benchmarkDecode(b, digits, speed, 1e6) } 82 | func BenchmarkDecodeDigitsDefault1e4(b *testing.B) { benchmarkDecode(b, digits, default_, 1e4) } 83 | func BenchmarkDecodeDigitsDefault1e5(b *testing.B) { benchmarkDecode(b, digits, default_, 1e5) } 84 | func BenchmarkDecodeDigitsDefault1e6(b *testing.B) { benchmarkDecode(b, digits, default_, 1e6) } 85 | func BenchmarkDecodeDigitsCompress1e4(b *testing.B) { benchmarkDecode(b, digits, compress, 1e4) } 86 | func BenchmarkDecodeDigitsCompress1e5(b *testing.B) { benchmarkDecode(b, digits, compress, 1e5) } 87 | func BenchmarkDecodeDigitsCompress1e6(b *testing.B) { benchmarkDecode(b, digits, compress, 1e6) } 88 | func BenchmarkDecodeTwainSpeed1e4(b *testing.B) { benchmarkDecode(b, twain, speed, 1e4) } 89 | func BenchmarkDecodeTwainSpeed1e5(b *testing.B) { benchmarkDecode(b, twain, speed, 1e5) } 90 | func BenchmarkDecodeTwainSpeed1e6(b *testing.B) { benchmarkDecode(b, twain, speed, 1e6) } 91 | func BenchmarkDecodeTwainDefault1e4(b *testing.B) { benchmarkDecode(b, twain, default_, 1e4) } 92 | func BenchmarkDecodeTwainDefault1e5(b *testing.B) { benchmarkDecode(b, twain, default_, 1e5) } 93 | func BenchmarkDecodeTwainDefault1e6(b *testing.B) { benchmarkDecode(b, twain, default_, 1e6) } 94 | func BenchmarkDecodeTwainCompress1e4(b *testing.B) { benchmarkDecode(b, twain, compress, 1e4) } 95 | func BenchmarkDecodeTwainCompress1e5(b *testing.B) { benchmarkDecode(b, twain, compress, 1e5) } 96 | func BenchmarkDecodeTwainCompress1e6(b *testing.B) { benchmarkDecode(b, twain, compress, 1e6) } 97 | -------------------------------------------------------------------------------- /vncclient/pixel_format.go: -------------------------------------------------------------------------------- 1 | package vncclient 2 | 3 | import ( 4 | "bytes" 5 | "encoding/binary" 6 | "io" 7 | ) 8 | 9 | // PixelFormat describes the way a pixel is formatted for a VNC connection. 10 | // 11 | // See RFC 6143 Section 7.4 for information on each of the fields. 12 | type PixelFormat struct { 13 | BPP uint8 14 | Depth uint8 15 | BigEndian bool 16 | TrueColor bool 17 | RedMax uint16 18 | GreenMax uint16 19 | BlueMax uint16 20 | RedShift uint8 21 | GreenShift uint8 22 | BlueShift uint8 23 | } 24 | 25 | func ReadPixelFormat(r io.Reader, result *PixelFormat) error { 26 | var rawPixelFormat [16]byte 27 | if _, err := io.ReadFull(r, rawPixelFormat[:]); err != nil { 28 | return err 29 | } 30 | 31 | var pfBoolByte uint8 32 | brPF := bytes.NewReader(rawPixelFormat[:]) 33 | if err := binary.Read(brPF, binary.BigEndian, &result.BPP); err != nil { 34 | return err 35 | } 36 | 37 | if err := binary.Read(brPF, binary.BigEndian, &result.Depth); err != nil { 38 | return err 39 | } 40 | 41 | if err := binary.Read(brPF, binary.BigEndian, &pfBoolByte); err != nil { 42 | return err 43 | } 44 | 45 | if pfBoolByte != 0 { 46 | // Big endian is true 47 | result.BigEndian = true 48 | } 49 | 50 | if err := binary.Read(brPF, binary.BigEndian, &pfBoolByte); err != nil { 51 | return err 52 | } 53 | 54 | if pfBoolByte != 0 { 55 | // True Color is true. So we also have to read all the color max & shifts. 56 | result.TrueColor = true 57 | 58 | if err := binary.Read(brPF, binary.BigEndian, &result.RedMax); err != nil { 59 | return err 60 | } 61 | 62 | if err := binary.Read(brPF, binary.BigEndian, &result.GreenMax); err != nil { 63 | return err 64 | } 65 | 66 | if err := binary.Read(brPF, binary.BigEndian, &result.BlueMax); err != nil { 67 | return err 68 | } 69 | 70 | if err := binary.Read(brPF, binary.BigEndian, &result.RedShift); err != nil { 71 | return err 72 | } 73 | 74 | if err := binary.Read(brPF, binary.BigEndian, &result.GreenShift); err != nil { 75 | return err 76 | } 77 | 78 | if err := binary.Read(brPF, binary.BigEndian, &result.BlueShift); err != nil { 79 | return err 80 | } 81 | } 82 | 83 | return nil 84 | } 85 | 86 | func WritePixelFormat(format *PixelFormat) ([]byte, error) { 87 | var buf bytes.Buffer 88 | 89 | // Byte 1 90 | if err := binary.Write(&buf, binary.BigEndian, format.BPP); err != nil { 91 | return nil, err 92 | } 93 | 94 | // Byte 2 95 | if err := binary.Write(&buf, binary.BigEndian, format.Depth); err != nil { 96 | return nil, err 97 | } 98 | 99 | var boolByte byte 100 | if format.BigEndian { 101 | boolByte = 1 102 | } else { 103 | boolByte = 0 104 | } 105 | 106 | // Byte 3 (BigEndian) 107 | if err := binary.Write(&buf, binary.BigEndian, boolByte); err != nil { 108 | return nil, err 109 | } 110 | 111 | if format.TrueColor { 112 | boolByte = 1 113 | } else { 114 | boolByte = 0 115 | } 116 | 117 | // Byte 4 (TrueColor) 118 | if err := binary.Write(&buf, binary.BigEndian, boolByte); err != nil { 119 | return nil, err 120 | } 121 | 122 | // If we have true color enabled then we have to fill in the rest of the 123 | // structure with the color values. 124 | if format.TrueColor { 125 | if err := binary.Write(&buf, binary.BigEndian, format.RedMax); err != nil { 126 | return nil, err 127 | } 128 | 129 | if err := binary.Write(&buf, binary.BigEndian, format.GreenMax); err != nil { 130 | return nil, err 131 | } 132 | 133 | if err := binary.Write(&buf, binary.BigEndian, format.BlueMax); err != nil { 134 | return nil, err 135 | } 136 | 137 | if err := binary.Write(&buf, binary.BigEndian, format.RedShift); err != nil { 138 | return nil, err 139 | } 140 | 141 | if err := binary.Write(&buf, binary.BigEndian, format.GreenShift); err != nil { 142 | return nil, err 143 | } 144 | 145 | if err := binary.Write(&buf, binary.BigEndian, format.BlueShift); err != nil { 146 | return nil, err 147 | } 148 | } 149 | 150 | return buf.Bytes()[0:16], nil 151 | } 152 | -------------------------------------------------------------------------------- /vendor/github.com/juju/errors/error.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Canonical Ltd. 2 | // Licensed under the LGPLv3, see LICENCE file for details. 3 | 4 | package errors 5 | 6 | import ( 7 | "fmt" 8 | "reflect" 9 | "runtime" 10 | ) 11 | 12 | // Err holds a description of an error along with information about 13 | // where the error was created. 14 | // 15 | // It may be embedded in custom error types to add extra information that 16 | // this errors package can understand. 17 | type Err struct { 18 | // message holds an annotation of the error. 19 | message string 20 | 21 | // cause holds the cause of the error as returned 22 | // by the Cause method. 23 | cause error 24 | 25 | // previous holds the previous error in the error stack, if any. 26 | previous error 27 | 28 | // file and line hold the source code location where the error was 29 | // created. 30 | file string 31 | line int 32 | } 33 | 34 | // NewErr is used to return an Err for the purpose of embedding in other 35 | // structures. The location is not specified, and needs to be set with a call 36 | // to SetLocation. 37 | // 38 | // For example: 39 | // type FooError struct { 40 | // errors.Err 41 | // code int 42 | // } 43 | // 44 | // func NewFooError(code int) error { 45 | // err := &FooError{errors.NewErr("foo"), code} 46 | // err.SetLocation(1) 47 | // return err 48 | // } 49 | func NewErr(format string, args ...interface{}) Err { 50 | return Err{ 51 | message: fmt.Sprintf(format, args...), 52 | } 53 | } 54 | 55 | // Location is the file and line of where the error was most recently 56 | // created or annotated. 57 | func (e *Err) Location() (filename string, line int) { 58 | return e.file, e.line 59 | } 60 | 61 | // Underlying returns the previous error in the error stack, if any. A client 62 | // should not ever really call this method. It is used to build the error 63 | // stack and should not be introspected by client calls. Or more 64 | // specifically, clients should not depend on anything but the `Cause` of an 65 | // error. 66 | func (e *Err) Underlying() error { 67 | return e.previous 68 | } 69 | 70 | // The Cause of an error is the most recent error in the error stack that 71 | // meets one of these criteria: the original error that was raised; the new 72 | // error that was passed into the Wrap function; the most recently masked 73 | // error; or nil if the error itself is considered the Cause. Normally this 74 | // method is not invoked directly, but instead through the Cause stand alone 75 | // function. 76 | func (e *Err) Cause() error { 77 | return e.cause 78 | } 79 | 80 | // Message returns the message stored with the most recent location. This is 81 | // the empty string if the most recent call was Trace, or the message stored 82 | // with Annotate or Mask. 83 | func (e *Err) Message() string { 84 | return e.message 85 | } 86 | 87 | // Error implements error.Error. 88 | func (e *Err) Error() string { 89 | // We want to walk up the stack of errors showing the annotations 90 | // as long as the cause is the same. 91 | err := e.previous 92 | if !sameError(Cause(err), e.cause) && e.cause != nil { 93 | err = e.cause 94 | } 95 | switch { 96 | case err == nil: 97 | return e.message 98 | case e.message == "": 99 | return err.Error() 100 | } 101 | return fmt.Sprintf("%s: %v", e.message, err) 102 | } 103 | 104 | // SetLocation records the source location of the error at callDepth stack 105 | // frames above the call. 106 | func (e *Err) SetLocation(callDepth int) { 107 | _, file, line, _ := runtime.Caller(callDepth + 1) 108 | e.file = trimGoPath(file) 109 | e.line = line 110 | } 111 | 112 | // StackTrace returns one string for each location recorded in the stack of 113 | // errors. The first value is the originating error, with a line for each 114 | // other annotation or tracing of the error. 115 | func (e *Err) StackTrace() []string { 116 | return errorStack(e) 117 | } 118 | 119 | // Ideally we'd have a way to check identity, but deep equals will do. 120 | func sameError(e1, e2 error) bool { 121 | return reflect.DeepEqual(e1, e2) 122 | } 123 | -------------------------------------------------------------------------------- /vendor/github.com/pixiv/go-libjpeg/jpeg/destinationManager.go: -------------------------------------------------------------------------------- 1 | package jpeg 2 | 3 | // 4 | // Original codes are bollowed from go-thumber. 5 | // Copyright (c) 2014 pixiv Inc. All rights reserved. 6 | // 7 | // See: https://github.com/pixiv/go-thumber 8 | // 9 | 10 | /* 11 | #include 12 | #include 13 | #include 14 | 15 | // exported from golang 16 | void destinationInit(struct jpeg_compress_struct*); 17 | boolean destinationEmpty(struct jpeg_compress_struct*); 18 | void destinationTerm(struct jpeg_compress_struct*); 19 | 20 | static struct jpeg_destination_mgr *malloc_jpeg_destination_mgr(void) { 21 | return malloc(sizeof(struct jpeg_destination_mgr)); 22 | } 23 | 24 | static void free_jpeg_destination_mgr(struct jpeg_destination_mgr *p) { 25 | free(p); 26 | } 27 | 28 | */ 29 | import "C" 30 | 31 | import ( 32 | "io" 33 | "sync" 34 | "unsafe" 35 | ) 36 | 37 | const writeBufferSize = 16384 38 | 39 | var destinationManagerMapMutex sync.RWMutex 40 | var destinationManagerMap = make(map[uintptr]*destinationManager) 41 | 42 | // DestinationManagerMapLen returns the number of globally working destinationManagers for debug. 43 | func DestinationManagerMapLen() int { 44 | return len(destinationManagerMap) 45 | } 46 | 47 | type destinationManager struct { 48 | pub *C.struct_jpeg_destination_mgr 49 | buffer unsafe.Pointer 50 | dest io.Writer 51 | } 52 | 53 | func getDestinationManager(cinfo *C.struct_jpeg_compress_struct) (ret *destinationManager) { 54 | destinationManagerMapMutex.RLock() 55 | defer destinationManagerMapMutex.RUnlock() 56 | return destinationManagerMap[uintptr(unsafe.Pointer(cinfo.dest))] 57 | } 58 | 59 | //export destinationInit 60 | func destinationInit(cinfo *C.struct_jpeg_compress_struct) { 61 | // do nothing 62 | } 63 | 64 | func flushBuffer(mgr *destinationManager, inBuffer int) { 65 | wrote := 0 66 | for wrote != inBuffer { 67 | slice := C.GoBytes(unsafe.Pointer(uintptr(mgr.buffer)+uintptr(wrote)), C.int(inBuffer-wrote)) 68 | bytes, err := mgr.dest.Write(slice) 69 | if err != nil { 70 | releaseDestinationManager(mgr) 71 | panic(err) 72 | } 73 | wrote += int(bytes) 74 | } 75 | mgr.pub.free_in_buffer = writeBufferSize 76 | mgr.pub.next_output_byte = (*C.JOCTET)(mgr.buffer) 77 | } 78 | 79 | //export destinationEmpty 80 | func destinationEmpty(cinfo *C.struct_jpeg_compress_struct) C.boolean { 81 | // need to write *entire* buffer, not subtracting free_in_buffer 82 | mgr := getDestinationManager(cinfo) 83 | flushBuffer(mgr, writeBufferSize) 84 | return C.TRUE 85 | } 86 | 87 | //export destinationTerm 88 | func destinationTerm(cinfo *C.struct_jpeg_compress_struct) { 89 | // just empty buffer 90 | mgr := getDestinationManager(cinfo) 91 | inBuffer := int(writeBufferSize - mgr.pub.free_in_buffer) 92 | flushBuffer(mgr, inBuffer) 93 | } 94 | 95 | func makeDestinationManager(dest io.Writer, cinfo *C.struct_jpeg_compress_struct) (mgr *destinationManager) { 96 | mgr = new(destinationManager) 97 | mgr.dest = dest 98 | mgr.pub = C.malloc_jpeg_destination_mgr() 99 | if mgr.pub == nil { 100 | panic("Failed to allocate C.struct_jpeg_destination_mgr") 101 | } 102 | mgr.buffer = C.malloc(writeBufferSize) 103 | if mgr.buffer == nil { 104 | panic("Failed to allocate buffer") 105 | } 106 | mgr.pub.init_destination = (*[0]byte)(C.destinationInit) 107 | mgr.pub.empty_output_buffer = (*[0]byte)(C.destinationEmpty) 108 | mgr.pub.term_destination = (*[0]byte)(C.destinationTerm) 109 | mgr.pub.free_in_buffer = writeBufferSize 110 | mgr.pub.next_output_byte = (*C.JOCTET)(mgr.buffer) 111 | cinfo.dest = mgr.pub 112 | 113 | destinationManagerMapMutex.Lock() 114 | defer destinationManagerMapMutex.Unlock() 115 | destinationManagerMap[uintptr(unsafe.Pointer(mgr.pub))] = mgr 116 | 117 | return 118 | } 119 | 120 | func releaseDestinationManager(mgr *destinationManager) { 121 | destinationManagerMapMutex.Lock() 122 | defer destinationManagerMapMutex.Unlock() 123 | var key = uintptr(unsafe.Pointer(mgr.pub)) 124 | if _, ok := destinationManagerMap[key]; ok { 125 | delete(destinationManagerMap, key) 126 | C.free_jpeg_destination_mgr(mgr.pub) 127 | C.free(mgr.buffer) 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /flexflate/token.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package flexflate 6 | 7 | const ( 8 | // 2 bits: type 0 = literal 1=EOF 2=Match 3=Unused 9 | // 8 bits: xlength = length - MIN_MATCH_LENGTH 10 | // 22 bits xoffset = offset - MIN_OFFSET_SIZE, or literal 11 | lengthShift = 22 12 | offsetMask = 1< pair into a match token. 74 | func matchToken(xlength uint32, xoffset uint32) token { 75 | return token(matchType + xlength<> lengthShift) } 88 | 89 | func lengthCode(len uint32) uint32 { return lengthCodes[len] } 90 | 91 | // Returns the offset code corresponding to a specific offset 92 | func offsetCode(off uint32) uint32 { 93 | const n = uint32(len(offsetCodes)) 94 | switch { 95 | case off < n: 96 | return offsetCodes[off] 97 | case off>>7 < n: 98 | return offsetCodes[off>>7] + 14 99 | default: 100 | return offsetCodes[off>>14] + 28 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/deps/vulkan/vk_platform.h: -------------------------------------------------------------------------------- 1 | // 2 | // File: vk_platform.h 3 | // 4 | /* 5 | ** Copyright (c) 2014-2015 The Khronos Group Inc. 6 | ** 7 | ** Licensed under the Apache License, Version 2.0 (the "License"); 8 | ** you may not use this file except in compliance with the License. 9 | ** You may obtain a copy of the License at 10 | ** 11 | ** http://www.apache.org/licenses/LICENSE-2.0 12 | ** 13 | ** Unless required by applicable law or agreed to in writing, software 14 | ** distributed under the License is distributed on an "AS IS" BASIS, 15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | ** See the License for the specific language governing permissions and 17 | ** limitations under the License. 18 | */ 19 | 20 | 21 | #ifndef VK_PLATFORM_H_ 22 | #define VK_PLATFORM_H_ 23 | 24 | #ifdef __cplusplus 25 | extern "C" 26 | { 27 | #endif // __cplusplus 28 | 29 | /* 30 | *************************************************************************************************** 31 | * Platform-specific directives and type declarations 32 | *************************************************************************************************** 33 | */ 34 | 35 | /* Platform-specific calling convention macros. 36 | * 37 | * Platforms should define these so that Vulkan clients call Vulkan commands 38 | * with the same calling conventions that the Vulkan implementation expects. 39 | * 40 | * VKAPI_ATTR - Placed before the return type in function declarations. 41 | * Useful for C++11 and GCC/Clang-style function attribute syntax. 42 | * VKAPI_CALL - Placed after the return type in function declarations. 43 | * Useful for MSVC-style calling convention syntax. 44 | * VKAPI_PTR - Placed between the '(' and '*' in function pointer types. 45 | * 46 | * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void); 47 | * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); 48 | */ 49 | #if defined(_WIN32) 50 | // On Windows, Vulkan commands use the stdcall convention 51 | #define VKAPI_ATTR 52 | #define VKAPI_CALL __stdcall 53 | #define VKAPI_PTR VKAPI_CALL 54 | #elif defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__) 55 | // Android does not support Vulkan in native code using the "armeabi" ABI. 56 | #error "Vulkan requires the 'armeabi-v7a' or 'armeabi-v7a-hard' ABI on 32-bit ARM CPUs" 57 | #elif defined(__ANDROID__) && defined(__ARM_ARCH_7A__) 58 | // On Android/ARMv7a, Vulkan functions use the armeabi-v7a-hard calling 59 | // convention, even if the application's native code is compiled with the 60 | // armeabi-v7a calling convention. 61 | #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) 62 | #define VKAPI_CALL 63 | #define VKAPI_PTR VKAPI_ATTR 64 | #else 65 | // On other platforms, use the default calling convention 66 | #define VKAPI_ATTR 67 | #define VKAPI_CALL 68 | #define VKAPI_PTR 69 | #endif 70 | 71 | #include 72 | 73 | #if !defined(VK_NO_STDINT_H) 74 | #if defined(_MSC_VER) && (_MSC_VER < 1600) 75 | typedef signed __int8 int8_t; 76 | typedef unsigned __int8 uint8_t; 77 | typedef signed __int16 int16_t; 78 | typedef unsigned __int16 uint16_t; 79 | typedef signed __int32 int32_t; 80 | typedef unsigned __int32 uint32_t; 81 | typedef signed __int64 int64_t; 82 | typedef unsigned __int64 uint64_t; 83 | #else 84 | #include 85 | #endif 86 | #endif // !defined(VK_NO_STDINT_H) 87 | 88 | #ifdef __cplusplus 89 | } // extern "C" 90 | #endif // __cplusplus 91 | 92 | // Platform-specific headers required by platform window system extensions. 93 | // These are enabled prior to #including "vulkan.h". The same enable then 94 | // controls inclusion of the extension interfaces in vulkan.h. 95 | 96 | #ifdef VK_USE_PLATFORM_ANDROID_KHR 97 | #include 98 | #endif 99 | 100 | #ifdef VK_USE_PLATFORM_MIR_KHR 101 | #include 102 | #endif 103 | 104 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR 105 | #include 106 | #endif 107 | 108 | #ifdef VK_USE_PLATFORM_WIN32_KHR 109 | #include 110 | #endif 111 | 112 | #ifdef VK_USE_PLATFORM_XLIB_KHR 113 | #include 114 | #endif 115 | 116 | #ifdef VK_USE_PLATFORM_XCB_KHR 117 | #include 118 | #endif 119 | 120 | #endif 121 | -------------------------------------------------------------------------------- /vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/mir_platform.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 Mir - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2014-2015 Brandon Schaefer 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_mir_platform_h_ 28 | #define _glfw3_mir_platform_h_ 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | #include 35 | 36 | typedef VkFlags VkMirSurfaceCreateFlagsKHR; 37 | 38 | typedef struct VkMirSurfaceCreateInfoKHR 39 | { 40 | VkStructureType sType; 41 | const void* pNext; 42 | VkMirSurfaceCreateFlagsKHR flags; 43 | MirConnection* connection; 44 | MirSurface* mirSurface; 45 | } VkMirSurfaceCreateInfoKHR; 46 | 47 | typedef VkResult (APIENTRY *PFN_vkCreateMirSurfaceKHR)(VkInstance,const VkMirSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*); 48 | typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)(VkPhysicalDevice,uint32_t,MirConnection*); 49 | 50 | #include "posix_tls.h" 51 | #include "posix_time.h" 52 | #include "linux_joystick.h" 53 | #include "xkb_unicode.h" 54 | #include "egl_context.h" 55 | 56 | #define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL) 57 | #define _glfw_dlclose(handle) dlclose(handle) 58 | #define _glfw_dlsym(handle, name) dlsym(handle, name) 59 | 60 | #define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->mir.window) 61 | #define _GLFW_EGL_NATIVE_DISPLAY ((EGLNativeDisplayType) _glfw.mir.display) 62 | 63 | #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowMir mir 64 | #define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorMir mir 65 | #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryMir mir 66 | #define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorMir mir 67 | 68 | #define _GLFW_PLATFORM_CONTEXT_STATE 69 | #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE 70 | 71 | 72 | // Mir-specific Event Queue 73 | // 74 | typedef struct EventQueue 75 | { 76 | TAILQ_HEAD(, EventNode) head; 77 | } EventQueue; 78 | 79 | // Mir-specific per-window data 80 | // 81 | typedef struct _GLFWwindowMir 82 | { 83 | MirSurface* surface; 84 | int width; 85 | int height; 86 | MirEGLNativeWindowType window; 87 | 88 | } _GLFWwindowMir; 89 | 90 | // Mir-specific per-monitor data 91 | // 92 | typedef struct _GLFWmonitorMir 93 | { 94 | int cur_mode; 95 | int output_id; 96 | int x; 97 | int y; 98 | 99 | } _GLFWmonitorMir; 100 | 101 | // Mir-specific global data 102 | // 103 | typedef struct _GLFWlibraryMir 104 | { 105 | MirConnection* connection; 106 | MirEGLNativeDisplayType display; 107 | MirCursorConfiguration* default_conf; 108 | EventQueue* event_queue; 109 | 110 | short int publicKeys[256]; 111 | 112 | pthread_mutex_t event_mutex; 113 | pthread_cond_t event_cond; 114 | 115 | } _GLFWlibraryMir; 116 | 117 | // Mir-specific per-cursor data 118 | // TODO: Only system cursors are implemented in Mir atm. Need to wait for support. 119 | // 120 | typedef struct _GLFWcursorMir 121 | { 122 | MirCursorConfiguration* conf; 123 | MirBufferStream* custom_cursor; 124 | } _GLFWcursorMir; 125 | 126 | 127 | extern void _glfwInitEventQueueMir(EventQueue* queue); 128 | extern void _glfwDeleteEventQueueMir(EventQueue* queue); 129 | 130 | #endif // _glfw3_mir_platform_h_ 131 | -------------------------------------------------------------------------------- /flexflate/fixedhuff.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package flexflate 6 | 7 | // autogenerated by go run gen.go -output fixedhuff.go, DO NOT EDIT 8 | 9 | var fixedHuffmanDecoder = huffmanDecoder{ 10 | 7, 11 | [huffmanNumChunks]uint32{ 12 | 0x1007, 0x0508, 0x0108, 0x1188, 0x1107, 0x0708, 0x0308, 0x0c09, 13 | 0x1087, 0x0608, 0x0208, 0x0a09, 0x0008, 0x0808, 0x0408, 0x0e09, 14 | 0x1047, 0x0588, 0x0188, 0x0909, 0x1147, 0x0788, 0x0388, 0x0d09, 15 | 0x10c7, 0x0688, 0x0288, 0x0b09, 0x0088, 0x0888, 0x0488, 0x0f09, 16 | 0x1027, 0x0548, 0x0148, 0x11c8, 0x1127, 0x0748, 0x0348, 0x0c89, 17 | 0x10a7, 0x0648, 0x0248, 0x0a89, 0x0048, 0x0848, 0x0448, 0x0e89, 18 | 0x1067, 0x05c8, 0x01c8, 0x0989, 0x1167, 0x07c8, 0x03c8, 0x0d89, 19 | 0x10e7, 0x06c8, 0x02c8, 0x0b89, 0x00c8, 0x08c8, 0x04c8, 0x0f89, 20 | 0x1017, 0x0528, 0x0128, 0x11a8, 0x1117, 0x0728, 0x0328, 0x0c49, 21 | 0x1097, 0x0628, 0x0228, 0x0a49, 0x0028, 0x0828, 0x0428, 0x0e49, 22 | 0x1057, 0x05a8, 0x01a8, 0x0949, 0x1157, 0x07a8, 0x03a8, 0x0d49, 23 | 0x10d7, 0x06a8, 0x02a8, 0x0b49, 0x00a8, 0x08a8, 0x04a8, 0x0f49, 24 | 0x1037, 0x0568, 0x0168, 0x11e8, 0x1137, 0x0768, 0x0368, 0x0cc9, 25 | 0x10b7, 0x0668, 0x0268, 0x0ac9, 0x0068, 0x0868, 0x0468, 0x0ec9, 26 | 0x1077, 0x05e8, 0x01e8, 0x09c9, 0x1177, 0x07e8, 0x03e8, 0x0dc9, 27 | 0x10f7, 0x06e8, 0x02e8, 0x0bc9, 0x00e8, 0x08e8, 0x04e8, 0x0fc9, 28 | 0x1007, 0x0518, 0x0118, 0x1198, 0x1107, 0x0718, 0x0318, 0x0c29, 29 | 0x1087, 0x0618, 0x0218, 0x0a29, 0x0018, 0x0818, 0x0418, 0x0e29, 30 | 0x1047, 0x0598, 0x0198, 0x0929, 0x1147, 0x0798, 0x0398, 0x0d29, 31 | 0x10c7, 0x0698, 0x0298, 0x0b29, 0x0098, 0x0898, 0x0498, 0x0f29, 32 | 0x1027, 0x0558, 0x0158, 0x11d8, 0x1127, 0x0758, 0x0358, 0x0ca9, 33 | 0x10a7, 0x0658, 0x0258, 0x0aa9, 0x0058, 0x0858, 0x0458, 0x0ea9, 34 | 0x1067, 0x05d8, 0x01d8, 0x09a9, 0x1167, 0x07d8, 0x03d8, 0x0da9, 35 | 0x10e7, 0x06d8, 0x02d8, 0x0ba9, 0x00d8, 0x08d8, 0x04d8, 0x0fa9, 36 | 0x1017, 0x0538, 0x0138, 0x11b8, 0x1117, 0x0738, 0x0338, 0x0c69, 37 | 0x1097, 0x0638, 0x0238, 0x0a69, 0x0038, 0x0838, 0x0438, 0x0e69, 38 | 0x1057, 0x05b8, 0x01b8, 0x0969, 0x1157, 0x07b8, 0x03b8, 0x0d69, 39 | 0x10d7, 0x06b8, 0x02b8, 0x0b69, 0x00b8, 0x08b8, 0x04b8, 0x0f69, 40 | 0x1037, 0x0578, 0x0178, 0x11f8, 0x1137, 0x0778, 0x0378, 0x0ce9, 41 | 0x10b7, 0x0678, 0x0278, 0x0ae9, 0x0078, 0x0878, 0x0478, 0x0ee9, 42 | 0x1077, 0x05f8, 0x01f8, 0x09e9, 0x1177, 0x07f8, 0x03f8, 0x0de9, 43 | 0x10f7, 0x06f8, 0x02f8, 0x0be9, 0x00f8, 0x08f8, 0x04f8, 0x0fe9, 44 | 0x1007, 0x0508, 0x0108, 0x1188, 0x1107, 0x0708, 0x0308, 0x0c19, 45 | 0x1087, 0x0608, 0x0208, 0x0a19, 0x0008, 0x0808, 0x0408, 0x0e19, 46 | 0x1047, 0x0588, 0x0188, 0x0919, 0x1147, 0x0788, 0x0388, 0x0d19, 47 | 0x10c7, 0x0688, 0x0288, 0x0b19, 0x0088, 0x0888, 0x0488, 0x0f19, 48 | 0x1027, 0x0548, 0x0148, 0x11c8, 0x1127, 0x0748, 0x0348, 0x0c99, 49 | 0x10a7, 0x0648, 0x0248, 0x0a99, 0x0048, 0x0848, 0x0448, 0x0e99, 50 | 0x1067, 0x05c8, 0x01c8, 0x0999, 0x1167, 0x07c8, 0x03c8, 0x0d99, 51 | 0x10e7, 0x06c8, 0x02c8, 0x0b99, 0x00c8, 0x08c8, 0x04c8, 0x0f99, 52 | 0x1017, 0x0528, 0x0128, 0x11a8, 0x1117, 0x0728, 0x0328, 0x0c59, 53 | 0x1097, 0x0628, 0x0228, 0x0a59, 0x0028, 0x0828, 0x0428, 0x0e59, 54 | 0x1057, 0x05a8, 0x01a8, 0x0959, 0x1157, 0x07a8, 0x03a8, 0x0d59, 55 | 0x10d7, 0x06a8, 0x02a8, 0x0b59, 0x00a8, 0x08a8, 0x04a8, 0x0f59, 56 | 0x1037, 0x0568, 0x0168, 0x11e8, 0x1137, 0x0768, 0x0368, 0x0cd9, 57 | 0x10b7, 0x0668, 0x0268, 0x0ad9, 0x0068, 0x0868, 0x0468, 0x0ed9, 58 | 0x1077, 0x05e8, 0x01e8, 0x09d9, 0x1177, 0x07e8, 0x03e8, 0x0dd9, 59 | 0x10f7, 0x06e8, 0x02e8, 0x0bd9, 0x00e8, 0x08e8, 0x04e8, 0x0fd9, 60 | 0x1007, 0x0518, 0x0118, 0x1198, 0x1107, 0x0718, 0x0318, 0x0c39, 61 | 0x1087, 0x0618, 0x0218, 0x0a39, 0x0018, 0x0818, 0x0418, 0x0e39, 62 | 0x1047, 0x0598, 0x0198, 0x0939, 0x1147, 0x0798, 0x0398, 0x0d39, 63 | 0x10c7, 0x0698, 0x0298, 0x0b39, 0x0098, 0x0898, 0x0498, 0x0f39, 64 | 0x1027, 0x0558, 0x0158, 0x11d8, 0x1127, 0x0758, 0x0358, 0x0cb9, 65 | 0x10a7, 0x0658, 0x0258, 0x0ab9, 0x0058, 0x0858, 0x0458, 0x0eb9, 66 | 0x1067, 0x05d8, 0x01d8, 0x09b9, 0x1167, 0x07d8, 0x03d8, 0x0db9, 67 | 0x10e7, 0x06d8, 0x02d8, 0x0bb9, 0x00d8, 0x08d8, 0x04d8, 0x0fb9, 68 | 0x1017, 0x0538, 0x0138, 0x11b8, 0x1117, 0x0738, 0x0338, 0x0c79, 69 | 0x1097, 0x0638, 0x0238, 0x0a79, 0x0038, 0x0838, 0x0438, 0x0e79, 70 | 0x1057, 0x05b8, 0x01b8, 0x0979, 0x1157, 0x07b8, 0x03b8, 0x0d79, 71 | 0x10d7, 0x06b8, 0x02b8, 0x0b79, 0x00b8, 0x08b8, 0x04b8, 0x0f79, 72 | 0x1037, 0x0578, 0x0178, 0x11f8, 0x1137, 0x0778, 0x0378, 0x0cf9, 73 | 0x10b7, 0x0678, 0x0278, 0x0af9, 0x0078, 0x0878, 0x0478, 0x0ef9, 74 | 0x1077, 0x05f8, 0x01f8, 0x09f9, 0x1177, 0x07f8, 0x03f8, 0x0df9, 75 | 0x10f7, 0x06f8, 0x02f8, 0x0bf9, 0x00f8, 0x08f8, 0x04f8, 0x0ff9, 76 | }, 77 | nil, 0, 78 | } 79 | --------------------------------------------------------------------------------