├── .gitignore ├── .travis.yml ├── CNAME ├── CONTRIBUTORS ├── LICENSE ├── Makefile ├── README.md ├── _config.yml ├── assets ├── client │ ├── page.html │ ├── static │ │ ├── css │ │ │ ├── bootstrap.min.css │ │ │ └── highlight.min.css │ │ ├── img │ │ │ └── glyphicons-halflings.png │ │ └── js │ │ │ ├── angular-sanitize.min.js │ │ │ ├── angular.js │ │ │ ├── base64.js │ │ │ ├── highlight.min.js │ │ │ ├── jquery-1.9.1.min.js │ │ │ ├── jquery.timeago.js │ │ │ ├── ngrok.js │ │ │ └── vkbeautify.js │ └── tls │ │ ├── ngrokroot.crt │ │ └── snakeoilca.crt └── server │ └── tls │ ├── snakeoil.crt │ └── snakeoil.key ├── contrib └── com.ngrok.client.plist ├── docs ├── CHANGELOG.md ├── CNAME ├── DEVELOPMENT.md └── SELFHOSTING.md ├── pkg ├── darwin_386 │ └── ngrok │ │ ├── cache.a │ │ ├── client.a │ │ ├── client │ │ ├── assets.a │ │ ├── mvc.a │ │ └── views │ │ │ ├── term.a │ │ │ └── web.a │ │ ├── conn.a │ │ ├── log.a │ │ ├── msg.a │ │ ├── proto.a │ │ ├── server.a │ │ ├── server │ │ └── assets.a │ │ ├── util.a │ │ └── version.a ├── darwin_amd64 │ ├── github.com │ │ ├── alecthomas │ │ │ └── log4go.a │ │ ├── gorilla │ │ │ └── websocket.a │ │ ├── inconshreveable │ │ │ ├── go-vhost.a │ │ │ └── mousetrap.a │ │ ├── kardianos │ │ │ └── osext.a │ │ ├── kr │ │ │ └── binarydist.a │ │ ├── mattn │ │ │ └── go-runewidth.a │ │ ├── nsf │ │ │ └── termbox-go.a │ │ └── rcrowley │ │ │ └── go-metrics.a │ ├── gopkg.in │ │ ├── inconshreveable │ │ │ ├── go-update.v0.a │ │ │ └── go-update.v0 │ │ │ │ ├── check.a │ │ │ │ └── download.a │ │ └── yaml.v1.a │ └── ngrok │ │ ├── cache.a │ │ ├── client.a │ │ ├── client │ │ ├── assets.a │ │ ├── mvc.a │ │ └── views │ │ │ ├── term.a │ │ │ └── web.a │ │ ├── conn.a │ │ ├── log.a │ │ ├── msg.a │ │ ├── proto.a │ │ ├── server.a │ │ ├── server │ │ └── assets.a │ │ ├── util.a │ │ └── version.a ├── linux_386 │ ├── github.com │ │ ├── alecthomas │ │ │ └── log4go.a │ │ ├── gorilla │ │ │ └── websocket.a │ │ ├── inconshreveable │ │ │ ├── go-vhost.a │ │ │ └── mousetrap.a │ │ ├── kardianos │ │ │ └── osext.a │ │ ├── kr │ │ │ └── binarydist.a │ │ ├── mattn │ │ │ └── go-runewidth.a │ │ ├── nsf │ │ │ └── termbox-go.a │ │ └── rcrowley │ │ │ └── go-metrics.a │ ├── gopkg.in │ │ ├── inconshreveable │ │ │ ├── go-update.v0.a │ │ │ └── go-update.v0 │ │ │ │ ├── check.a │ │ │ │ └── download.a │ │ └── yaml.v1.a │ └── ngrok │ │ ├── cache.a │ │ ├── client.a │ │ ├── client │ │ ├── assets.a │ │ ├── mvc.a │ │ └── views │ │ │ ├── term.a │ │ │ └── web.a │ │ ├── conn.a │ │ ├── log.a │ │ ├── msg.a │ │ ├── proto.a │ │ ├── server.a │ │ ├── server │ │ └── assets.a │ │ ├── util.a │ │ └── version.a ├── linux_amd64 │ ├── github.com │ │ ├── alecthomas │ │ │ └── log4go.a │ │ ├── gorilla │ │ │ └── websocket.a │ │ ├── inconshreveable │ │ │ ├── go-vhost.a │ │ │ └── mousetrap.a │ │ ├── jteeuwen │ │ │ └── go-bindata.a │ │ ├── kardianos │ │ │ └── osext.a │ │ ├── kr │ │ │ └── binarydist.a │ │ ├── mattn │ │ │ └── go-runewidth.a │ │ ├── nsf │ │ │ └── termbox-go.a │ │ └── rcrowley │ │ │ └── go-metrics.a │ ├── gopkg.in │ │ ├── inconshreveable │ │ │ ├── go-update.v0.a │ │ │ └── go-update.v0 │ │ │ │ ├── check.a │ │ │ │ └── download.a │ │ └── yaml.v1.a │ └── ngrok │ │ ├── cache.a │ │ ├── client.a │ │ ├── client │ │ ├── assets.a │ │ ├── mvc.a │ │ └── views │ │ │ ├── term.a │ │ │ └── web.a │ │ ├── conn.a │ │ ├── log.a │ │ ├── msg.a │ │ ├── proto.a │ │ ├── server.a │ │ ├── server │ │ └── assets.a │ │ ├── util.a │ │ └── version.a ├── linux_arm │ ├── github.com │ │ ├── alecthomas │ │ │ └── log4go.a │ │ ├── gorilla │ │ │ └── websocket.a │ │ ├── inconshreveable │ │ │ ├── go-vhost.a │ │ │ └── mousetrap.a │ │ ├── kardianos │ │ │ └── osext.a │ │ ├── kr │ │ │ └── binarydist.a │ │ ├── mattn │ │ │ └── go-runewidth.a │ │ ├── nsf │ │ │ └── termbox-go.a │ │ └── rcrowley │ │ │ └── go-metrics.a │ ├── gopkg.in │ │ ├── inconshreveable │ │ │ ├── go-update.v0.a │ │ │ └── go-update.v0 │ │ │ │ ├── check.a │ │ │ │ └── download.a │ │ └── yaml.v1.a │ └── ngrok │ │ ├── cache.a │ │ ├── client.a │ │ ├── client │ │ ├── assets.a │ │ ├── mvc.a │ │ └── views │ │ │ ├── term.a │ │ │ └── web.a │ │ ├── conn.a │ │ ├── log.a │ │ ├── msg.a │ │ ├── proto.a │ │ ├── server.a │ │ ├── server │ │ └── assets.a │ │ ├── util.a │ │ └── version.a ├── windows_386 │ ├── github.com │ │ ├── alecthomas │ │ │ └── log4go.a │ │ ├── gorilla │ │ │ └── websocket.a │ │ ├── inconshreveable │ │ │ ├── go-vhost.a │ │ │ └── mousetrap.a │ │ ├── kardianos │ │ │ └── osext.a │ │ ├── kr │ │ │ └── binarydist.a │ │ ├── mattn │ │ │ └── go-runewidth.a │ │ ├── nsf │ │ │ └── termbox-go.a │ │ └── rcrowley │ │ │ └── go-metrics.a │ ├── gopkg.in │ │ ├── inconshreveable │ │ │ ├── go-update.v0.a │ │ │ └── go-update.v0 │ │ │ │ ├── check.a │ │ │ │ └── download.a │ │ └── yaml.v1.a │ └── ngrok │ │ ├── cache.a │ │ ├── client.a │ │ ├── client │ │ ├── assets.a │ │ ├── mvc.a │ │ └── views │ │ │ ├── term.a │ │ │ └── web.a │ │ ├── conn.a │ │ ├── log.a │ │ ├── msg.a │ │ ├── proto.a │ │ ├── server.a │ │ ├── server │ │ └── assets.a │ │ ├── util.a │ │ └── version.a └── windows_amd64 │ ├── github.com │ ├── alecthomas │ │ └── log4go.a │ ├── gorilla │ │ └── websocket.a │ ├── inconshreveable │ │ ├── go-vhost.a │ │ └── mousetrap.a │ ├── kardianos │ │ └── osext.a │ ├── kr │ │ └── binarydist.a │ ├── mattn │ │ └── go-runewidth.a │ ├── nsf │ │ └── termbox-go.a │ └── rcrowley │ │ └── go-metrics.a │ ├── gopkg.in │ ├── inconshreveable │ │ ├── go-update.v0.a │ │ └── go-update.v0 │ │ │ ├── check.a │ │ │ └── download.a │ └── yaml.v1.a │ └── ngrok │ ├── cache.a │ ├── client.a │ ├── client │ ├── assets.a │ ├── mvc.a │ └── views │ │ ├── term.a │ │ └── web.a │ ├── conn.a │ ├── log.a │ ├── msg.a │ ├── proto.a │ ├── server.a │ ├── server │ └── assets.a │ ├── util.a │ └── version.a └── src ├── github.com ├── alecthomas │ └── log4go │ │ ├── LICENSE │ │ ├── README │ │ ├── config.go │ │ ├── examples │ │ ├── ConsoleLogWriter_Manual.go │ │ ├── FileLogWriter_Manual.go │ │ ├── SimpleNetLogServer.go │ │ ├── SocketLogWriter_Manual.go │ │ ├── XMLConfigurationExample.go │ │ └── example.xml │ │ ├── filelog.go │ │ ├── log4go.go │ │ ├── log4go_test.go │ │ ├── pattlog.go │ │ ├── socklog.go │ │ ├── termlog.go │ │ └── wrapper.go ├── gorilla │ └── websocket │ │ ├── AUTHORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── client.go │ │ ├── client_server_test.go │ │ ├── client_test.go │ │ ├── compression.go │ │ ├── compression_test.go │ │ ├── conn.go │ │ ├── conn_read.go │ │ ├── conn_read_legacy.go │ │ ├── conn_test.go │ │ ├── doc.go │ │ ├── example_test.go │ │ ├── examples │ │ ├── autobahn │ │ │ ├── README.md │ │ │ ├── fuzzingclient.json │ │ │ └── server.go │ │ ├── chat │ │ │ ├── README.md │ │ │ ├── client.go │ │ │ ├── home.html │ │ │ ├── hub.go │ │ │ └── main.go │ │ ├── command │ │ │ ├── README.md │ │ │ ├── home.html │ │ │ └── main.go │ │ ├── echo │ │ │ ├── README.md │ │ │ ├── client.go │ │ │ └── server.go │ │ └── filewatch │ │ │ ├── README.md │ │ │ └── main.go │ │ ├── json.go │ │ ├── json_test.go │ │ ├── mask.go │ │ ├── mask_test.go │ │ ├── server.go │ │ ├── server_test.go │ │ ├── util.go │ │ └── util_test.go ├── inconshreveable │ ├── go-vhost │ │ ├── LICENSE │ │ ├── README.md │ │ ├── http.go │ │ ├── http_test.go │ │ ├── interface.go │ │ ├── mux.go │ │ ├── mux_test.go │ │ ├── shared.go │ │ ├── shared_test.go │ │ ├── tls.go │ │ └── tls_test.go │ └── mousetrap │ │ ├── LICENSE │ │ ├── README.md │ │ ├── trap_others.go │ │ ├── trap_windows.go │ │ └── trap_windows_1.4.go ├── jteeuwen │ └── go-bindata │ │ ├── CONTRIBUTING.md │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── asset.go │ │ ├── bytewriter.go │ │ ├── config.go │ │ ├── convert.go │ │ ├── convert_test.go │ │ ├── debug.go │ │ ├── doc.go │ │ ├── go-bindata │ │ ├── AppendSliceValue.go │ │ ├── main.go │ │ └── version.go │ │ ├── release.go │ │ ├── restore.go │ │ ├── stringwriter.go │ │ ├── testdata │ │ ├── Makefile │ │ ├── dupname │ │ │ ├── foo │ │ │ │ └── bar │ │ │ └── foo_bar │ │ ├── in │ │ │ ├── a │ │ │ │ └── test.asset │ │ │ ├── b │ │ │ │ └── test.asset │ │ │ ├── c │ │ │ │ └── test.asset │ │ │ └── test.asset │ │ ├── out │ │ │ ├── compress-memcopy.go │ │ │ ├── compress-nomemcopy.go │ │ │ ├── debug.go │ │ │ ├── debug.go-bindata │ │ │ ├── nocompress-memcopy.go │ │ │ └── nocompress-nomemcopy.go │ │ ├── symlinkFile │ │ │ └── file1 │ │ ├── symlinkParent │ │ │ └── symlinkTarget │ │ │ │ ├── file1 │ │ │ │ ├── file2 │ │ │ │ ├── file3 │ │ │ │ └── file4 │ │ ├── symlinkRecursiveParent │ │ │ ├── file1 │ │ │ └── symlinkTarget │ │ │ │ ├── file1 │ │ │ │ └── symlinkTarget │ │ │ │ ├── file1 │ │ │ │ └── symlinkTarget │ │ │ │ ├── file1 │ │ │ │ └── symlinkTarget │ │ │ │ ├── file1 │ │ │ │ └── symlinkTarget │ │ │ │ ├── file1 │ │ │ │ └── symlinkTarget │ │ │ │ ├── file1 │ │ │ │ └── symlinkTarget │ │ │ │ ├── file1 │ │ │ │ └── symlinkTarget │ │ │ │ ├── file1 │ │ │ │ └── symlinkTarget │ │ │ │ └── file1 │ │ └── symlinkSrc │ │ │ ├── file1 │ │ │ ├── file2 │ │ │ ├── file3 │ │ │ └── file4 │ │ └── toc.go ├── kardianos │ └── osext │ │ ├── LICENSE │ │ ├── README.md │ │ ├── osext.go │ │ ├── osext_plan9.go │ │ ├── osext_procfs.go │ │ ├── osext_sysctl.go │ │ ├── osext_test.go │ │ └── osext_windows.go ├── kr │ └── binarydist │ │ ├── License │ │ ├── Readme.md │ │ ├── bzip2.go │ │ ├── common_test.go │ │ ├── diff.go │ │ ├── diff_test.go │ │ ├── doc.go │ │ ├── encoding.go │ │ ├── patch.go │ │ ├── patch_test.go │ │ ├── seek.go │ │ ├── sort_test.go │ │ └── testdata │ │ ├── sample.new │ │ ├── sample.old │ │ └── sample.patch ├── mattn │ └── go-runewidth │ │ ├── LICENSE │ │ ├── README.mkd │ │ ├── runewidth.go │ │ ├── runewidth_js.go │ │ ├── runewidth_posix.go │ │ ├── runewidth_test.go │ │ └── runewidth_windows.go ├── nsf │ └── termbox-go │ │ ├── AUTHORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── _demos │ │ ├── editbox.go │ │ ├── interrupt.go │ │ ├── keyboard.go │ │ ├── output.go │ │ ├── paint.go │ │ ├── random_output.go │ │ └── raw_input.go │ │ ├── api.go │ │ ├── api_common.go │ │ ├── api_windows.go │ │ ├── collect_terminfo.py │ │ ├── syscalls.go │ │ ├── syscalls_darwin.go │ │ ├── syscalls_darwin_amd64.go │ │ ├── syscalls_dragonfly.go │ │ ├── syscalls_freebsd.go │ │ ├── syscalls_linux.go │ │ ├── syscalls_netbsd.go │ │ ├── syscalls_openbsd.go │ │ ├── syscalls_windows.go │ │ ├── termbox.go │ │ ├── termbox_common.go │ │ ├── termbox_windows.go │ │ ├── terminfo.go │ │ └── terminfo_builtin.go └── rcrowley │ └── go-metrics │ ├── LICENSE │ ├── README.md │ ├── cmd │ ├── metrics-bench │ │ └── metrics-bench.go │ ├── metrics-example │ │ └── metrics-example.go │ └── never-read │ │ └── never-read.go │ ├── counter.go │ ├── counter_test.go │ ├── debug.go │ ├── debug_test.go │ ├── ewma.go │ ├── ewma_test.go │ ├── exp │ └── exp.go │ ├── gauge.go │ ├── gauge_float64.go │ ├── gauge_float64_test.go │ ├── gauge_test.go │ ├── graphite.go │ ├── graphite_test.go │ ├── healthcheck.go │ ├── histogram.go │ ├── histogram_test.go │ ├── json.go │ ├── json_test.go │ ├── librato │ ├── client.go │ └── librato.go │ ├── log.go │ ├── memory.md │ ├── meter.go │ ├── meter_test.go │ ├── metrics.go │ ├── metrics_test.go │ ├── opentsdb.go │ ├── opentsdb_test.go │ ├── registry.go │ ├── registry_test.go │ ├── runtime.go │ ├── runtime_cgo.go │ ├── runtime_gccpufraction.go │ ├── runtime_no_cgo.go │ ├── runtime_no_gccpufraction.go │ ├── runtime_test.go │ ├── sample.go │ ├── sample_test.go │ ├── stathat │ └── stathat.go │ ├── syslog.go │ ├── timer.go │ ├── timer_test.go │ ├── validate.sh │ ├── writer.go │ └── writer_test.go ├── gopkg.in ├── inconshreveable │ └── go-update.v0 │ │ ├── LICENSE │ │ ├── README.md │ │ ├── check │ │ └── check.go │ │ ├── download │ │ └── download.go │ │ ├── hide_noop.go │ │ ├── hide_windows.go │ │ ├── update.go │ │ └── update_test.go └── yaml.v1 │ ├── LICENSE │ ├── LICENSE.libyaml │ ├── README.md │ ├── apic.go │ ├── decode.go │ ├── decode_test.go │ ├── emitterc.go │ ├── encode.go │ ├── encode_test.go │ ├── parserc.go │ ├── readerc.go │ ├── resolve.go │ ├── scannerc.go │ ├── sorter.go │ ├── suite_test.go │ ├── writerc.go │ ├── yaml.go │ ├── yamlh.go │ └── yamlprivateh.go └── ngrok ├── cache └── lru.go ├── client ├── cli.go ├── config.go ├── controller.go ├── debug.go ├── main.go ├── metrics.go ├── model.go ├── mvc │ ├── controller.go │ ├── model.go │ ├── state.go │ └── view.go ├── release.go ├── tls.go ├── update_debug.go ├── update_release.go └── views │ ├── term │ ├── area.go │ ├── http.go │ └── view.go │ └── web │ ├── http.go │ └── view.go ├── conn ├── conn.go └── tee.go ├── log └── logger.go ├── main ├── ngrok │ └── ngrok.go └── ngrokd │ └── ngrokd.go ├── msg ├── conn.go ├── msg.go └── pack.go ├── proto ├── http.go ├── interface.go └── tcp.go ├── server ├── assets │ └── assets_release.go ├── cli.go ├── control.go ├── http.go ├── main.go ├── metrics.go ├── registry.go ├── tls.go └── tunnel.go ├── util ├── broadcast.go ├── errors.go ├── id.go ├── ring.go └── shutdown.go └── version └── version.go /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | bin/ 3 | pkg/ 4 | src/code.google.com 5 | src/github.com 6 | src/bitbucket.org 7 | src/launchpad.net 8 | src/gopkg.in 9 | src/ngrok/client/assets/ 10 | src/ngrok/server/assets/ 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | script: make release-all 4 | install: true 5 | go: 6 | - 1.4 7 | - 1.5 8 | - 1.6 9 | - tip 10 | 11 | matrix: 12 | allow_failures: 13 | - go: tip 14 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | 2.lub8.win 2 | -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Contributors to ngrok, both large and small: 2 | 3 | - Alan Shreve 4 | - Brandon Philips 5 | - Caleb Spare 6 | - Jay Hayes 7 | - Kevin Burke 8 | - Kyle Conroy 9 | - Nick Presta 10 | - Stephen Huenneke 11 | - inconshreveable 12 | - jzs 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2013 Alan Shreve 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: default server client deps fmt clean all release-all assets client-assets server-assets contributors 2 | export GOPATH:=$(shell pwd) 3 | 4 | BUILDTAGS=debug 5 | default: all 6 | 7 | deps: assets 8 | go get -tags '$(BUILDTAGS)' -d -v ngrok/... 9 | 10 | server: deps 11 | go install -tags '$(BUILDTAGS)' ngrok/main/ngrokd 12 | 13 | fmt: 14 | go fmt ngrok/... 15 | 16 | client: deps 17 | go install -tags '$(BUILDTAGS)' ngrok/main/ngrok 18 | 19 | assets: client-assets server-assets 20 | 21 | bin/go-bindata: 22 | GOOS="" GOARCH="" go get github.com/jteeuwen/go-bindata/go-bindata 23 | 24 | client-assets: bin/go-bindata 25 | bin/go-bindata -nomemcopy -pkg=assets -tags=$(BUILDTAGS) \ 26 | -debug=$(if $(findstring debug,$(BUILDTAGS)),true,false) \ 27 | -o=src/ngrok/client/assets/assets_$(BUILDTAGS).go \ 28 | assets/client/... 29 | 30 | server-assets: bin/go-bindata 31 | bin/go-bindata -nomemcopy -pkg=assets -tags=$(BUILDTAGS) \ 32 | -debug=$(if $(findstring debug,$(BUILDTAGS)),true,false) \ 33 | -o=src/ngrok/server/assets/assets_$(BUILDTAGS).go \ 34 | assets/server/... 35 | 36 | release-client: BUILDTAGS=release 37 | release-client: client 38 | 39 | release-server: BUILDTAGS=release 40 | release-server: server 41 | 42 | release-all: fmt release-client release-server 43 | 44 | all: fmt client server 45 | 46 | clean: 47 | go clean -i -r ngrok/... 48 | rm -rf src/ngrok/client/assets/ src/ngrok/server/assets/ 49 | 50 | contributors: 51 | echo "Contributors to ngrok, both large and small:\n" > CONTRIBUTORS 52 | git log --raw | grep "^Author: " | sort | uniq | cut -d ' ' -f2- | sed 's/^/- /' | cut -d '<' -f1 >> CONTRIBUTORS 53 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #备份并做了部分优化修改与汉化工作 2 | 3 | ###已经编译好的客户端及服务端下载地址:
https://github.com/chengangwin/ngrok/releases 4 | 5 | 客户端为:ngrok
6 | 启动方式1:ngrok 80
7 | 启动方式2:ngrok start-all

8 | 客户端配置文件:
9 | 1、新建一个txt文本文件,输入:server_addr: "www.gdmpmiu.tk:4443" 后保存,并将文件名改为:ngrok.cfg
10 | 2、ngrok.cfg 与ngrok客户端 放在同一目录下。


11 | 12 | 服务端为:ngrokd
13 | 启动方式:ngrokd -domain="gdmpmiu.tk"

14 | 以上启动命令均是在cmd模式下运行。

15 | 16 | 此版本在原版1.7的基础上进行了部分汉化以及优化工作,让客户端可以连接其它版本的服务端。 17 | 配置文件使用与1.7版一致! 18 | 19 | 20 | ###原源码地址:https://github.com/inconshreveable/ngrok 21 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /assets/client/static/css/highlight.min.css: -------------------------------------------------------------------------------- 1 | pre code{display:block;padding:.5em;background:#f0f0f0}pre code,pre .subst,pre .tag .title,pre .lisp .title,pre .clojure .built_in,pre .nginx .title{color:black}pre .string,pre .title,pre .constant,pre .parent,pre .tag .value,pre .rules .value,pre .rules .value .number,pre .preprocessor,pre .ruby .symbol,pre .ruby .symbol .string,pre .aggregate,pre .template_tag,pre .django .variable,pre .smalltalk .class,pre .addition,pre .flow,pre .stream,pre .bash .variable,pre .apache .tag,pre .apache .cbracket,pre .tex .command,pre .tex .special,pre .erlang_repl .function_or_atom,pre .markdown .header{color:#800}pre .comment,pre .annotation,pre .template_comment,pre .diff .header,pre .chunk,pre .markdown .blockquote{color:#888}pre .number,pre .date,pre .regexp,pre .literal,pre .smalltalk .symbol,pre .smalltalk .char,pre .go .constant,pre .change,pre .markdown .bullet,pre .markdown .link_url{color:#080}pre .label,pre .javadoc,pre .ruby .string,pre .decorator,pre .filter .argument,pre .localvars,pre .array,pre .attr_selector,pre .important,pre .pseudo,pre .pi,pre .doctype,pre .deletion,pre .envvar,pre .shebang,pre .apache .sqbracket,pre .nginx .built_in,pre .tex .formula,pre .erlang_repl .reserved,pre .prompt,pre .markdown .link_label,pre .vhdl .attribute,pre .clojure .attribute,pre .coffeescript .property{color:#88F}pre .keyword,pre .id,pre .phpdoc,pre .title,pre .built_in,pre .aggregate,pre .css .tag,pre .javadoctag,pre .phpdoc,pre .yardoctag,pre .smalltalk .class,pre .winutils,pre .bash .variable,pre .apache .tag,pre .go .typename,pre .tex .command,pre .markdown .strong,pre .request,pre .status{font-weight:bold}pre .markdown .emphasis{font-style:italic}pre .nginx .built_in{font-weight:normal}pre .coffeescript .javascript,pre .javascript .xml,pre .tex .formula,pre .xml .javascript,pre .xml .vbscript,pre .xml .css,pre .xml .cdata{opacity:.5} -------------------------------------------------------------------------------- /assets/client/static/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/assets/client/static/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /assets/client/tls/ngrokroot.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU 3 | MBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs 4 | IFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290 5 | MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux 6 | FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h 7 | bCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v 8 | dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt 9 | H7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9 10 | uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX 11 | mk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX 12 | a0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN 13 | E0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0 14 | WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD 15 | VR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0 16 | Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRU 17 | cnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsx 18 | IjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJKoZIhvcN 19 | AQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH 20 | YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5 21 | 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC 22 | Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX 23 | c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a 24 | mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ= 25 | -----END CERTIFICATE----- -------------------------------------------------------------------------------- /assets/client/tls/snakeoilca.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDBTCCAe2gAwIBAgIJAKZ6IPnDceLVMA0GCSqGSIb3DQEBCwUAMBkxFzAVBgNV 3 | BAMMDiouY2hlbmdhbmcud2luMB4XDTE2MTIxNTIwMjI1OFoXDTMwMDgyNDIwMjI1 4 | OFowGTEXMBUGA1UEAwwOKi5jaGVuZ2FuZy53aW4wggEiMA0GCSqGSIb3DQEBAQUA 5 | A4IBDwAwggEKAoIBAQDAxhjyPbBBoc+QNURr2wD6BYWUV4Q72RBXRAOsqViZt3Rb 6 | yWuoLMNe9GtQNmy2JY5f5CD+dR6QljtcQHBKGwsxVREF7GzYRSz7EPaCTzxIVqEz 7 | 0tNGgxaGC3rmnYVXRwzdt6u0BxS58pBFb6aXaeIivzmXMiIKhZCCVQIhK5OzUylT 8 | m3HrJwleAx/95uEfVtwNj7Mir//JMi7qYlO3APPmzhZrRfw8gYV75xB8VEC9KyDY 9 | 8uAmXhrMC2OnLr4PqNcmDM+0ajcVbCgMEFKzwDh7MAzQxHPcX3lnMXlUYfffZxWT 10 | cRyfbE2+GvK4fW7yqLsDTPeXs345eJd04ZNxK0dXAgMBAAGjUDBOMB0GA1UdDgQW 11 | BBQThmzcH4vS0vxHd/wPq9kZOKSD+zAfBgNVHSMEGDAWgBQThmzcH4vS0vxHd/wP 12 | q9kZOKSD+zAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQB8YWj+oonA 13 | kc6ROEZ9CRkAejst4clDEIIZabnUUS+K1m8MtipmUJkTgyAhZZVexbwAkeL4fEQr 14 | alsWBRcJB9mvQ+m31JX/vdFbjrLM9MV/+MvaHATkIzqBHdW9jtrxfMe2J4yewaZO 15 | r/eNL6q+RmlTKVV09hfz6AbkKwEmPJv95t0cvIgNssaBDtyDwjNshVac0OvBqck8 16 | lMcbmcolP0vdvXZLuVekgrZSvBW6HJ01gStDURNCs8ItXbgQgNIWvMFrV23TxTED 17 | odD70LlMxJuCtfrTLxcFrAqPxqwUsVNvQHtiVYcJCvwELlKce7eIjUIJVQYgXI9o 18 | 1OQwMuE9988m 19 | -----END CERTIFICATE----- 20 | -------------------------------------------------------------------------------- /assets/server/tls/snakeoil.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICrjCCAZYCCQCH7XpSUk5YmjANBgkqhkiG9w0BAQUFADAZMRcwFQYDVQQDDA4q 3 | LmNoZW5nYW5nLndpbjAeFw0xNjEyMTUyMDIyNTlaFw0zMDA4MjQyMDIyNTlaMBkx 4 | FzAVBgNVBAMMDiouY2hlbmdhbmcud2luMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A 5 | MIIBCgKCAQEAvsxG7fWRE0/oCsx2TvYvmoZStVEHwKizqkrJva33W/gjqusQ6213 6 | n1ajlpFDoFoCA3m3NEmjxLeA4A9Q7pEXzTMak9ghAv8kJIVh1yfTy5zqvJz2UxWJ 7 | HHltU4mnAWfX3KfeFjf8DTuHipmDJHvo9b1OBhjluFPeu5WyTxpsmU/oNDgoEjWM 8 | BF6uU7fancYHwYYNfNjG7NtNaofnKe3TxxHcobVDh2NN6jPokukThsQlmqGynO72 9 | 9lp/guYV8BGiW0L0Mvb2js6qM+F69tyiI/KnGpSTwMfbteBHS0Tri4zNSO03s4a5 10 | Py/dssd5UIvW/6aozbk8z+g5VFisJWTZjwIDAQABMA0GCSqGSIb3DQEBBQUAA4IB 11 | AQCnq5u2zqRiHg25qyl6R7ecVn6DY/7gS6M6c60Gbco9h43OCnN7t64tA9N2vXMr 12 | Hpk3t0/PRVwQJBA15grwJp6V6fOPdh0N7OaCqpVAh2gTAzshZ8TLD1IdorKGuy4b 13 | B/dEoqpW/qItmebeZhCGo5kcadakFTzk5CeH3WSGPqYvkR3aF9LqA5+fhGyQZJep 14 | SUks9vBISC/Y3jb6VuA+FUV496SM+RkHj1ac5AZXT8gfo2kM4vOy38cuClqOUFpo 15 | qvkFdlJ3bjXRMwO9EyY1G96Y69Y8/Zo1Npiut8pptcufe7lY/crTItpcubsIUSht 16 | fO56VKFt+KmtohQXs60+GsWE 17 | -----END CERTIFICATE----- 18 | -------------------------------------------------------------------------------- /assets/server/tls/snakeoil.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpQIBAAKCAQEAvsxG7fWRE0/oCsx2TvYvmoZStVEHwKizqkrJva33W/gjqusQ 3 | 6213n1ajlpFDoFoCA3m3NEmjxLeA4A9Q7pEXzTMak9ghAv8kJIVh1yfTy5zqvJz2 4 | UxWJHHltU4mnAWfX3KfeFjf8DTuHipmDJHvo9b1OBhjluFPeu5WyTxpsmU/oNDgo 5 | EjWMBF6uU7fancYHwYYNfNjG7NtNaofnKe3TxxHcobVDh2NN6jPokukThsQlmqGy 6 | nO729lp/guYV8BGiW0L0Mvb2js6qM+F69tyiI/KnGpSTwMfbteBHS0Tri4zNSO03 7 | s4a5Py/dssd5UIvW/6aozbk8z+g5VFisJWTZjwIDAQABAoIBAQC3tXz+Fhov3Bpy 8 | e1fWw5gmUvtD9ddfG5CSgRwqdFzdwtik810BMg+h7gvpJ8lTlhamPgW2ZMk42e9O 9 | zbCBZFbkjzYh8FIozn2AZKVGQuTdAiPKo99RNEUmk4w+iSWyZsgjf8aI4jLgktb5 10 | DsKE2IIAStvbZxGZH7gwKfzbyXeTTQBmksOK3+Zzi5qa82IDWQ1wOO8ux5n72Og8 11 | X61Tuw2uO0Cq4l38mw7XcE37NNMTQOewWEcl849VKgXJtaylYCoTi2ylONN9TBBj 12 | cwruCHZbB2HQI2rkvO+GzdWOiCXL+PVSAkIWWnYix+vjzbfaFCppv3T4erNfHu/Z 13 | 6IIiU+PxAoGBAO31usqqif0oOygCN7lgGO28vzmiXqcY1DU6LPLXVIRgcGhhblhs 14 | wub/78PIrIHeCEDqwzN7aX4x747u7l953A4yemEajIQVABv7iAksOh57YSCI2E1q 15 | Bpe0V/aTCHlj4FQalsxf70A8UhaLkEb5l2BQ+UchBOP+qZ3AQ6KPfYKDAoGBAM1D 16 | PVzD84GaqOhY/VjRXC/pqrMCfcnnoqDk1w6Qs2HhCEshKhHy/HbGkZe9qChPAMSX 17 | dnqoxr4Qj4mXC4JTdmcKFS05MJWdyyg5ENLzVAcIJpDFNGd5pz5TzSbXtf+FpS6P 18 | 6IZgKGZ3TL+RXuQXLhYODEc3M3mt3e92zlM5M+8FAoGBAJ6cEuRxZcaTIVMan0/1 19 | iMg17fQZkSOpvhC4dStscc5GhcZdYvKXlBXq9EK4qJtrhm7WzEOtd/SAjl/kTIjh 20 | LddcuAuvaYfEg60jLFqI2zhkHqpT7HE1Qa2urI8TFCvtcaI9ktQpAcz8J+8VGZbl 21 | WIv/jRhnHt5laWNXuv1IzWzHAoGAej4PL03rmUX4TdehmeGlW0t3w4A6VaJDsjpW 22 | 8W+vxRz1iXjIy0PAoyQC1TG4EblrJalmgAo/wjWupix0SDtYimjwz6v9iT0eHmhN 23 | 4rPTWRS7kwA/A1jqBy51QSq6UuDOzPobatudc9ictoHm10QOyEe5fDgdyduIDvLc 24 | UagBi9kCgYEAkWb+XK04RhaQxoOFDcEyW9JYcpYwA/lZta1StpLizf29/x7/DvIH 25 | qUriV0ITu0NF9vLxW0cZAwZ67FyZb2bdaoXofLw/dTsX99Vd9uLfI2VOZqmg5HLz 26 | uU7rUPH43/C/6uloPjv1xIhIRe4kWu2fMvbSeU9WwwyWOkYdh3hcpmU= 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /contrib/com.ngrok.client.plist: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | KeepAlive 11 | 12 | Label 13 | com.ngrok.client 14 | ProgramArguments 15 | 16 | /usr/local/bin/ngrok 17 | -log 18 | stdout 19 | -subdomain 20 | mySubDomain 21 | 80 22 | 23 | StandardOutPath 24 | /tmp/ngrok.log 25 | StandardErrorPath 26 | /tmp/ngrok.log 27 | 28 | 29 | -------------------------------------------------------------------------------- /docs/CHANGELOG.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/docs/CHANGELOG.md -------------------------------------------------------------------------------- /docs/CNAME: -------------------------------------------------------------------------------- 1 | lu8.win -------------------------------------------------------------------------------- /pkg/darwin_386/ngrok/cache.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_386/ngrok/cache.a -------------------------------------------------------------------------------- /pkg/darwin_386/ngrok/client.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_386/ngrok/client.a -------------------------------------------------------------------------------- /pkg/darwin_386/ngrok/client/assets.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_386/ngrok/client/assets.a -------------------------------------------------------------------------------- /pkg/darwin_386/ngrok/client/mvc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_386/ngrok/client/mvc.a -------------------------------------------------------------------------------- /pkg/darwin_386/ngrok/client/views/term.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_386/ngrok/client/views/term.a -------------------------------------------------------------------------------- /pkg/darwin_386/ngrok/client/views/web.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_386/ngrok/client/views/web.a -------------------------------------------------------------------------------- /pkg/darwin_386/ngrok/conn.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_386/ngrok/conn.a -------------------------------------------------------------------------------- /pkg/darwin_386/ngrok/log.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_386/ngrok/log.a -------------------------------------------------------------------------------- /pkg/darwin_386/ngrok/msg.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_386/ngrok/msg.a -------------------------------------------------------------------------------- /pkg/darwin_386/ngrok/proto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_386/ngrok/proto.a -------------------------------------------------------------------------------- /pkg/darwin_386/ngrok/server.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_386/ngrok/server.a -------------------------------------------------------------------------------- /pkg/darwin_386/ngrok/server/assets.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_386/ngrok/server/assets.a -------------------------------------------------------------------------------- /pkg/darwin_386/ngrok/util.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_386/ngrok/util.a -------------------------------------------------------------------------------- /pkg/darwin_386/ngrok/version.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_386/ngrok/version.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/github.com/alecthomas/log4go.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/github.com/alecthomas/log4go.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/github.com/gorilla/websocket.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/github.com/gorilla/websocket.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/github.com/inconshreveable/go-vhost.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/github.com/inconshreveable/go-vhost.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/github.com/inconshreveable/mousetrap.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/github.com/inconshreveable/mousetrap.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/github.com/kardianos/osext.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/github.com/kardianos/osext.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/github.com/kr/binarydist.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/github.com/kr/binarydist.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/github.com/mattn/go-runewidth.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/github.com/mattn/go-runewidth.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/github.com/nsf/termbox-go.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/github.com/nsf/termbox-go.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/github.com/rcrowley/go-metrics.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/github.com/rcrowley/go-metrics.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/gopkg.in/inconshreveable/go-update.v0.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/gopkg.in/inconshreveable/go-update.v0.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/gopkg.in/inconshreveable/go-update.v0/check.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/gopkg.in/inconshreveable/go-update.v0/check.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/gopkg.in/inconshreveable/go-update.v0/download.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/gopkg.in/inconshreveable/go-update.v0/download.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/gopkg.in/yaml.v1.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/gopkg.in/yaml.v1.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/ngrok/cache.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/ngrok/cache.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/ngrok/client.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/ngrok/client.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/ngrok/client/assets.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/ngrok/client/assets.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/ngrok/client/mvc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/ngrok/client/mvc.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/ngrok/client/views/term.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/ngrok/client/views/term.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/ngrok/client/views/web.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/ngrok/client/views/web.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/ngrok/conn.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/ngrok/conn.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/ngrok/log.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/ngrok/log.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/ngrok/msg.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/ngrok/msg.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/ngrok/proto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/ngrok/proto.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/ngrok/server.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/ngrok/server.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/ngrok/server/assets.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/ngrok/server/assets.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/ngrok/util.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/ngrok/util.a -------------------------------------------------------------------------------- /pkg/darwin_amd64/ngrok/version.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/darwin_amd64/ngrok/version.a -------------------------------------------------------------------------------- /pkg/linux_386/github.com/alecthomas/log4go.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/github.com/alecthomas/log4go.a -------------------------------------------------------------------------------- /pkg/linux_386/github.com/gorilla/websocket.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/github.com/gorilla/websocket.a -------------------------------------------------------------------------------- /pkg/linux_386/github.com/inconshreveable/go-vhost.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/github.com/inconshreveable/go-vhost.a -------------------------------------------------------------------------------- /pkg/linux_386/github.com/inconshreveable/mousetrap.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/github.com/inconshreveable/mousetrap.a -------------------------------------------------------------------------------- /pkg/linux_386/github.com/kardianos/osext.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/github.com/kardianos/osext.a -------------------------------------------------------------------------------- /pkg/linux_386/github.com/kr/binarydist.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/github.com/kr/binarydist.a -------------------------------------------------------------------------------- /pkg/linux_386/github.com/mattn/go-runewidth.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/github.com/mattn/go-runewidth.a -------------------------------------------------------------------------------- /pkg/linux_386/github.com/nsf/termbox-go.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/github.com/nsf/termbox-go.a -------------------------------------------------------------------------------- /pkg/linux_386/github.com/rcrowley/go-metrics.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/github.com/rcrowley/go-metrics.a -------------------------------------------------------------------------------- /pkg/linux_386/gopkg.in/inconshreveable/go-update.v0.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/gopkg.in/inconshreveable/go-update.v0.a -------------------------------------------------------------------------------- /pkg/linux_386/gopkg.in/inconshreveable/go-update.v0/check.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/gopkg.in/inconshreveable/go-update.v0/check.a -------------------------------------------------------------------------------- /pkg/linux_386/gopkg.in/inconshreveable/go-update.v0/download.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/gopkg.in/inconshreveable/go-update.v0/download.a -------------------------------------------------------------------------------- /pkg/linux_386/gopkg.in/yaml.v1.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/gopkg.in/yaml.v1.a -------------------------------------------------------------------------------- /pkg/linux_386/ngrok/cache.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/ngrok/cache.a -------------------------------------------------------------------------------- /pkg/linux_386/ngrok/client.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/ngrok/client.a -------------------------------------------------------------------------------- /pkg/linux_386/ngrok/client/assets.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/ngrok/client/assets.a -------------------------------------------------------------------------------- /pkg/linux_386/ngrok/client/mvc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/ngrok/client/mvc.a -------------------------------------------------------------------------------- /pkg/linux_386/ngrok/client/views/term.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/ngrok/client/views/term.a -------------------------------------------------------------------------------- /pkg/linux_386/ngrok/client/views/web.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/ngrok/client/views/web.a -------------------------------------------------------------------------------- /pkg/linux_386/ngrok/conn.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/ngrok/conn.a -------------------------------------------------------------------------------- /pkg/linux_386/ngrok/log.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/ngrok/log.a -------------------------------------------------------------------------------- /pkg/linux_386/ngrok/msg.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/ngrok/msg.a -------------------------------------------------------------------------------- /pkg/linux_386/ngrok/proto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/ngrok/proto.a -------------------------------------------------------------------------------- /pkg/linux_386/ngrok/server.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/ngrok/server.a -------------------------------------------------------------------------------- /pkg/linux_386/ngrok/server/assets.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/ngrok/server/assets.a -------------------------------------------------------------------------------- /pkg/linux_386/ngrok/util.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/ngrok/util.a -------------------------------------------------------------------------------- /pkg/linux_386/ngrok/version.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_386/ngrok/version.a -------------------------------------------------------------------------------- /pkg/linux_amd64/github.com/alecthomas/log4go.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/github.com/alecthomas/log4go.a -------------------------------------------------------------------------------- /pkg/linux_amd64/github.com/gorilla/websocket.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/github.com/gorilla/websocket.a -------------------------------------------------------------------------------- /pkg/linux_amd64/github.com/inconshreveable/go-vhost.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/github.com/inconshreveable/go-vhost.a -------------------------------------------------------------------------------- /pkg/linux_amd64/github.com/inconshreveable/mousetrap.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/github.com/inconshreveable/mousetrap.a -------------------------------------------------------------------------------- /pkg/linux_amd64/github.com/jteeuwen/go-bindata.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/github.com/jteeuwen/go-bindata.a -------------------------------------------------------------------------------- /pkg/linux_amd64/github.com/kardianos/osext.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/github.com/kardianos/osext.a -------------------------------------------------------------------------------- /pkg/linux_amd64/github.com/kr/binarydist.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/github.com/kr/binarydist.a -------------------------------------------------------------------------------- /pkg/linux_amd64/github.com/mattn/go-runewidth.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/github.com/mattn/go-runewidth.a -------------------------------------------------------------------------------- /pkg/linux_amd64/github.com/nsf/termbox-go.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/github.com/nsf/termbox-go.a -------------------------------------------------------------------------------- /pkg/linux_amd64/github.com/rcrowley/go-metrics.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/github.com/rcrowley/go-metrics.a -------------------------------------------------------------------------------- /pkg/linux_amd64/gopkg.in/inconshreveable/go-update.v0.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/gopkg.in/inconshreveable/go-update.v0.a -------------------------------------------------------------------------------- /pkg/linux_amd64/gopkg.in/inconshreveable/go-update.v0/check.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/gopkg.in/inconshreveable/go-update.v0/check.a -------------------------------------------------------------------------------- /pkg/linux_amd64/gopkg.in/inconshreveable/go-update.v0/download.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/gopkg.in/inconshreveable/go-update.v0/download.a -------------------------------------------------------------------------------- /pkg/linux_amd64/gopkg.in/yaml.v1.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/gopkg.in/yaml.v1.a -------------------------------------------------------------------------------- /pkg/linux_amd64/ngrok/cache.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/ngrok/cache.a -------------------------------------------------------------------------------- /pkg/linux_amd64/ngrok/client.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/ngrok/client.a -------------------------------------------------------------------------------- /pkg/linux_amd64/ngrok/client/assets.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/ngrok/client/assets.a -------------------------------------------------------------------------------- /pkg/linux_amd64/ngrok/client/mvc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/ngrok/client/mvc.a -------------------------------------------------------------------------------- /pkg/linux_amd64/ngrok/client/views/term.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/ngrok/client/views/term.a -------------------------------------------------------------------------------- /pkg/linux_amd64/ngrok/client/views/web.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/ngrok/client/views/web.a -------------------------------------------------------------------------------- /pkg/linux_amd64/ngrok/conn.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/ngrok/conn.a -------------------------------------------------------------------------------- /pkg/linux_amd64/ngrok/log.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/ngrok/log.a -------------------------------------------------------------------------------- /pkg/linux_amd64/ngrok/msg.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/ngrok/msg.a -------------------------------------------------------------------------------- /pkg/linux_amd64/ngrok/proto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/ngrok/proto.a -------------------------------------------------------------------------------- /pkg/linux_amd64/ngrok/server.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/ngrok/server.a -------------------------------------------------------------------------------- /pkg/linux_amd64/ngrok/server/assets.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/ngrok/server/assets.a -------------------------------------------------------------------------------- /pkg/linux_amd64/ngrok/util.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/ngrok/util.a -------------------------------------------------------------------------------- /pkg/linux_amd64/ngrok/version.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_amd64/ngrok/version.a -------------------------------------------------------------------------------- /pkg/linux_arm/github.com/alecthomas/log4go.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/github.com/alecthomas/log4go.a -------------------------------------------------------------------------------- /pkg/linux_arm/github.com/gorilla/websocket.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/github.com/gorilla/websocket.a -------------------------------------------------------------------------------- /pkg/linux_arm/github.com/inconshreveable/go-vhost.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/github.com/inconshreveable/go-vhost.a -------------------------------------------------------------------------------- /pkg/linux_arm/github.com/inconshreveable/mousetrap.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/github.com/inconshreveable/mousetrap.a -------------------------------------------------------------------------------- /pkg/linux_arm/github.com/kardianos/osext.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/github.com/kardianos/osext.a -------------------------------------------------------------------------------- /pkg/linux_arm/github.com/kr/binarydist.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/github.com/kr/binarydist.a -------------------------------------------------------------------------------- /pkg/linux_arm/github.com/mattn/go-runewidth.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/github.com/mattn/go-runewidth.a -------------------------------------------------------------------------------- /pkg/linux_arm/github.com/nsf/termbox-go.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/github.com/nsf/termbox-go.a -------------------------------------------------------------------------------- /pkg/linux_arm/github.com/rcrowley/go-metrics.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/github.com/rcrowley/go-metrics.a -------------------------------------------------------------------------------- /pkg/linux_arm/gopkg.in/inconshreveable/go-update.v0.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/gopkg.in/inconshreveable/go-update.v0.a -------------------------------------------------------------------------------- /pkg/linux_arm/gopkg.in/inconshreveable/go-update.v0/check.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/gopkg.in/inconshreveable/go-update.v0/check.a -------------------------------------------------------------------------------- /pkg/linux_arm/gopkg.in/inconshreveable/go-update.v0/download.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/gopkg.in/inconshreveable/go-update.v0/download.a -------------------------------------------------------------------------------- /pkg/linux_arm/gopkg.in/yaml.v1.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/gopkg.in/yaml.v1.a -------------------------------------------------------------------------------- /pkg/linux_arm/ngrok/cache.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/ngrok/cache.a -------------------------------------------------------------------------------- /pkg/linux_arm/ngrok/client.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/ngrok/client.a -------------------------------------------------------------------------------- /pkg/linux_arm/ngrok/client/assets.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/ngrok/client/assets.a -------------------------------------------------------------------------------- /pkg/linux_arm/ngrok/client/mvc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/ngrok/client/mvc.a -------------------------------------------------------------------------------- /pkg/linux_arm/ngrok/client/views/term.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/ngrok/client/views/term.a -------------------------------------------------------------------------------- /pkg/linux_arm/ngrok/client/views/web.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/ngrok/client/views/web.a -------------------------------------------------------------------------------- /pkg/linux_arm/ngrok/conn.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/ngrok/conn.a -------------------------------------------------------------------------------- /pkg/linux_arm/ngrok/log.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/ngrok/log.a -------------------------------------------------------------------------------- /pkg/linux_arm/ngrok/msg.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/ngrok/msg.a -------------------------------------------------------------------------------- /pkg/linux_arm/ngrok/proto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/ngrok/proto.a -------------------------------------------------------------------------------- /pkg/linux_arm/ngrok/server.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/ngrok/server.a -------------------------------------------------------------------------------- /pkg/linux_arm/ngrok/server/assets.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/ngrok/server/assets.a -------------------------------------------------------------------------------- /pkg/linux_arm/ngrok/util.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/ngrok/util.a -------------------------------------------------------------------------------- /pkg/linux_arm/ngrok/version.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/linux_arm/ngrok/version.a -------------------------------------------------------------------------------- /pkg/windows_386/github.com/alecthomas/log4go.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/github.com/alecthomas/log4go.a -------------------------------------------------------------------------------- /pkg/windows_386/github.com/gorilla/websocket.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/github.com/gorilla/websocket.a -------------------------------------------------------------------------------- /pkg/windows_386/github.com/inconshreveable/go-vhost.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/github.com/inconshreveable/go-vhost.a -------------------------------------------------------------------------------- /pkg/windows_386/github.com/inconshreveable/mousetrap.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/github.com/inconshreveable/mousetrap.a -------------------------------------------------------------------------------- /pkg/windows_386/github.com/kardianos/osext.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/github.com/kardianos/osext.a -------------------------------------------------------------------------------- /pkg/windows_386/github.com/kr/binarydist.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/github.com/kr/binarydist.a -------------------------------------------------------------------------------- /pkg/windows_386/github.com/mattn/go-runewidth.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/github.com/mattn/go-runewidth.a -------------------------------------------------------------------------------- /pkg/windows_386/github.com/nsf/termbox-go.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/github.com/nsf/termbox-go.a -------------------------------------------------------------------------------- /pkg/windows_386/github.com/rcrowley/go-metrics.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/github.com/rcrowley/go-metrics.a -------------------------------------------------------------------------------- /pkg/windows_386/gopkg.in/inconshreveable/go-update.v0.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/gopkg.in/inconshreveable/go-update.v0.a -------------------------------------------------------------------------------- /pkg/windows_386/gopkg.in/inconshreveable/go-update.v0/check.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/gopkg.in/inconshreveable/go-update.v0/check.a -------------------------------------------------------------------------------- /pkg/windows_386/gopkg.in/inconshreveable/go-update.v0/download.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/gopkg.in/inconshreveable/go-update.v0/download.a -------------------------------------------------------------------------------- /pkg/windows_386/gopkg.in/yaml.v1.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/gopkg.in/yaml.v1.a -------------------------------------------------------------------------------- /pkg/windows_386/ngrok/cache.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/ngrok/cache.a -------------------------------------------------------------------------------- /pkg/windows_386/ngrok/client.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/ngrok/client.a -------------------------------------------------------------------------------- /pkg/windows_386/ngrok/client/assets.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/ngrok/client/assets.a -------------------------------------------------------------------------------- /pkg/windows_386/ngrok/client/mvc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/ngrok/client/mvc.a -------------------------------------------------------------------------------- /pkg/windows_386/ngrok/client/views/term.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/ngrok/client/views/term.a -------------------------------------------------------------------------------- /pkg/windows_386/ngrok/client/views/web.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/ngrok/client/views/web.a -------------------------------------------------------------------------------- /pkg/windows_386/ngrok/conn.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/ngrok/conn.a -------------------------------------------------------------------------------- /pkg/windows_386/ngrok/log.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/ngrok/log.a -------------------------------------------------------------------------------- /pkg/windows_386/ngrok/msg.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/ngrok/msg.a -------------------------------------------------------------------------------- /pkg/windows_386/ngrok/proto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/ngrok/proto.a -------------------------------------------------------------------------------- /pkg/windows_386/ngrok/server.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/ngrok/server.a -------------------------------------------------------------------------------- /pkg/windows_386/ngrok/server/assets.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/ngrok/server/assets.a -------------------------------------------------------------------------------- /pkg/windows_386/ngrok/util.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/ngrok/util.a -------------------------------------------------------------------------------- /pkg/windows_386/ngrok/version.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_386/ngrok/version.a -------------------------------------------------------------------------------- /pkg/windows_amd64/github.com/alecthomas/log4go.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/github.com/alecthomas/log4go.a -------------------------------------------------------------------------------- /pkg/windows_amd64/github.com/gorilla/websocket.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/github.com/gorilla/websocket.a -------------------------------------------------------------------------------- /pkg/windows_amd64/github.com/inconshreveable/go-vhost.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/github.com/inconshreveable/go-vhost.a -------------------------------------------------------------------------------- /pkg/windows_amd64/github.com/inconshreveable/mousetrap.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/github.com/inconshreveable/mousetrap.a -------------------------------------------------------------------------------- /pkg/windows_amd64/github.com/kardianos/osext.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/github.com/kardianos/osext.a -------------------------------------------------------------------------------- /pkg/windows_amd64/github.com/kr/binarydist.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/github.com/kr/binarydist.a -------------------------------------------------------------------------------- /pkg/windows_amd64/github.com/mattn/go-runewidth.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/github.com/mattn/go-runewidth.a -------------------------------------------------------------------------------- /pkg/windows_amd64/github.com/nsf/termbox-go.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/github.com/nsf/termbox-go.a -------------------------------------------------------------------------------- /pkg/windows_amd64/github.com/rcrowley/go-metrics.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/github.com/rcrowley/go-metrics.a -------------------------------------------------------------------------------- /pkg/windows_amd64/gopkg.in/inconshreveable/go-update.v0.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/gopkg.in/inconshreveable/go-update.v0.a -------------------------------------------------------------------------------- /pkg/windows_amd64/gopkg.in/inconshreveable/go-update.v0/check.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/gopkg.in/inconshreveable/go-update.v0/check.a -------------------------------------------------------------------------------- /pkg/windows_amd64/gopkg.in/inconshreveable/go-update.v0/download.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/gopkg.in/inconshreveable/go-update.v0/download.a -------------------------------------------------------------------------------- /pkg/windows_amd64/gopkg.in/yaml.v1.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/gopkg.in/yaml.v1.a -------------------------------------------------------------------------------- /pkg/windows_amd64/ngrok/cache.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/ngrok/cache.a -------------------------------------------------------------------------------- /pkg/windows_amd64/ngrok/client.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/ngrok/client.a -------------------------------------------------------------------------------- /pkg/windows_amd64/ngrok/client/assets.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/ngrok/client/assets.a -------------------------------------------------------------------------------- /pkg/windows_amd64/ngrok/client/mvc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/ngrok/client/mvc.a -------------------------------------------------------------------------------- /pkg/windows_amd64/ngrok/client/views/term.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/ngrok/client/views/term.a -------------------------------------------------------------------------------- /pkg/windows_amd64/ngrok/client/views/web.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/ngrok/client/views/web.a -------------------------------------------------------------------------------- /pkg/windows_amd64/ngrok/conn.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/ngrok/conn.a -------------------------------------------------------------------------------- /pkg/windows_amd64/ngrok/log.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/ngrok/log.a -------------------------------------------------------------------------------- /pkg/windows_amd64/ngrok/msg.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/ngrok/msg.a -------------------------------------------------------------------------------- /pkg/windows_amd64/ngrok/proto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/ngrok/proto.a -------------------------------------------------------------------------------- /pkg/windows_amd64/ngrok/server.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/ngrok/server.a -------------------------------------------------------------------------------- /pkg/windows_amd64/ngrok/server/assets.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/ngrok/server/assets.a -------------------------------------------------------------------------------- /pkg/windows_amd64/ngrok/util.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/ngrok/util.a -------------------------------------------------------------------------------- /pkg/windows_amd64/ngrok/version.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/pkg/windows_amd64/ngrok/version.a -------------------------------------------------------------------------------- /src/github.com/alecthomas/log4go/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010, Kyle Lemons . All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 5 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the 6 | documentation and/or other materials provided with the distribution. 7 | 8 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 9 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 10 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 12 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 13 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | -------------------------------------------------------------------------------- /src/github.com/alecthomas/log4go/README: -------------------------------------------------------------------------------- 1 | # This is an unmaintained fork, left only so it doesn't break imports. 2 | 3 | Please see http://log4go.googlecode.com/ 4 | 5 | Installation: 6 | - Run `goinstall log4go.googlecode.com/hg` 7 | 8 | Usage: 9 | - Add the following import: 10 | import l4g "log4go.googlecode.com/hg" 11 | 12 | Acknowledgements: 13 | - pomack 14 | For providing awesome patches to bring log4go up to the latest Go spec 15 | -------------------------------------------------------------------------------- /src/github.com/alecthomas/log4go/examples/ConsoleLogWriter_Manual.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | import l4g "code.google.com/p/log4go" 8 | 9 | func main() { 10 | log := l4g.NewLogger() 11 | defer log.Close() 12 | log.AddFilter("stdout", l4g.DEBUG, l4g.NewConsoleLogWriter()) 13 | log.Info("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02")) 14 | } 15 | -------------------------------------------------------------------------------- /src/github.com/alecthomas/log4go/examples/FileLogWriter_Manual.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "fmt" 6 | "io" 7 | "os" 8 | "time" 9 | ) 10 | 11 | import l4g "code.google.com/p/log4go" 12 | 13 | const ( 14 | filename = "flw.log" 15 | ) 16 | 17 | func main() { 18 | // Get a new logger instance 19 | log := l4g.NewLogger() 20 | 21 | // Create a default logger that is logging messages of FINE or higher 22 | log.AddFilter("file", l4g.FINE, l4g.NewFileLogWriter(filename, false)) 23 | log.Close() 24 | 25 | /* Can also specify manually via the following: (these are the defaults) */ 26 | flw := l4g.NewFileLogWriter(filename, false) 27 | flw.SetFormat("[%D %T] [%L] (%S) %M") 28 | flw.SetRotate(false) 29 | flw.SetRotateSize(0) 30 | flw.SetRotateLines(0) 31 | flw.SetRotateDaily(false) 32 | log.AddFilter("file", l4g.FINE, flw) 33 | 34 | // Log some experimental messages 35 | log.Finest("Everything is created now (notice that I will not be printing to the file)") 36 | log.Info("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02")) 37 | log.Critical("Time to close out!") 38 | 39 | // Close the log 40 | log.Close() 41 | 42 | // Print what was logged to the file (yes, I know I'm skipping error checking) 43 | fd, _ := os.Open(filename) 44 | in := bufio.NewReader(fd) 45 | fmt.Print("Messages logged to file were: (line numbers not included)\n") 46 | for lineno := 1; ; lineno++ { 47 | line, err := in.ReadString('\n') 48 | if err == io.EOF { 49 | break 50 | } 51 | fmt.Printf("%3d:\t%s", lineno, line) 52 | } 53 | fd.Close() 54 | 55 | // Remove the file so it's not lying around 56 | os.Remove(filename) 57 | } 58 | -------------------------------------------------------------------------------- /src/github.com/alecthomas/log4go/examples/SimpleNetLogServer.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "net" 7 | "os" 8 | ) 9 | 10 | var ( 11 | port = flag.String("p", "12124", "Port number to listen on") 12 | ) 13 | 14 | func e(err error) { 15 | if err != nil { 16 | fmt.Printf("Erroring out: %s\n", err) 17 | os.Exit(1) 18 | } 19 | } 20 | 21 | func main() { 22 | flag.Parse() 23 | 24 | // Bind to the port 25 | bind, err := net.ResolveUDPAddr("0.0.0.0:" + *port) 26 | e(err) 27 | 28 | // Create listener 29 | listener, err := net.ListenUDP("udp", bind) 30 | e(err) 31 | 32 | fmt.Printf("Listening to port %s...\n", *port) 33 | for { 34 | // read into a new buffer 35 | buffer := make([]byte, 1024) 36 | _, _, err := listener.ReadFrom(buffer) 37 | e(err) 38 | 39 | // log to standard output 40 | fmt.Println(string(buffer)) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/github.com/alecthomas/log4go/examples/SocketLogWriter_Manual.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | import l4g "code.google.com/p/log4go" 8 | 9 | func main() { 10 | log := l4g.NewLogger() 11 | log.AddFilter("network", l4g.FINEST, l4g.NewSocketLogWriter("udp", "192.168.1.255:12124")) 12 | 13 | // Run `nc -u -l -p 12124` or similar before you run this to see the following message 14 | log.Info("The time is now: %s", time.Now().Format("15:04:05 MST 2006/01/02")) 15 | 16 | // This makes sure the output stream buffer is written 17 | log.Close() 18 | } 19 | -------------------------------------------------------------------------------- /src/github.com/alecthomas/log4go/examples/XMLConfigurationExample.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import l4g "code.google.com/p/log4go" 4 | 5 | func main() { 6 | // Load the configuration (isn't this easy?) 7 | l4g.LoadConfiguration("example.xml") 8 | 9 | // And now we're ready! 10 | l4g.Finest("This will only go to those of you really cool UDP kids! If you change enabled=true.") 11 | l4g.Debug("Oh no! %d + %d = %d!", 2, 2, 2+2) 12 | l4g.Info("About that time, eh chaps?") 13 | } 14 | -------------------------------------------------------------------------------- /src/github.com/alecthomas/log4go/examples/example.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | stdout 4 | console 5 | 6 | DEBUG 7 | 8 | 9 | file 10 | file 11 | FINEST 12 | test.log 13 | 24 | [%D %T] [%L] (%S) %M 25 | false 26 | 0M 27 | 0K 28 | true 29 | 30 | 31 | xmllog 32 | xml 33 | TRACE 34 | trace.xml 35 | true 36 | 100M 37 | 6K 38 | false 39 | 40 | 41 | donotopen 42 | socket 43 | FINEST 44 | 192.168.1.255:12124 45 | udp 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/github.com/alecthomas/log4go/socklog.go: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2010, Kyle Lemons . All rights reserved. 2 | 3 | package log4go 4 | 5 | import ( 6 | "encoding/json" 7 | "fmt" 8 | "net" 9 | "os" 10 | ) 11 | 12 | // This log writer sends output to a socket 13 | type SocketLogWriter chan *LogRecord 14 | 15 | // This is the SocketLogWriter's output method 16 | func (w SocketLogWriter) LogWrite(rec *LogRecord) { 17 | w <- rec 18 | } 19 | 20 | func (w SocketLogWriter) Close() { 21 | close(w) 22 | } 23 | 24 | func NewSocketLogWriter(proto, hostport string) SocketLogWriter { 25 | sock, err := net.Dial(proto, hostport) 26 | if err != nil { 27 | fmt.Fprintf(os.Stderr, "NewSocketLogWriter(%q): %s\n", hostport, err) 28 | return nil 29 | } 30 | 31 | w := SocketLogWriter(make(chan *LogRecord, LogBufferLength)) 32 | 33 | go func() { 34 | defer func() { 35 | if sock != nil && proto == "tcp" { 36 | sock.Close() 37 | } 38 | }() 39 | 40 | for rec := range w { 41 | // Marshall into JSON 42 | js, err := json.Marshal(rec) 43 | if err != nil { 44 | fmt.Fprint(os.Stderr, "SocketLogWriter(%q): %s", hostport, err) 45 | return 46 | } 47 | 48 | _, err = sock.Write(js) 49 | if err != nil { 50 | fmt.Fprint(os.Stderr, "SocketLogWriter(%q): %s", hostport, err) 51 | return 52 | } 53 | } 54 | }() 55 | 56 | return w 57 | } 58 | -------------------------------------------------------------------------------- /src/github.com/alecthomas/log4go/termlog.go: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2010, Kyle Lemons . All rights reserved. 2 | 3 | package log4go 4 | 5 | import ( 6 | "fmt" 7 | "io" 8 | "os" 9 | "time" 10 | ) 11 | 12 | var stdout io.Writer = os.Stdout 13 | 14 | // This is the standard writer that prints to standard output. 15 | type ConsoleLogWriter struct { 16 | format string 17 | w chan *LogRecord 18 | } 19 | 20 | // This creates a new ConsoleLogWriter 21 | func NewConsoleLogWriter() *ConsoleLogWriter { 22 | consoleWriter := &ConsoleLogWriter{ 23 | format: "[%T %D] [%L] (%S) %M", 24 | w: make(chan *LogRecord, LogBufferLength), 25 | } 26 | go consoleWriter.run(stdout) 27 | return consoleWriter 28 | } 29 | func (c *ConsoleLogWriter) SetFormat(format string) { 30 | c.format = format 31 | } 32 | func (c *ConsoleLogWriter) run(out io.Writer) { 33 | for rec := range c.w { 34 | fmt.Fprint(out, FormatLogRecord(c.format, rec)) 35 | } 36 | } 37 | 38 | // This is the ConsoleLogWriter's output method. This will block if the output 39 | // buffer is full. 40 | func (c *ConsoleLogWriter) LogWrite(rec *LogRecord) { 41 | c.w <- rec 42 | } 43 | 44 | // Close stops the logger from sending messages to standard output. Attempts to 45 | // send log messages to this logger after a Close have undefined behavior. 46 | func (c *ConsoleLogWriter) Close() { 47 | close(c.w) 48 | time.Sleep(50 * time.Millisecond) // Try to give console I/O time to complete 49 | } 50 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of Gorilla WebSocket authors for copyright 2 | # purposes. 3 | # 4 | # Please keep the list sorted. 5 | 6 | Gary Burd 7 | Joachim Bauch 8 | 9 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 The Gorilla WebSocket 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 met: 5 | 6 | Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | 9 | Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/compression.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Gorilla WebSocket 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 websocket 6 | 7 | import ( 8 | "compress/flate" 9 | "errors" 10 | "io" 11 | "strings" 12 | ) 13 | 14 | func decompressNoContextTakeover(r io.Reader) io.Reader { 15 | const tail = 16 | // Add four bytes as specified in RFC 17 | "\x00\x00\xff\xff" + 18 | // Add final block to squelch unexpected EOF error from flate reader. 19 | "\x01\x00\x00\xff\xff" 20 | 21 | return flate.NewReader(io.MultiReader(r, strings.NewReader(tail))) 22 | } 23 | 24 | func compressNoContextTakeover(w io.WriteCloser) (io.WriteCloser, error) { 25 | tw := &truncWriter{w: w} 26 | fw, err := flate.NewWriter(tw, 3) 27 | return &flateWrapper{fw: fw, tw: tw}, err 28 | } 29 | 30 | // truncWriter is an io.Writer that writes all but the last four bytes of the 31 | // stream to another io.Writer. 32 | type truncWriter struct { 33 | w io.WriteCloser 34 | n int 35 | p [4]byte 36 | } 37 | 38 | func (w *truncWriter) Write(p []byte) (int, error) { 39 | n := 0 40 | 41 | // fill buffer first for simplicity. 42 | if w.n < len(w.p) { 43 | n = copy(w.p[w.n:], p) 44 | p = p[n:] 45 | w.n += n 46 | if len(p) == 0 { 47 | return n, nil 48 | } 49 | } 50 | 51 | m := len(p) 52 | if m > len(w.p) { 53 | m = len(w.p) 54 | } 55 | 56 | if nn, err := w.w.Write(w.p[:m]); err != nil { 57 | return n + nn, err 58 | } 59 | 60 | copy(w.p[:], w.p[m:]) 61 | copy(w.p[len(w.p)-m:], p[len(p)-m:]) 62 | nn, err := w.w.Write(p[:len(p)-m]) 63 | return n + nn, err 64 | } 65 | 66 | type flateWrapper struct { 67 | fw *flate.Writer 68 | tw *truncWriter 69 | } 70 | 71 | func (w *flateWrapper) Write(p []byte) (int, error) { 72 | return w.fw.Write(p) 73 | } 74 | 75 | func (w *flateWrapper) Close() error { 76 | err1 := w.fw.Flush() 77 | if w.tw.p != [4]byte{0, 0, 0xff, 0xff} { 78 | return errors.New("websocket: internal error, unexpected bytes at end of flate stream") 79 | } 80 | err2 := w.tw.w.Close() 81 | if err1 != nil { 82 | return err1 83 | } 84 | return err2 85 | } 86 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/compression_test.go: -------------------------------------------------------------------------------- 1 | package websocket 2 | 3 | import ( 4 | "bytes" 5 | "io" 6 | "testing" 7 | ) 8 | 9 | type nopCloser struct{ io.Writer } 10 | 11 | func (nopCloser) Close() error { return nil } 12 | 13 | func TestTruncWriter(t *testing.T) { 14 | const data = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijlkmnopqrstuvwxyz987654321" 15 | for n := 1; n <= 10; n++ { 16 | var b bytes.Buffer 17 | w := &truncWriter{w: nopCloser{&b}} 18 | p := []byte(data) 19 | for len(p) > 0 { 20 | m := len(p) 21 | if m > n { 22 | m = n 23 | } 24 | w.Write(p[:m]) 25 | p = p[m:] 26 | } 27 | if b.String() != data[:len(data)-len(w.p)] { 28 | t.Errorf("%d: %q", n, b.String()) 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/conn_read.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Gorilla WebSocket 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 | // +build go1.5 6 | 7 | package websocket 8 | 9 | import "io" 10 | 11 | func (c *Conn) read(n int) ([]byte, error) { 12 | p, err := c.br.Peek(n) 13 | if err == io.EOF { 14 | err = errUnexpectedEOF 15 | } 16 | c.br.Discard(len(p)) 17 | return p, err 18 | } 19 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/conn_read_legacy.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Gorilla WebSocket 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 | // +build !go1.5 6 | 7 | package websocket 8 | 9 | import "io" 10 | 11 | func (c *Conn) read(n int) ([]byte, error) { 12 | p, err := c.br.Peek(n) 13 | if err == io.EOF { 14 | err = errUnexpectedEOF 15 | } 16 | if len(p) > 0 { 17 | // advance over the bytes just read 18 | io.ReadFull(c.br, p) 19 | } 20 | return p, err 21 | } 22 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/example_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Gorilla WebSocket 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 websocket_test 6 | 7 | import ( 8 | "log" 9 | "net/http" 10 | "testing" 11 | 12 | "github.com/gorilla/websocket" 13 | ) 14 | 15 | var ( 16 | c *websocket.Conn 17 | req *http.Request 18 | ) 19 | 20 | // The websocket.IsUnexpectedCloseError function is useful for identifying 21 | // application and protocol errors. 22 | // 23 | // This server application works with a client application running in the 24 | // browser. The client application does not explicitly close the websocket. The 25 | // only expected close message from the client has the code 26 | // websocket.CloseGoingAway. All other other close messages are likely the 27 | // result of an application or protocol error and are logged to aid debugging. 28 | func ExampleIsUnexpectedCloseError() { 29 | 30 | for { 31 | messageType, p, err := c.ReadMessage() 32 | if err != nil { 33 | if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) { 34 | log.Printf("error: %v, user-agent: %v", err, req.Header.Get("User-Agent")) 35 | } 36 | return 37 | } 38 | processMesage(messageType, p) 39 | } 40 | } 41 | 42 | func processMesage(mt int, p []byte) {} 43 | 44 | // TestX prevents godoc from showing this entire file in the example. Remove 45 | // this function when a second example is added. 46 | func TestX(t *testing.T) {} 47 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/examples/autobahn/README.md: -------------------------------------------------------------------------------- 1 | # Test Server 2 | 3 | This package contains a server for the [Autobahn WebSockets Test Suite](http://autobahn.ws/testsuite). 4 | 5 | To test the server, run 6 | 7 | go run server.go 8 | 9 | and start the client test driver 10 | 11 | wstest -m fuzzingclient -s fuzzingclient.json 12 | 13 | When the client completes, it writes a report to reports/clients/index.html. 14 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/examples/autobahn/fuzzingclient.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "options": {"failByDrop": false}, 4 | "outdir": "./reports/clients", 5 | "servers": [ 6 | {"agent": "ReadAllWriteMessage", "url": "ws://localhost:9000/m", "options": {"version": 18}}, 7 | {"agent": "ReadAllWrite", "url": "ws://localhost:9000/r", "options": {"version": 18}}, 8 | {"agent": "CopyFull", "url": "ws://localhost:9000/f", "options": {"version": 18}}, 9 | {"agent": "CopyWriterOnly", "url": "ws://localhost:9000/c", "options": {"version": 18}} 10 | ], 11 | "cases": ["*"], 12 | "exclude-cases": [], 13 | "exclude-agent-cases": {} 14 | } 15 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/examples/chat/hub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Gorilla WebSocket 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 main 6 | 7 | // hub maintains the set of active clients and broadcasts messages to the 8 | // clients. 9 | type Hub struct { 10 | // Registered clients. 11 | clients map[*Client]bool 12 | 13 | // Inbound messages from the clients. 14 | broadcast chan []byte 15 | 16 | // Register requests from the clients. 17 | register chan *Client 18 | 19 | // Unregister requests from clients. 20 | unregister chan *Client 21 | } 22 | 23 | func newHub() *Hub { 24 | return &Hub{ 25 | broadcast: make(chan []byte), 26 | register: make(chan *Client), 27 | unregister: make(chan *Client), 28 | clients: make(map[*Client]bool), 29 | } 30 | } 31 | 32 | func (h *Hub) run() { 33 | for { 34 | select { 35 | case client := <-h.register: 36 | h.clients[client] = true 37 | case client := <-h.unregister: 38 | if _, ok := h.clients[client]; ok { 39 | delete(h.clients, client) 40 | close(client.send) 41 | } 42 | case message := <-h.broadcast: 43 | for client := range h.clients { 44 | select { 45 | case client.send <- message: 46 | default: 47 | close(client.send) 48 | delete(h.clients, client) 49 | } 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/examples/chat/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Gorilla WebSocket 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 main 6 | 7 | import ( 8 | "flag" 9 | "log" 10 | "net/http" 11 | "text/template" 12 | ) 13 | 14 | var addr = flag.String("addr", ":8080", "http service address") 15 | var homeTemplate = template.Must(template.ParseFiles("home.html")) 16 | 17 | func serveHome(w http.ResponseWriter, r *http.Request) { 18 | log.Println(r.URL) 19 | if r.URL.Path != "/" { 20 | http.Error(w, "Not found", 404) 21 | return 22 | } 23 | if r.Method != "GET" { 24 | http.Error(w, "Method not allowed", 405) 25 | return 26 | } 27 | w.Header().Set("Content-Type", "text/html; charset=utf-8") 28 | homeTemplate.Execute(w, r.Host) 29 | } 30 | 31 | func main() { 32 | flag.Parse() 33 | hub := newHub() 34 | go hub.run() 35 | http.HandleFunc("/", serveHome) 36 | http.HandleFunc("/ws", func(w http.ResponseWriter, r *http.Request) { 37 | serveWs(hub, w, r) 38 | }) 39 | err := http.ListenAndServe(*addr, nil) 40 | if err != nil { 41 | log.Fatal("ListenAndServe: ", err) 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/examples/command/README.md: -------------------------------------------------------------------------------- 1 | # Command example 2 | 3 | This example connects a websocket connection to stdin and stdout of a command. 4 | Received messages are written to stdin followed by a `\n`. Each line read from 5 | from standard out is sent as a message to the client. 6 | 7 | $ go get github.com/gorilla/websocket 8 | $ cd `go list -f '{{.Dir}}' github.com/gorilla/websocket/examples/command` 9 | $ go run main.go 10 | # Open http://localhost:8080/ . 11 | 12 | Try the following commands. 13 | 14 | # Echo sent messages to the output area. 15 | $ go run main.go cat 16 | 17 | # Run a shell.Try sending "ls" and "cat main.go". 18 | $ go run main.go sh 19 | 20 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/examples/command/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Command Example 5 | 6 | 47 | 88 | 89 | 90 |
91 |
92 | 93 | 94 |
95 | 96 | 97 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/examples/echo/README.md: -------------------------------------------------------------------------------- 1 | # Client and server example 2 | 3 | This example shows a simple client and server. 4 | 5 | The server echoes messages sent to it. The client sends a message every second 6 | and prints all messages received. 7 | 8 | To run the example, start the server: 9 | 10 | $ go run server.go 11 | 12 | Next, start the client: 13 | 14 | $ go run client.go 15 | 16 | The server includes a simple web client. To use the client, open 17 | http://127.0.0.1:8080 in the browser and follow the instructions on the page. 18 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/examples/echo/client.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Gorilla WebSocket 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 | // +build ignore 6 | 7 | package main 8 | 9 | import ( 10 | "flag" 11 | "log" 12 | "net/url" 13 | "os" 14 | "os/signal" 15 | "time" 16 | 17 | "github.com/gorilla/websocket" 18 | ) 19 | 20 | var addr = flag.String("addr", "localhost:8080", "http service address") 21 | 22 | func main() { 23 | flag.Parse() 24 | log.SetFlags(0) 25 | 26 | interrupt := make(chan os.Signal, 1) 27 | signal.Notify(interrupt, os.Interrupt) 28 | 29 | u := url.URL{Scheme: "ws", Host: *addr, Path: "/echo"} 30 | log.Printf("connecting to %s", u.String()) 31 | 32 | c, _, err := websocket.DefaultDialer.Dial(u.String(), nil) 33 | if err != nil { 34 | log.Fatal("dial:", err) 35 | } 36 | defer c.Close() 37 | 38 | done := make(chan struct{}) 39 | 40 | go func() { 41 | defer c.Close() 42 | defer close(done) 43 | for { 44 | _, message, err := c.ReadMessage() 45 | if err != nil { 46 | log.Println("read:", err) 47 | return 48 | } 49 | log.Printf("recv: %s", message) 50 | } 51 | }() 52 | 53 | ticker := time.NewTicker(time.Second) 54 | defer ticker.Stop() 55 | 56 | for { 57 | select { 58 | case t := <-ticker.C: 59 | err := c.WriteMessage(websocket.TextMessage, []byte(t.String())) 60 | if err != nil { 61 | log.Println("write:", err) 62 | return 63 | } 64 | case <-interrupt: 65 | log.Println("interrupt") 66 | // To cleanly close a connection, a client should send a close 67 | // frame and wait for the server to close the connection. 68 | err := c.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, "")) 69 | if err != nil { 70 | log.Println("write close:", err) 71 | return 72 | } 73 | select { 74 | case <-done: 75 | case <-time.After(time.Second): 76 | } 77 | c.Close() 78 | return 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/examples/filewatch/README.md: -------------------------------------------------------------------------------- 1 | # File Watch example. 2 | 3 | This example sends a file to the browser client for display whenever the file is modified. 4 | 5 | $ go get github.com/gorilla/websocket 6 | $ cd `go list -f '{{.Dir}}' github.com/gorilla/websocket/examples/filewatch` 7 | $ go run main.go 8 | # Open http://localhost:8080/ . 9 | # Modify the file to see it update in the browser. 10 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/json.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Gorilla WebSocket 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 websocket 6 | 7 | import ( 8 | "encoding/json" 9 | "io" 10 | ) 11 | 12 | // WriteJSON is deprecated, use c.WriteJSON instead. 13 | func WriteJSON(c *Conn, v interface{}) error { 14 | return c.WriteJSON(v) 15 | } 16 | 17 | // WriteJSON writes the JSON encoding of v to the connection. 18 | // 19 | // See the documentation for encoding/json Marshal for details about the 20 | // conversion of Go values to JSON. 21 | func (c *Conn) WriteJSON(v interface{}) error { 22 | w, err := c.NextWriter(TextMessage) 23 | if err != nil { 24 | return err 25 | } 26 | err1 := json.NewEncoder(w).Encode(v) 27 | err2 := w.Close() 28 | if err1 != nil { 29 | return err1 30 | } 31 | return err2 32 | } 33 | 34 | // ReadJSON is deprecated, use c.ReadJSON instead. 35 | func ReadJSON(c *Conn, v interface{}) error { 36 | return c.ReadJSON(v) 37 | } 38 | 39 | // ReadJSON reads the next JSON-encoded message from the connection and stores 40 | // it in the value pointed to by v. 41 | // 42 | // See the documentation for the encoding/json Unmarshal function for details 43 | // about the conversion of JSON to a Go value. 44 | func (c *Conn) ReadJSON(v interface{}) error { 45 | _, r, err := c.NextReader() 46 | if err != nil { 47 | return err 48 | } 49 | err = json.NewDecoder(r).Decode(v) 50 | if err == io.EOF { 51 | // One value is expected in the message. 52 | err = io.ErrUnexpectedEOF 53 | } 54 | return err 55 | } 56 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/mask.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. Use of 2 | // this source code is governed by a BSD-style license that can be found in the 3 | // LICENSE file. 4 | 5 | package websocket 6 | 7 | import ( 8 | "math/rand" 9 | "unsafe" 10 | ) 11 | 12 | const wordSize = int(unsafe.Sizeof(uintptr(0))) 13 | 14 | func newMaskKey() [4]byte { 15 | n := rand.Uint32() 16 | return [4]byte{byte(n), byte(n >> 8), byte(n >> 16), byte(n >> 24)} 17 | } 18 | 19 | func maskBytes(key [4]byte, pos int, b []byte) int { 20 | 21 | // Mask one byte at a time for small buffers. 22 | if len(b) < 2*wordSize { 23 | for i := range b { 24 | b[i] ^= key[pos&3] 25 | pos++ 26 | } 27 | return pos & 3 28 | } 29 | 30 | // Mask one byte at a time to word boundary. 31 | if n := int(uintptr(unsafe.Pointer(&b[0]))) % wordSize; n != 0 { 32 | n = wordSize - n 33 | for i := range b[:n] { 34 | b[i] ^= key[pos&3] 35 | pos++ 36 | } 37 | b = b[n:] 38 | } 39 | 40 | // Create aligned word size key. 41 | var k [wordSize]byte 42 | for i := range k { 43 | k[i] = key[(pos+i)&3] 44 | } 45 | kw := *(*uintptr)(unsafe.Pointer(&k)) 46 | 47 | // Mask one word at a time. 48 | n := (len(b) / wordSize) * wordSize 49 | for i := 0; i < n; i += wordSize { 50 | *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&b[0])) + uintptr(i))) ^= kw 51 | } 52 | 53 | // Mask one byte at a time for remaining bytes. 54 | b = b[n:] 55 | for i := range b { 56 | b[i] ^= key[pos&3] 57 | pos++ 58 | } 59 | 60 | return pos & 3 61 | } 62 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/mask_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. Use of 2 | // this source code is governed by a BSD-style license that can be found in the 3 | // LICENSE file. 4 | 5 | // Require 1.7 for sub-bencmarks 6 | // +build go1.7 7 | 8 | package websocket 9 | 10 | import ( 11 | "fmt" 12 | "testing" 13 | ) 14 | 15 | func maskBytesByByte(key [4]byte, pos int, b []byte) int { 16 | for i := range b { 17 | b[i] ^= key[pos&3] 18 | pos++ 19 | } 20 | return pos & 3 21 | } 22 | 23 | func notzero(b []byte) int { 24 | for i := range b { 25 | if b[i] != 0 { 26 | return i 27 | } 28 | } 29 | return -1 30 | } 31 | 32 | func TestMaskBytes(t *testing.T) { 33 | key := [4]byte{1, 2, 3, 4} 34 | for size := 1; size <= 1024; size++ { 35 | for align := 0; align < wordSize; align++ { 36 | for pos := 0; pos < 4; pos++ { 37 | b := make([]byte, size+align)[align:] 38 | maskBytes(key, pos, b) 39 | maskBytesByByte(key, pos, b) 40 | if i := notzero(b); i >= 0 { 41 | t.Errorf("size:%d, align:%d, pos:%d, offset:%d", size, align, pos, i) 42 | } 43 | } 44 | } 45 | } 46 | } 47 | 48 | func BenchmarkMaskBytes(b *testing.B) { 49 | for _, size := range []int{2, 4, 8, 16, 32, 512, 1024} { 50 | b.Run(fmt.Sprintf("size-%d", size), func(b *testing.B) { 51 | for _, align := range []int{wordSize / 2} { 52 | b.Run(fmt.Sprintf("align-%d", align), func(b *testing.B) { 53 | for _, fn := range []struct { 54 | name string 55 | fn func(key [4]byte, pos int, b []byte) int 56 | }{ 57 | {"byte", maskBytesByByte}, 58 | {"word", maskBytes}, 59 | } { 60 | b.Run(fn.name, func(b *testing.B) { 61 | key := newMaskKey() 62 | data := make([]byte, size+align)[align:] 63 | for i := 0; i < b.N; i++ { 64 | fn.fn(key, 0, data) 65 | } 66 | b.SetBytes(int64(len(data))) 67 | }) 68 | } 69 | }) 70 | } 71 | }) 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/github.com/gorilla/websocket/server_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Gorilla WebSocket 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 websocket 6 | 7 | import ( 8 | "net/http" 9 | "reflect" 10 | "testing" 11 | ) 12 | 13 | var subprotocolTests = []struct { 14 | h string 15 | protocols []string 16 | }{ 17 | {"", nil}, 18 | {"foo", []string{"foo"}}, 19 | {"foo,bar", []string{"foo", "bar"}}, 20 | {"foo, bar", []string{"foo", "bar"}}, 21 | {" foo, bar", []string{"foo", "bar"}}, 22 | {" foo, bar ", []string{"foo", "bar"}}, 23 | } 24 | 25 | func TestSubprotocols(t *testing.T) { 26 | for _, st := range subprotocolTests { 27 | r := http.Request{Header: http.Header{"Sec-Websocket-Protocol": {st.h}}} 28 | protocols := Subprotocols(&r) 29 | if !reflect.DeepEqual(st.protocols, protocols) { 30 | t.Errorf("SubProtocols(%q) returned %#v, want %#v", st.h, protocols, st.protocols) 31 | } 32 | } 33 | } 34 | 35 | var isWebSocketUpgradeTests = []struct { 36 | ok bool 37 | h http.Header 38 | }{ 39 | {false, http.Header{"Upgrade": {"websocket"}}}, 40 | {false, http.Header{"Connection": {"upgrade"}}}, 41 | {true, http.Header{"Connection": {"upgRade"}, "Upgrade": {"WebSocket"}}}, 42 | } 43 | 44 | func TestIsWebSocketUpgrade(t *testing.T) { 45 | for _, tt := range isWebSocketUpgradeTests { 46 | ok := IsWebSocketUpgrade(&http.Request{Header: tt.h}) 47 | if tt.ok != ok { 48 | t.Errorf("IsWebSocketUpgrade(%v) returned %v, want %v", tt.h, ok, tt.ok) 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/github.com/inconshreveable/go-vhost/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014 Alan Shreve 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /src/github.com/inconshreveable/go-vhost/http.go: -------------------------------------------------------------------------------- 1 | package vhost 2 | 3 | import ( 4 | "bufio" 5 | "net" 6 | "net/http" 7 | ) 8 | 9 | type HTTPConn struct { 10 | *sharedConn 11 | Request *http.Request 12 | } 13 | 14 | // HTTP parses the head of the first HTTP request on conn and returns 15 | // a new, unread connection with metadata for virtual host muxing 16 | func HTTP(conn net.Conn) (httpConn *HTTPConn, err error) { 17 | c, rd := newShared(conn) 18 | 19 | httpConn = &HTTPConn{sharedConn: c} 20 | if httpConn.Request, err = http.ReadRequest(bufio.NewReader(rd)); err != nil { 21 | return 22 | } 23 | 24 | // You probably don't need access to the request body and this makes the API 25 | // simpler by allowing you to call Free() optionally 26 | httpConn.Request.Body.Close() 27 | 28 | return 29 | } 30 | 31 | // Free sets Request to nil so that it can be garbage collected 32 | func (c *HTTPConn) Free() { 33 | c.Request = nil 34 | } 35 | 36 | func (c *HTTPConn) Host() string { 37 | if c.Request == nil { 38 | return "" 39 | } 40 | 41 | return c.Request.Host 42 | } 43 | -------------------------------------------------------------------------------- /src/github.com/inconshreveable/go-vhost/http_test.go: -------------------------------------------------------------------------------- 1 | package vhost 2 | 3 | import ( 4 | "net" 5 | "net/http" 6 | "testing" 7 | ) 8 | 9 | func TestHTTPHost(t *testing.T) { 10 | var testHostname string = "foo.example.com" 11 | 12 | l, err := net.Listen("tcp", "127.0.0.1:12345") 13 | if err != nil { 14 | panic(err) 15 | } 16 | defer l.Close() 17 | 18 | go func() { 19 | conn, err := net.Dial("tcp", "127.0.0.1:12345") 20 | if err != nil { 21 | panic(err) 22 | } 23 | defer conn.Close() 24 | req, err := http.NewRequest("GET", "http://"+testHostname+"/bar", nil) 25 | if err != nil { 26 | panic(err) 27 | } 28 | if err = req.Write(conn); err != nil { 29 | panic(err) 30 | } 31 | }() 32 | 33 | conn, err := l.Accept() 34 | if err != nil { 35 | panic(err) 36 | } 37 | c, err := HTTP(conn) 38 | if err != nil { 39 | panic(err) 40 | } 41 | 42 | if c.Host() != testHostname { 43 | t.Errorf("Connection Host() is %s, expected %s", c.Host(), testHostname) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/github.com/inconshreveable/go-vhost/interface.go: -------------------------------------------------------------------------------- 1 | package vhost 2 | 3 | import ( 4 | "net" 5 | ) 6 | 7 | type Conn interface { 8 | net.Conn 9 | Host() string 10 | Free() 11 | } 12 | -------------------------------------------------------------------------------- /src/github.com/inconshreveable/go-vhost/shared.go: -------------------------------------------------------------------------------- 1 | package vhost 2 | 3 | import ( 4 | "bytes" 5 | "io" 6 | "net" 7 | "sync" 8 | ) 9 | 10 | const ( 11 | initVhostBufSize = 1024 // allocate 1 KB up front to try to avoid resizing 12 | ) 13 | 14 | type sharedConn struct { 15 | sync.Mutex 16 | net.Conn // the raw connection 17 | vhostBuf *bytes.Buffer // all of the initial data that has to be read in order to vhost a connection is saved here 18 | } 19 | 20 | func newShared(conn net.Conn) (*sharedConn, io.Reader) { 21 | c := &sharedConn{ 22 | Conn: conn, 23 | vhostBuf: bytes.NewBuffer(make([]byte, 0, initVhostBufSize)), 24 | } 25 | 26 | return c, io.TeeReader(conn, c.vhostBuf) 27 | } 28 | 29 | func (c *sharedConn) Read(p []byte) (n int, err error) { 30 | c.Lock() 31 | if c.vhostBuf == nil { 32 | c.Unlock() 33 | return c.Conn.Read(p) 34 | } 35 | n, err = c.vhostBuf.Read(p) 36 | 37 | // end of the request buffer 38 | if err == io.EOF { 39 | // let the request buffer get garbage collected 40 | // and make sure we don't read from it again 41 | c.vhostBuf = nil 42 | 43 | // continue reading from the connection 44 | var n2 int 45 | n2, err = c.Conn.Read(p[n:]) 46 | 47 | // update total read 48 | n += n2 49 | } 50 | c.Unlock() 51 | return 52 | } 53 | -------------------------------------------------------------------------------- /src/github.com/inconshreveable/go-vhost/shared_test.go: -------------------------------------------------------------------------------- 1 | package vhost 2 | 3 | import ( 4 | "bytes" 5 | "io" 6 | "net" 7 | "reflect" 8 | "testing" 9 | ) 10 | 11 | func TestHeaderPreserved(t *testing.T) { 12 | var msg string = "TestHeaderPreserved message! Hello world!" 13 | var headerLen int = 15 14 | 15 | l, err := net.Listen("tcp", "127.0.0.1:12345") 16 | if err != nil { 17 | panic(err) 18 | } 19 | defer l.Close() 20 | 21 | go func() { 22 | conn, err := net.Dial("tcp", "127.0.0.1:12345") 23 | if err != nil { 24 | panic(err) 25 | } 26 | if _, err := conn.Write([]byte(msg)); err != nil { 27 | panic(err) 28 | } 29 | if err = conn.Close(); err != nil { 30 | panic(err) 31 | } 32 | }() 33 | 34 | conn, err := l.Accept() 35 | if err != nil { 36 | panic(err) 37 | } 38 | 39 | // create a shared connection object 40 | c, rd := newShared(conn) 41 | 42 | // read out a "header" 43 | p := make([]byte, headerLen) 44 | _, err = io.ReadFull(rd, p) 45 | if err != nil { 46 | panic(err) 47 | } 48 | 49 | // make sure we got the header 50 | expectedHeader := []byte(msg[:headerLen]) 51 | if !reflect.DeepEqual(p, expectedHeader) { 52 | t.Errorf("Read header bytes %s, expected %s", p, expectedHeader) 53 | return 54 | } 55 | 56 | // read out the entire connection. make sure it includes the header 57 | buf := bytes.NewBuffer([]byte{}) 58 | io.Copy(buf, c) 59 | 60 | expected := []byte(msg) 61 | if !reflect.DeepEqual(buf.Bytes(), expected) { 62 | t.Errorf("Read full connection bytes %s, expected %s", buf.Bytes(), expected) 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/github.com/inconshreveable/go-vhost/tls_test.go: -------------------------------------------------------------------------------- 1 | package vhost 2 | 3 | import ( 4 | "crypto/tls" 5 | "net" 6 | "testing" 7 | ) 8 | 9 | func TestSNI(t *testing.T) { 10 | var testHostname string = "foo.example.com" 11 | 12 | l, err := net.Listen("tcp", "127.0.0.1:12345") 13 | if err != nil { 14 | panic(err) 15 | } 16 | defer l.Close() 17 | 18 | go func() { 19 | conf := &tls.Config{ServerName: testHostname} 20 | conn, err := tls.Dial("tcp", "127.0.0.1:12345", conf) 21 | if err != nil { 22 | panic(err) 23 | } 24 | conn.Close() 25 | }() 26 | 27 | conn, err := l.Accept() 28 | if err != nil { 29 | panic(err) 30 | } 31 | c, err := TLS(conn) 32 | if err != nil { 33 | panic(err) 34 | } 35 | 36 | if c.Host() != testHostname { 37 | t.Errorf("Connection Host() is %s, expected %s", c.Host(), testHostname) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/github.com/inconshreveable/mousetrap/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014 Alan Shreve 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /src/github.com/inconshreveable/mousetrap/README.md: -------------------------------------------------------------------------------- 1 | # mousetrap 2 | 3 | mousetrap is a tiny library that answers a single question. 4 | 5 | On a Windows machine, was the process invoked by someone double clicking on 6 | the executable file while browsing in explorer? 7 | 8 | ### Motivation 9 | 10 | Windows developers unfamiliar with command line tools will often "double-click" 11 | the executable for a tool. Because most CLI tools print the help and then exit 12 | when invoked without arguments, this is often very frustrating for those users. 13 | 14 | mousetrap provides a way to detect these invocations so that you can provide 15 | more helpful behavior and instructions on how to run the CLI tool. To see what 16 | this looks like, both from an organizational and a technical perspective, see 17 | https://inconshreveable.com/09-09-2014/sweat-the-small-stuff/ 18 | 19 | ### The interface 20 | 21 | The library exposes a single interface: 22 | 23 | func StartedByExplorer() (bool) 24 | -------------------------------------------------------------------------------- /src/github.com/inconshreveable/mousetrap/trap_others.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package mousetrap 4 | 5 | // StartedByExplorer returns true if the program was invoked by the user 6 | // double-clicking on the executable from explorer.exe 7 | // 8 | // It is conservative and returns false if any of the internal calls fail. 9 | // It does not guarantee that the program was run from a terminal. It only can tell you 10 | // whether it was launched from explorer.exe 11 | // 12 | // On non-Windows platforms, it always returns false. 13 | func StartedByExplorer() bool { 14 | return false 15 | } 16 | -------------------------------------------------------------------------------- /src/github.com/inconshreveable/mousetrap/trap_windows_1.4.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | // +build go1.4 3 | 4 | package mousetrap 5 | 6 | import ( 7 | "os" 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | func getProcessEntry(pid int) (*syscall.ProcessEntry32, error) { 13 | snapshot, err := syscall.CreateToolhelp32Snapshot(syscall.TH32CS_SNAPPROCESS, 0) 14 | if err != nil { 15 | return nil, err 16 | } 17 | defer syscall.CloseHandle(snapshot) 18 | var procEntry syscall.ProcessEntry32 19 | procEntry.Size = uint32(unsafe.Sizeof(procEntry)) 20 | if err = syscall.Process32First(snapshot, &procEntry); err != nil { 21 | return nil, err 22 | } 23 | for { 24 | if procEntry.ProcessID == uint32(pid) { 25 | return &procEntry, nil 26 | } 27 | err = syscall.Process32Next(snapshot, &procEntry) 28 | if err != nil { 29 | return nil, err 30 | } 31 | } 32 | } 33 | 34 | // StartedByExplorer returns true if the program was invoked by the user double-clicking 35 | // on the executable from explorer.exe 36 | // 37 | // It is conservative and returns false if any of the internal calls fail. 38 | // It does not guarantee that the program was run from a terminal. It only can tell you 39 | // whether it was launched from explorer.exe 40 | func StartedByExplorer() bool { 41 | pe, err := getProcessEntry(os.Getppid()) 42 | if err != nil { 43 | return false 44 | } 45 | return "explorer.exe" == syscall.UTF16ToString(pe.ExeFile[:]) 46 | } 47 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/LICENSE: -------------------------------------------------------------------------------- 1 | This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication 2 | license. Its contents can be found at: 3 | http://creativecommons.org/publicdomain/zero/1.0 4 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | make -C testdata 3 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/asset.go: -------------------------------------------------------------------------------- 1 | // This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication 2 | // license. Its contents can be found at: 3 | // http://creativecommons.org/publicdomain/zero/1.0/ 4 | 5 | package bindata 6 | 7 | // Asset holds information about a single asset to be processed. 8 | type Asset struct { 9 | Path string // Full file path. 10 | Name string // Key used in TOC -- name by which asset is referenced. 11 | Func string // Function name for the procedure returning the asset contents. 12 | } 13 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/bytewriter.go: -------------------------------------------------------------------------------- 1 | // This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication 2 | // license. Its contents can be found at: 3 | // http://creativecommons.org/publicdomain/zero/1.0/ 4 | 5 | package bindata 6 | 7 | import ( 8 | "fmt" 9 | "io" 10 | ) 11 | 12 | var ( 13 | newline = []byte{'\n'} 14 | dataindent = []byte{'\t', '\t'} 15 | space = []byte{' '} 16 | ) 17 | 18 | type ByteWriter struct { 19 | io.Writer 20 | c int 21 | } 22 | 23 | func (w *ByteWriter) Write(p []byte) (n int, err error) { 24 | if len(p) == 0 { 25 | return 26 | } 27 | 28 | for n = range p { 29 | if w.c%12 == 0 { 30 | w.Writer.Write(newline) 31 | w.Writer.Write(dataindent) 32 | w.c = 0 33 | } else { 34 | w.Writer.Write(space) 35 | } 36 | 37 | fmt.Fprintf(w.Writer, "0x%02x,", p[n]) 38 | w.c++ 39 | } 40 | 41 | n++ 42 | 43 | return 44 | } 45 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/debug.go: -------------------------------------------------------------------------------- 1 | // This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication 2 | // license. Its contents can be found at: 3 | // http://creativecommons.org/publicdomain/zero/1.0/ 4 | 5 | package bindata 6 | 7 | import ( 8 | "fmt" 9 | "io" 10 | ) 11 | 12 | // writeDebug writes the debug code file. 13 | func writeDebug(w io.Writer, c *Config, toc []Asset) error { 14 | err := writeDebugHeader(w) 15 | if err != nil { 16 | return err 17 | } 18 | 19 | for i := range toc { 20 | err = writeDebugAsset(w, c, &toc[i]) 21 | if err != nil { 22 | return err 23 | } 24 | } 25 | 26 | return nil 27 | } 28 | 29 | // writeDebugHeader writes output file headers. 30 | // This targets debug builds. 31 | func writeDebugHeader(w io.Writer) error { 32 | _, err := fmt.Fprintf(w, `import ( 33 | "fmt" 34 | "io/ioutil" 35 | "os" 36 | "path/filepath" 37 | "strings" 38 | ) 39 | 40 | // bindataRead reads the given file from disk. It returns an error on failure. 41 | func bindataRead(path, name string) ([]byte, error) { 42 | buf, err := ioutil.ReadFile(path) 43 | if err != nil { 44 | err = fmt.Errorf("Error reading asset %%s at %%s: %%v", name, path, err) 45 | } 46 | return buf, err 47 | } 48 | 49 | type asset struct { 50 | bytes []byte 51 | info os.FileInfo 52 | } 53 | 54 | `) 55 | return err 56 | } 57 | 58 | // writeDebugAsset write a debug entry for the given asset. 59 | // A debug entry is simply a function which reads the asset from 60 | // the original file (e.g.: from disk). 61 | func writeDebugAsset(w io.Writer, c *Config, asset *Asset) error { 62 | pathExpr := fmt.Sprintf("%q", asset.Path) 63 | if c.Dev { 64 | pathExpr = fmt.Sprintf("filepath.Join(rootDir, %q)", asset.Name) 65 | } 66 | 67 | _, err := fmt.Fprintf(w, `// %s reads file data from disk. It returns an error on failure. 68 | func %s() (*asset, error) { 69 | path := %s 70 | name := %q 71 | bytes, err := bindataRead(path, name) 72 | if err != nil { 73 | return nil, err 74 | } 75 | 76 | fi, err := os.Stat(path) 77 | if err != nil { 78 | err = fmt.Errorf("Error reading asset info %%s at %%s: %%v", name, path, err) 79 | } 80 | 81 | a := &asset{bytes: bytes, info: fi} 82 | return a, err 83 | } 84 | 85 | `, asset.Func, asset.Func, pathExpr, asset.Name) 86 | return err 87 | } 88 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/go-bindata/AppendSliceValue.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "strings" 4 | 5 | // borrowed from https://github.com/hashicorp/serf/blob/master/command/agent/flag_slice_value.go 6 | 7 | // AppendSliceValue implements the flag.Value interface and allows multiple 8 | // calls to the same variable to append a list. 9 | type AppendSliceValue []string 10 | 11 | func (s *AppendSliceValue) String() string { 12 | return strings.Join(*s, ",") 13 | } 14 | 15 | func (s *AppendSliceValue) Set(value string) error { 16 | if *s == nil { 17 | *s = make([]string, 0, 1) 18 | } 19 | 20 | *s = append(*s, value) 21 | return nil 22 | } 23 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/go-bindata/version.go: -------------------------------------------------------------------------------- 1 | // This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication 2 | // license. Its contents can be found at: 3 | // http://creativecommons.org/publicdomain/zero/1.0/ 4 | 5 | package main 6 | 7 | import ( 8 | "fmt" 9 | "runtime" 10 | ) 11 | 12 | const ( 13 | AppName = "go-bindata" 14 | AppVersionMajor = 3 15 | AppVersionMinor = 1 16 | ) 17 | 18 | // revision part of the program version. 19 | // This will be set automatically at build time like so: 20 | // 21 | // go build -ldflags "-X main.AppVersionRev `date -u +%s`" 22 | var AppVersionRev string 23 | 24 | func Version() string { 25 | if len(AppVersionRev) == 0 { 26 | AppVersionRev = "0" 27 | } 28 | 29 | return fmt.Sprintf("%s %d.%d.%s (Go runtime %s).\nCopyright (c) 2010-2013, Jim Teeuwen.", 30 | AppName, AppVersionMajor, AppVersionMinor, AppVersionRev, runtime.Version()) 31 | } 32 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/restore.go: -------------------------------------------------------------------------------- 1 | // This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication 2 | // license. Its contents can be found at: 3 | // http://creativecommons.org/publicdomain/zero/1.0/ 4 | 5 | package bindata 6 | 7 | import ( 8 | "fmt" 9 | "io" 10 | ) 11 | 12 | func writeRestore(w io.Writer) error { 13 | _, err := fmt.Fprintf(w, ` 14 | // RestoreAsset restores an asset under the given directory 15 | func RestoreAsset(dir, name string) error { 16 | data, err := Asset(name) 17 | if err != nil { 18 | return err 19 | } 20 | info, err := AssetInfo(name) 21 | if err != nil { 22 | return err 23 | } 24 | err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) 25 | if err != nil { 26 | return err 27 | } 28 | err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) 29 | if err != nil { 30 | return err 31 | } 32 | err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) 33 | if err != nil { 34 | return err 35 | } 36 | return nil 37 | } 38 | 39 | // RestoreAssets restores an asset under the given directory recursively 40 | func RestoreAssets(dir, name string) error { 41 | children, err := AssetDir(name) 42 | // File 43 | if err != nil { 44 | return RestoreAsset(dir, name) 45 | } 46 | // Dir 47 | for _, child := range children { 48 | err = RestoreAssets(dir, filepath.Join(name, child)) 49 | if err != nil { 50 | return err 51 | } 52 | } 53 | return nil 54 | } 55 | 56 | func _filePath(dir, name string) string { 57 | cannonicalName := strings.Replace(name, "\\", "/", -1) 58 | return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) 59 | } 60 | 61 | `) 62 | return err 63 | } 64 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/stringwriter.go: -------------------------------------------------------------------------------- 1 | // This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication 2 | // license. Its contents can be found at: 3 | // http://creativecommons.org/publicdomain/zero/1.0/ 4 | 5 | package bindata 6 | 7 | import ( 8 | "io" 9 | ) 10 | 11 | const lowerHex = "0123456789abcdef" 12 | 13 | type StringWriter struct { 14 | io.Writer 15 | c int 16 | } 17 | 18 | func (w *StringWriter) Write(p []byte) (n int, err error) { 19 | if len(p) == 0 { 20 | return 21 | } 22 | 23 | buf := []byte(`\x00`) 24 | var b byte 25 | 26 | for n, b = range p { 27 | buf[2] = lowerHex[b/16] 28 | buf[3] = lowerHex[b%16] 29 | w.Writer.Write(buf) 30 | w.c++ 31 | } 32 | 33 | n++ 34 | 35 | return 36 | } 37 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/Makefile: -------------------------------------------------------------------------------- 1 | FILES:=$(wildcard out/*.go) 2 | 3 | .PHONY: check 4 | check: errcheck vet golint $(FILES:.go=.checked) 5 | 6 | out/%.checked: out/%.go 7 | errcheck $< 8 | go tool vet --all $< 9 | go tool vet --shadow $< 10 | golint $< 11 | 12 | $(GOPATH)/bin/go-bindata: $(wildcard ../*.go) $(wildcard ../**/*.go) 13 | go install ../... 14 | 15 | out/compress-memcopy.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata 16 | $(GOPATH)/bin/go-bindata -o $@ in/... 17 | 18 | out/compress-nomemcopy.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata 19 | $(GOPATH)/bin/go-bindata -nomemcopy -o $@ in/... 20 | 21 | out/debug.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata 22 | $(GOPATH)/bin/go-bindata -debug -o $@ in/... 23 | 24 | out/nocompress-memcopy.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata 25 | $(GOPATH)/bin/go-bindata -nocompress -o $@ in/... 26 | 27 | out/nocompress-nomemcopy.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata 28 | $(GOPATH)/bin/go-bindata -nocompress -nomemcopy -o $@ in/... 29 | 30 | errcheck: 31 | go get github.com/kisielk/errcheck 32 | 33 | vet: 34 | go get golang.org/x/tools/cmd/vet 35 | 36 | golint: 37 | go get github.com/golang/lint/golint 38 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/dupname/foo/bar: -------------------------------------------------------------------------------- 1 | // sample file 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/dupname/foo_bar: -------------------------------------------------------------------------------- 1 | // sample file 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/in/a/test.asset: -------------------------------------------------------------------------------- 1 | // sample file 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/in/b/test.asset: -------------------------------------------------------------------------------- 1 | // sample file 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/in/c/test.asset: -------------------------------------------------------------------------------- 1 | // sample file 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/in/test.asset: -------------------------------------------------------------------------------- 1 | // sample file 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkFile/file1: -------------------------------------------------------------------------------- 1 | // symlink file 1 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkParent/symlinkTarget/file1: -------------------------------------------------------------------------------- 1 | // symlink file 1 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkParent/symlinkTarget/file2: -------------------------------------------------------------------------------- 1 | // symlink file 2 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkParent/symlinkTarget/file3: -------------------------------------------------------------------------------- 1 | // symlink file 3 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkParent/symlinkTarget/file4: -------------------------------------------------------------------------------- 1 | // symlink file 4 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkRecursiveParent/file1: -------------------------------------------------------------------------------- 1 | // test file 1 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkRecursiveParent/symlinkTarget/file1: -------------------------------------------------------------------------------- 1 | // test file 1 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkRecursiveParent/symlinkTarget/symlinkTarget/file1: -------------------------------------------------------------------------------- 1 | // test file 1 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkRecursiveParent/symlinkTarget/symlinkTarget/symlinkTarget/file1: -------------------------------------------------------------------------------- 1 | // test file 1 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkRecursiveParent/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/file1: -------------------------------------------------------------------------------- 1 | // test file 1 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkRecursiveParent/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/file1: -------------------------------------------------------------------------------- 1 | // test file 1 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkRecursiveParent/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/file1: -------------------------------------------------------------------------------- 1 | // test file 1 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkRecursiveParent/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/file1: -------------------------------------------------------------------------------- 1 | // test file 1 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkRecursiveParent/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/file1: -------------------------------------------------------------------------------- 1 | // test file 1 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkRecursiveParent/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/symlinkTarget/file1: -------------------------------------------------------------------------------- 1 | // test file 1 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkSrc/file1: -------------------------------------------------------------------------------- 1 | // symlink file 1 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkSrc/file2: -------------------------------------------------------------------------------- 1 | // symlink file 2 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkSrc/file3: -------------------------------------------------------------------------------- 1 | // symlink file 3 2 | -------------------------------------------------------------------------------- /src/github.com/jteeuwen/go-bindata/testdata/symlinkSrc/file4: -------------------------------------------------------------------------------- 1 | // symlink file 4 2 | -------------------------------------------------------------------------------- /src/github.com/kardianos/osext/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 The 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 | -------------------------------------------------------------------------------- /src/github.com/kardianos/osext/README.md: -------------------------------------------------------------------------------- 1 | ### Extensions to the "os" package. 2 | 3 | [![GoDoc](https://godoc.org/github.com/kardianos/osext?status.svg)](https://godoc.org/github.com/kardianos/osext) 4 | 5 | ## Find the current Executable and ExecutableFolder. 6 | 7 | There is sometimes utility in finding the current executable file 8 | that is running. This can be used for upgrading the current executable 9 | or finding resources located relative to the executable file. Both 10 | working directory and the os.Args[0] value are arbitrary and cannot 11 | be relied on; os.Args[0] can be "faked". 12 | 13 | Multi-platform and supports: 14 | * Linux 15 | * OS X 16 | * Windows 17 | * Plan 9 18 | * BSDs. 19 | -------------------------------------------------------------------------------- /src/github.com/kardianos/osext/osext.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 | // Extensions to the standard "os" package. 6 | package osext // import "github.com/kardianos/osext" 7 | 8 | import "path/filepath" 9 | 10 | var cx, ce = executableClean() 11 | 12 | func executableClean() (string, error) { 13 | p, err := executable() 14 | return filepath.Clean(p), err 15 | } 16 | 17 | // Executable returns an absolute path that can be used to 18 | // re-invoke the current program. 19 | // It may not be valid after the current program exits. 20 | func Executable() (string, error) { 21 | return cx, ce 22 | } 23 | 24 | // Returns same path as Executable, returns just the folder 25 | // path. Excludes the executable name and any trailing slash. 26 | func ExecutableFolder() (string, error) { 27 | p, err := Executable() 28 | if err != nil { 29 | return "", err 30 | } 31 | 32 | return filepath.Dir(p), nil 33 | } 34 | -------------------------------------------------------------------------------- /src/github.com/kardianos/osext/osext_plan9.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 osext 6 | 7 | import ( 8 | "os" 9 | "strconv" 10 | "syscall" 11 | ) 12 | 13 | func executable() (string, error) { 14 | f, err := os.Open("/proc/" + strconv.Itoa(os.Getpid()) + "/text") 15 | if err != nil { 16 | return "", err 17 | } 18 | defer f.Close() 19 | return syscall.Fd2path(int(f.Fd())) 20 | } 21 | -------------------------------------------------------------------------------- /src/github.com/kardianos/osext/osext_procfs.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 | // +build linux netbsd solaris dragonfly 6 | 7 | package osext 8 | 9 | import ( 10 | "errors" 11 | "fmt" 12 | "os" 13 | "runtime" 14 | "strings" 15 | ) 16 | 17 | func executable() (string, error) { 18 | switch runtime.GOOS { 19 | case "linux": 20 | const deletedTag = " (deleted)" 21 | execpath, err := os.Readlink("/proc/self/exe") 22 | if err != nil { 23 | return execpath, err 24 | } 25 | execpath = strings.TrimSuffix(execpath, deletedTag) 26 | execpath = strings.TrimPrefix(execpath, deletedTag) 27 | return execpath, nil 28 | case "netbsd": 29 | return os.Readlink("/proc/curproc/exe") 30 | case "dragonfly": 31 | return os.Readlink("/proc/curproc/file") 32 | case "solaris": 33 | return os.Readlink(fmt.Sprintf("/proc/%d/path/a.out", os.Getpid())) 34 | } 35 | return "", errors.New("ExecPath not implemented for " + runtime.GOOS) 36 | } 37 | -------------------------------------------------------------------------------- /src/github.com/kardianos/osext/osext_windows.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 osext 6 | 7 | import ( 8 | "syscall" 9 | "unicode/utf16" 10 | "unsafe" 11 | ) 12 | 13 | var ( 14 | kernel = syscall.MustLoadDLL("kernel32.dll") 15 | getModuleFileNameProc = kernel.MustFindProc("GetModuleFileNameW") 16 | ) 17 | 18 | // GetModuleFileName() with hModule = NULL 19 | func executable() (exePath string, err error) { 20 | return getModuleFileName() 21 | } 22 | 23 | func getModuleFileName() (string, error) { 24 | var n uint32 25 | b := make([]uint16, syscall.MAX_PATH) 26 | size := uint32(len(b)) 27 | 28 | r0, _, e1 := getModuleFileNameProc.Call(0, uintptr(unsafe.Pointer(&b[0])), uintptr(size)) 29 | n = uint32(r0) 30 | if n == 0 { 31 | return "", e1 32 | } 33 | return string(utf16.Decode(b[0:n])), nil 34 | } 35 | -------------------------------------------------------------------------------- /src/github.com/kr/binarydist/License: -------------------------------------------------------------------------------- 1 | Copyright 2012 Keith Rarick 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /src/github.com/kr/binarydist/Readme.md: -------------------------------------------------------------------------------- 1 | # binarydist 2 | 3 | Package binarydist implements binary diff and patch as described on 4 | . It reads and writes files 5 | compatible with the tools there. 6 | 7 | Documentation at . 8 | -------------------------------------------------------------------------------- /src/github.com/kr/binarydist/bzip2.go: -------------------------------------------------------------------------------- 1 | package binarydist 2 | 3 | import ( 4 | "io" 5 | "os/exec" 6 | ) 7 | 8 | type bzip2Writer struct { 9 | c *exec.Cmd 10 | w io.WriteCloser 11 | } 12 | 13 | func (w bzip2Writer) Write(b []byte) (int, error) { 14 | return w.w.Write(b) 15 | } 16 | 17 | func (w bzip2Writer) Close() error { 18 | if err := w.w.Close(); err != nil { 19 | return err 20 | } 21 | return w.c.Wait() 22 | } 23 | 24 | // Package compress/bzip2 implements only decompression, 25 | // so we'll fake it by running bzip2 in another process. 26 | func newBzip2Writer(w io.Writer) (wc io.WriteCloser, err error) { 27 | var bw bzip2Writer 28 | bw.c = exec.Command("bzip2", "-c") 29 | bw.c.Stdout = w 30 | 31 | if bw.w, err = bw.c.StdinPipe(); err != nil { 32 | return nil, err 33 | } 34 | 35 | if err = bw.c.Start(); err != nil { 36 | return nil, err 37 | } 38 | 39 | return bw, nil 40 | } 41 | -------------------------------------------------------------------------------- /src/github.com/kr/binarydist/common_test.go: -------------------------------------------------------------------------------- 1 | package binarydist 2 | 3 | import ( 4 | "io" 5 | "io/ioutil" 6 | "math/rand" 7 | "os" 8 | ) 9 | 10 | func mustOpen(path string) *os.File { 11 | f, err := os.Open(path) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | return f 17 | } 18 | 19 | func mustReadAll(r io.Reader) []byte { 20 | b, err := ioutil.ReadAll(r) 21 | if err != nil { 22 | panic(err) 23 | } 24 | return b 25 | } 26 | 27 | func fileCmp(a, b *os.File) int64 { 28 | sa, err := a.Seek(0, 2) 29 | if err != nil { 30 | panic(err) 31 | } 32 | 33 | sb, err := b.Seek(0, 2) 34 | if err != nil { 35 | panic(err) 36 | } 37 | 38 | if sa != sb { 39 | return sa 40 | } 41 | 42 | _, err = a.Seek(0, 0) 43 | if err != nil { 44 | panic(err) 45 | } 46 | 47 | _, err = b.Seek(0, 0) 48 | if err != nil { 49 | panic(err) 50 | } 51 | 52 | pa, err := ioutil.ReadAll(a) 53 | if err != nil { 54 | panic(err) 55 | } 56 | 57 | pb, err := ioutil.ReadAll(b) 58 | if err != nil { 59 | panic(err) 60 | } 61 | 62 | for i := range pa { 63 | if pa[i] != pb[i] { 64 | return int64(i) 65 | } 66 | } 67 | return -1 68 | } 69 | 70 | func mustWriteRandFile(path string, size int, seed int64) *os.File { 71 | p := make([]byte, size) 72 | rand.Seed(seed) 73 | _, err := rand.Read(p) 74 | if err != nil { 75 | panic(err) 76 | } 77 | 78 | f, err := os.Create(path) 79 | if err != nil { 80 | panic(err) 81 | } 82 | 83 | _, err = f.Write(p) 84 | if err != nil { 85 | panic(err) 86 | } 87 | 88 | _, err = f.Seek(0, 0) 89 | if err != nil { 90 | panic(err) 91 | } 92 | 93 | return f 94 | } 95 | -------------------------------------------------------------------------------- /src/github.com/kr/binarydist/diff_test.go: -------------------------------------------------------------------------------- 1 | package binarydist 2 | 3 | import ( 4 | "bytes" 5 | "io/ioutil" 6 | "os" 7 | "os/exec" 8 | "testing" 9 | ) 10 | 11 | var diffT = []struct { 12 | old *os.File 13 | new *os.File 14 | }{ 15 | { 16 | old: mustWriteRandFile("test.old", 1e3, 1), 17 | new: mustWriteRandFile("test.new", 1e3, 2), 18 | }, 19 | { 20 | old: mustOpen("testdata/sample.old"), 21 | new: mustOpen("testdata/sample.new"), 22 | }, 23 | } 24 | 25 | func TestDiff(t *testing.T) { 26 | for _, s := range diffT { 27 | got, err := ioutil.TempFile("/tmp", "bspatch.") 28 | if err != nil { 29 | panic(err) 30 | } 31 | os.Remove(got.Name()) 32 | 33 | exp, err := ioutil.TempFile("/tmp", "bspatch.") 34 | if err != nil { 35 | panic(err) 36 | } 37 | 38 | cmd := exec.Command("bsdiff", s.old.Name(), s.new.Name(), exp.Name()) 39 | cmd.Stdout = os.Stdout 40 | err = cmd.Run() 41 | os.Remove(exp.Name()) 42 | if err != nil { 43 | panic(err) 44 | } 45 | 46 | err = Diff(s.old, s.new, got) 47 | if err != nil { 48 | t.Fatal("err", err) 49 | } 50 | 51 | _, err = got.Seek(0, 0) 52 | if err != nil { 53 | panic(err) 54 | } 55 | gotBuf := mustReadAll(got) 56 | expBuf := mustReadAll(exp) 57 | 58 | if !bytes.Equal(gotBuf, expBuf) { 59 | t.Fail() 60 | t.Logf("diff %s %s", s.old.Name(), s.new.Name()) 61 | t.Logf("%s: len(got) = %d", got.Name(), len(gotBuf)) 62 | t.Logf("%s: len(exp) = %d", exp.Name(), len(expBuf)) 63 | i := matchlen(gotBuf, expBuf) 64 | t.Logf("produced different output at pos %d; %d != %d", i, gotBuf[i], expBuf[i]) 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/github.com/kr/binarydist/doc.go: -------------------------------------------------------------------------------- 1 | // Package binarydist implements binary diff and patch as described on 2 | // http://www.daemonology.net/bsdiff/. It reads and writes files 3 | // compatible with the tools there. 4 | package binarydist 5 | 6 | var magic = [8]byte{'B', 'S', 'D', 'I', 'F', 'F', '4', '0'} 7 | 8 | // File format: 9 | // 0 8 "BSDIFF40" 10 | // 8 8 X 11 | // 16 8 Y 12 | // 24 8 sizeof(newfile) 13 | // 32 X bzip2(control block) 14 | // 32+X Y bzip2(diff block) 15 | // 32+X+Y ??? bzip2(extra block) 16 | // with control block a set of triples (x,y,z) meaning "add x bytes 17 | // from oldfile to x bytes from the diff block; copy y bytes from the 18 | // extra block; seek forwards in oldfile by z bytes". 19 | type header struct { 20 | Magic [8]byte 21 | CtrlLen int64 22 | DiffLen int64 23 | NewSize int64 24 | } 25 | -------------------------------------------------------------------------------- /src/github.com/kr/binarydist/encoding.go: -------------------------------------------------------------------------------- 1 | package binarydist 2 | 3 | // SignMagLittleEndian is the numeric encoding used by the bsdiff tools. 4 | // It implements binary.ByteOrder using a sign-magnitude format 5 | // and little-endian byte order. Only methods Uint64 and String 6 | // have been written; the rest panic. 7 | type signMagLittleEndian struct{} 8 | 9 | func (signMagLittleEndian) Uint16(b []byte) uint16 { panic("unimplemented") } 10 | 11 | func (signMagLittleEndian) PutUint16(b []byte, v uint16) { panic("unimplemented") } 12 | 13 | func (signMagLittleEndian) Uint32(b []byte) uint32 { panic("unimplemented") } 14 | 15 | func (signMagLittleEndian) PutUint32(b []byte, v uint32) { panic("unimplemented") } 16 | 17 | func (signMagLittleEndian) Uint64(b []byte) uint64 { 18 | y := int64(b[0]) | 19 | int64(b[1])<<8 | 20 | int64(b[2])<<16 | 21 | int64(b[3])<<24 | 22 | int64(b[4])<<32 | 23 | int64(b[5])<<40 | 24 | int64(b[6])<<48 | 25 | int64(b[7]&0x7f)<<56 26 | 27 | if b[7]&0x80 != 0 { 28 | y = -y 29 | } 30 | return uint64(y) 31 | } 32 | 33 | func (signMagLittleEndian) PutUint64(b []byte, v uint64) { 34 | x := int64(v) 35 | neg := x < 0 36 | if neg { 37 | x = -x 38 | } 39 | 40 | b[0] = byte(x) 41 | b[1] = byte(x >> 8) 42 | b[2] = byte(x >> 16) 43 | b[3] = byte(x >> 24) 44 | b[4] = byte(x >> 32) 45 | b[5] = byte(x >> 40) 46 | b[6] = byte(x >> 48) 47 | b[7] = byte(x >> 56) 48 | if neg { 49 | b[7] |= 0x80 50 | } 51 | } 52 | 53 | func (signMagLittleEndian) String() string { return "signMagLittleEndian" } 54 | -------------------------------------------------------------------------------- /src/github.com/kr/binarydist/patch_test.go: -------------------------------------------------------------------------------- 1 | package binarydist 2 | 3 | import ( 4 | "io/ioutil" 5 | "os" 6 | "os/exec" 7 | "testing" 8 | ) 9 | 10 | func TestPatch(t *testing.T) { 11 | mustWriteRandFile("test.old", 1e3, 1) 12 | mustWriteRandFile("test.new", 1e3, 2) 13 | 14 | got, err := ioutil.TempFile("/tmp", "bspatch.") 15 | if err != nil { 16 | panic(err) 17 | } 18 | os.Remove(got.Name()) 19 | 20 | err = exec.Command("bsdiff", "test.old", "test.new", "test.patch").Run() 21 | if err != nil { 22 | panic(err) 23 | } 24 | 25 | err = Patch(mustOpen("test.old"), got, mustOpen("test.patch")) 26 | if err != nil { 27 | t.Fatal("err", err) 28 | } 29 | 30 | ref, err := got.Seek(0, 2) 31 | if err != nil { 32 | panic(err) 33 | } 34 | 35 | t.Logf("got %d bytes", ref) 36 | if n := fileCmp(got, mustOpen("test.new")); n > -1 { 37 | t.Fatalf("produced different output at pos %d", n) 38 | } 39 | } 40 | 41 | func TestPatchHk(t *testing.T) { 42 | got, err := ioutil.TempFile("/tmp", "bspatch.") 43 | if err != nil { 44 | panic(err) 45 | } 46 | os.Remove(got.Name()) 47 | 48 | err = Patch(mustOpen("testdata/sample.old"), got, mustOpen("testdata/sample.patch")) 49 | if err != nil { 50 | t.Fatal("err", err) 51 | } 52 | 53 | ref, err := got.Seek(0, 2) 54 | if err != nil { 55 | panic(err) 56 | } 57 | 58 | t.Logf("got %d bytes", ref) 59 | if n := fileCmp(got, mustOpen("testdata/sample.new")); n > -1 { 60 | t.Fatalf("produced different output at pos %d", n) 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/github.com/kr/binarydist/seek.go: -------------------------------------------------------------------------------- 1 | package binarydist 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | type seekBuffer struct { 8 | buf []byte 9 | pos int 10 | } 11 | 12 | func (b *seekBuffer) Write(p []byte) (n int, err error) { 13 | n = copy(b.buf[b.pos:], p) 14 | if n == len(p) { 15 | b.pos += n 16 | return n, nil 17 | } 18 | b.buf = append(b.buf, p[n:]...) 19 | b.pos += len(p) 20 | return len(p), nil 21 | } 22 | 23 | func (b *seekBuffer) Seek(offset int64, whence int) (ret int64, err error) { 24 | var abs int64 25 | switch whence { 26 | case 0: 27 | abs = offset 28 | case 1: 29 | abs = int64(b.pos) + offset 30 | case 2: 31 | abs = int64(len(b.buf)) + offset 32 | default: 33 | return 0, errors.New("binarydist: invalid whence") 34 | } 35 | if abs < 0 { 36 | return 0, errors.New("binarydist: negative position") 37 | } 38 | if abs >= 1<<31 { 39 | return 0, errors.New("binarydist: position out of range") 40 | } 41 | b.pos = int(abs) 42 | return abs, nil 43 | } 44 | -------------------------------------------------------------------------------- /src/github.com/kr/binarydist/sort_test.go: -------------------------------------------------------------------------------- 1 | package binarydist 2 | 3 | import ( 4 | "bytes" 5 | "crypto/rand" 6 | "testing" 7 | ) 8 | 9 | var sortT = [][]byte{ 10 | mustRandBytes(1000), 11 | mustReadAll(mustOpen("test.old")), 12 | []byte("abcdefabcdef"), 13 | } 14 | 15 | func TestQsufsort(t *testing.T) { 16 | for _, s := range sortT { 17 | I := qsufsort(s) 18 | for i := 1; i < len(I); i++ { 19 | if bytes.Compare(s[I[i-1]:], s[I[i]:]) > 0 { 20 | t.Fatalf("unsorted at %d", i) 21 | } 22 | } 23 | } 24 | } 25 | 26 | func mustRandBytes(n int) []byte { 27 | b := make([]byte, n) 28 | _, err := rand.Read(b) 29 | if err != nil { 30 | panic(err) 31 | } 32 | return b 33 | } 34 | -------------------------------------------------------------------------------- /src/github.com/kr/binarydist/testdata/sample.new: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/src/github.com/kr/binarydist/testdata/sample.new -------------------------------------------------------------------------------- /src/github.com/kr/binarydist/testdata/sample.old: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/src/github.com/kr/binarydist/testdata/sample.old -------------------------------------------------------------------------------- /src/github.com/kr/binarydist/testdata/sample.patch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nwct/ngrok/69e4e65ec2e7f9d4a89a17d426715483afc4f2c2/src/github.com/kr/binarydist/testdata/sample.patch -------------------------------------------------------------------------------- /src/github.com/mattn/go-runewidth/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Yasuhiro Matsumoto 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. 22 | -------------------------------------------------------------------------------- /src/github.com/mattn/go-runewidth/README.mkd: -------------------------------------------------------------------------------- 1 | go-runewidth 2 | ============ 3 | 4 | [![Build Status](https://travis-ci.org/mattn/go-runewidth.png?branch=master)](https://travis-ci.org/mattn/go-runewidth) 5 | [![Coverage Status](https://coveralls.io/repos/mattn/go-runewidth/badge.png?branch=HEAD)](https://coveralls.io/r/mattn/go-runewidth?branch=HEAD) 6 | [![GoDoc](https://godoc.org/github.com/mattn/go-runewidth?status.svg)](http://godoc.org/github.com/mattn/go-runewidth) 7 | [![Go Report Card](https://goreportcard.com/badge/github.com/mattn/go-runewidth)](https://goreportcard.com/report/github.com/mattn/go-runewidth) 8 | 9 | Provides functions to get fixed width of the character or string. 10 | 11 | Usage 12 | ----- 13 | 14 | ```go 15 | runewidth.StringWidth("つのだ☆HIRO") == 12 16 | ``` 17 | 18 | 19 | Author 20 | ------ 21 | 22 | Yasuhiro Matsumoto 23 | 24 | License 25 | ------- 26 | 27 | under the MIT License: http://mattn.mit-license.org/2013 28 | -------------------------------------------------------------------------------- /src/github.com/mattn/go-runewidth/runewidth_js.go: -------------------------------------------------------------------------------- 1 | // +build js 2 | 3 | package runewidth 4 | 5 | func IsEastAsian() bool { 6 | // TODO: Implement this for the web. Detect east asian in a compatible way, and return true. 7 | return false 8 | } 9 | -------------------------------------------------------------------------------- /src/github.com/mattn/go-runewidth/runewidth_posix.go: -------------------------------------------------------------------------------- 1 | // +build !windows,!js 2 | 3 | package runewidth 4 | 5 | import ( 6 | "os" 7 | "regexp" 8 | "strings" 9 | ) 10 | 11 | var reLoc = regexp.MustCompile(`^[a-z][a-z][a-z]?(?:_[A-Z][A-Z])?\.(.+)`) 12 | 13 | var mblenTable = map[string]int{ 14 | "utf-8": 6, 15 | "utf8": 6, 16 | "jis": 8, 17 | "eucjp": 3, 18 | "euckr": 2, 19 | "euccn": 2, 20 | "sjis": 2, 21 | "cp932": 2, 22 | "cp51932": 2, 23 | "cp936": 2, 24 | "cp949": 2, 25 | "cp950": 2, 26 | "big5": 2, 27 | "gbk": 2, 28 | "gb2312": 2, 29 | } 30 | 31 | func isEastAsian(locale string) bool { 32 | charset := strings.ToLower(locale) 33 | r := reLoc.FindStringSubmatch(locale) 34 | if len(r) == 2 { 35 | charset = strings.ToLower(r[1]) 36 | } 37 | 38 | if strings.HasSuffix(charset, "@cjk_narrow") { 39 | return false 40 | } 41 | 42 | for pos, b := range []byte(charset) { 43 | if b == '@' { 44 | charset = charset[:pos] 45 | break 46 | } 47 | } 48 | max := 1 49 | if m, ok := mblenTable[charset]; ok { 50 | max = m 51 | } 52 | if max > 1 && (charset[0] != 'u' || 53 | strings.HasPrefix(locale, "ja") || 54 | strings.HasPrefix(locale, "ko") || 55 | strings.HasPrefix(locale, "zh")) { 56 | return true 57 | } 58 | return false 59 | } 60 | 61 | // IsEastAsian return true if the current locale is CJK 62 | func IsEastAsian() bool { 63 | locale := os.Getenv("LC_CTYPE") 64 | if locale == "" { 65 | locale = os.Getenv("LANG") 66 | } 67 | 68 | // ignore C locale 69 | if locale == "POSIX" || locale == "C" { 70 | return false 71 | } 72 | if len(locale) > 1 && locale[0] == 'C' && (locale[1] == '.' || locale[1] == '-') { 73 | return false 74 | } 75 | 76 | return isEastAsian(locale) 77 | } 78 | -------------------------------------------------------------------------------- /src/github.com/mattn/go-runewidth/runewidth_windows.go: -------------------------------------------------------------------------------- 1 | package runewidth 2 | 3 | import ( 4 | "syscall" 5 | ) 6 | 7 | var ( 8 | kernel32 = syscall.NewLazyDLL("kernel32") 9 | procGetConsoleOutputCP = kernel32.NewProc("GetConsoleOutputCP") 10 | ) 11 | 12 | // IsEastAsian return true if the current locale is CJK 13 | func IsEastAsian() bool { 14 | r1, _, _ := procGetConsoleOutputCP.Call() 15 | if r1 == 0 { 16 | return false 17 | } 18 | 19 | switch int(r1) { 20 | case 932, 51932, 936, 949, 950: 21 | return true 22 | } 23 | 24 | return false 25 | } 26 | -------------------------------------------------------------------------------- /src/github.com/nsf/termbox-go/AUTHORS: -------------------------------------------------------------------------------- 1 | # Please keep this file sorted. 2 | 3 | Georg Reinke 4 | nsf 5 | -------------------------------------------------------------------------------- /src/github.com/nsf/termbox-go/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 termbox-go authors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /src/github.com/nsf/termbox-go/_demos/interrupt.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/nsf/termbox-go" 6 | "time" 7 | ) 8 | 9 | func tbPrint(x, y int, fg, bg termbox.Attribute, msg string) { 10 | for _, c := range msg { 11 | termbox.SetCell(x, y, c, fg, bg) 12 | x++ 13 | } 14 | } 15 | 16 | func draw(i int) { 17 | termbox.Clear(termbox.ColorDefault, termbox.ColorDefault) 18 | defer termbox.Flush() 19 | 20 | w, h := termbox.Size() 21 | s := fmt.Sprintf("count = %d", i) 22 | 23 | tbPrint((w/2)-(len(s)/2), h/2, termbox.ColorRed, termbox.ColorDefault, s) 24 | } 25 | 26 | func main() { 27 | err := termbox.Init() 28 | if err != nil { 29 | panic(err) 30 | } 31 | termbox.SetInputMode(termbox.InputEsc) 32 | 33 | go func() { 34 | time.Sleep(5 * time.Second) 35 | termbox.Interrupt() 36 | 37 | // This should never run - the Interrupt(), above, should cause the event 38 | // loop below to exit, which then exits the process. If something goes 39 | // wrong, this panic will trigger and show what happened. 40 | time.Sleep(1 * time.Second) 41 | panic("this should never run") 42 | }() 43 | 44 | var count int 45 | 46 | draw(count) 47 | mainloop: 48 | for { 49 | switch ev := termbox.PollEvent(); ev.Type { 50 | case termbox.EventKey: 51 | if ev.Ch == '+' { 52 | count++ 53 | } else if ev.Ch == '-' { 54 | count-- 55 | } 56 | 57 | case termbox.EventError: 58 | panic(ev.Err) 59 | 60 | case termbox.EventInterrupt: 61 | break mainloop 62 | } 63 | 64 | draw(count) 65 | } 66 | termbox.Close() 67 | 68 | fmt.Println("Finished") 69 | } 70 | -------------------------------------------------------------------------------- /src/github.com/nsf/termbox-go/_demos/random_output.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/nsf/termbox-go" 4 | import "math/rand" 5 | import "time" 6 | 7 | func draw() { 8 | w, h := termbox.Size() 9 | termbox.Clear(termbox.ColorDefault, termbox.ColorDefault) 10 | for y := 0; y < h; y++ { 11 | for x := 0; x < w; x++ { 12 | termbox.SetCell(x, y, ' ', termbox.ColorDefault, 13 | termbox.Attribute(rand.Int()%8)+1) 14 | } 15 | } 16 | termbox.Flush() 17 | } 18 | 19 | func main() { 20 | err := termbox.Init() 21 | if err != nil { 22 | panic(err) 23 | } 24 | defer termbox.Close() 25 | 26 | event_queue := make(chan termbox.Event) 27 | go func() { 28 | for { 29 | event_queue <- termbox.PollEvent() 30 | } 31 | }() 32 | 33 | draw() 34 | loop: 35 | for { 36 | select { 37 | case ev := <-event_queue: 38 | if ev.Type == termbox.EventKey && ev.Key == termbox.KeyEsc { 39 | break loop 40 | } 41 | default: 42 | draw() 43 | time.Sleep(10 * time.Millisecond) 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/github.com/nsf/termbox-go/syscalls.go: -------------------------------------------------------------------------------- 1 | // +build ignore 2 | 3 | package termbox 4 | 5 | /* 6 | #include 7 | #include 8 | */ 9 | import "C" 10 | 11 | type syscall_Termios C.struct_termios 12 | 13 | const ( 14 | syscall_IGNBRK = C.IGNBRK 15 | syscall_BRKINT = C.BRKINT 16 | syscall_PARMRK = C.PARMRK 17 | syscall_ISTRIP = C.ISTRIP 18 | syscall_INLCR = C.INLCR 19 | syscall_IGNCR = C.IGNCR 20 | syscall_ICRNL = C.ICRNL 21 | syscall_IXON = C.IXON 22 | syscall_OPOST = C.OPOST 23 | syscall_ECHO = C.ECHO 24 | syscall_ECHONL = C.ECHONL 25 | syscall_ICANON = C.ICANON 26 | syscall_ISIG = C.ISIG 27 | syscall_IEXTEN = C.IEXTEN 28 | syscall_CSIZE = C.CSIZE 29 | syscall_PARENB = C.PARENB 30 | syscall_CS8 = C.CS8 31 | syscall_VMIN = C.VMIN 32 | syscall_VTIME = C.VTIME 33 | 34 | // on darwin change these to (on *bsd too?): 35 | // C.TIOCGETA 36 | // C.TIOCSETA 37 | syscall_TCGETS = C.TCGETS 38 | syscall_TCSETS = C.TCSETS 39 | ) 40 | -------------------------------------------------------------------------------- /src/github.com/nsf/termbox-go/syscalls_darwin.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs syscalls.go 3 | 4 | // +build !amd64 5 | 6 | package termbox 7 | 8 | type syscall_Termios struct { 9 | Iflag uint32 10 | Oflag uint32 11 | Cflag uint32 12 | Lflag uint32 13 | Cc [20]uint8 14 | Ispeed uint32 15 | Ospeed uint32 16 | } 17 | 18 | const ( 19 | syscall_IGNBRK = 0x1 20 | syscall_BRKINT = 0x2 21 | syscall_PARMRK = 0x8 22 | syscall_ISTRIP = 0x20 23 | syscall_INLCR = 0x40 24 | syscall_IGNCR = 0x80 25 | syscall_ICRNL = 0x100 26 | syscall_IXON = 0x200 27 | syscall_OPOST = 0x1 28 | syscall_ECHO = 0x8 29 | syscall_ECHONL = 0x10 30 | syscall_ICANON = 0x100 31 | syscall_ISIG = 0x80 32 | syscall_IEXTEN = 0x400 33 | syscall_CSIZE = 0x300 34 | syscall_PARENB = 0x1000 35 | syscall_CS8 = 0x300 36 | syscall_VMIN = 0x10 37 | syscall_VTIME = 0x11 38 | 39 | syscall_TCGETS = 0x402c7413 40 | syscall_TCSETS = 0x802c7414 41 | ) 42 | -------------------------------------------------------------------------------- /src/github.com/nsf/termbox-go/syscalls_darwin_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs syscalls.go 3 | 4 | package termbox 5 | 6 | type syscall_Termios struct { 7 | Iflag uint64 8 | Oflag uint64 9 | Cflag uint64 10 | Lflag uint64 11 | Cc [20]uint8 12 | Pad_cgo_0 [4]byte 13 | Ispeed uint64 14 | Ospeed uint64 15 | } 16 | 17 | const ( 18 | syscall_IGNBRK = 0x1 19 | syscall_BRKINT = 0x2 20 | syscall_PARMRK = 0x8 21 | syscall_ISTRIP = 0x20 22 | syscall_INLCR = 0x40 23 | syscall_IGNCR = 0x80 24 | syscall_ICRNL = 0x100 25 | syscall_IXON = 0x200 26 | syscall_OPOST = 0x1 27 | syscall_ECHO = 0x8 28 | syscall_ECHONL = 0x10 29 | syscall_ICANON = 0x100 30 | syscall_ISIG = 0x80 31 | syscall_IEXTEN = 0x400 32 | syscall_CSIZE = 0x300 33 | syscall_PARENB = 0x1000 34 | syscall_CS8 = 0x300 35 | syscall_VMIN = 0x10 36 | syscall_VTIME = 0x11 37 | 38 | syscall_TCGETS = 0x40487413 39 | syscall_TCSETS = 0x80487414 40 | ) 41 | -------------------------------------------------------------------------------- /src/github.com/nsf/termbox-go/syscalls_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs syscalls.go 3 | 4 | package termbox 5 | 6 | type syscall_Termios struct { 7 | Iflag uint32 8 | Oflag uint32 9 | Cflag uint32 10 | Lflag uint32 11 | Cc [20]uint8 12 | Ispeed uint32 13 | Ospeed uint32 14 | } 15 | 16 | const ( 17 | syscall_IGNBRK = 0x1 18 | syscall_BRKINT = 0x2 19 | syscall_PARMRK = 0x8 20 | syscall_ISTRIP = 0x20 21 | syscall_INLCR = 0x40 22 | syscall_IGNCR = 0x80 23 | syscall_ICRNL = 0x100 24 | syscall_IXON = 0x200 25 | syscall_OPOST = 0x1 26 | syscall_ECHO = 0x8 27 | syscall_ECHONL = 0x10 28 | syscall_ICANON = 0x100 29 | syscall_ISIG = 0x80 30 | syscall_IEXTEN = 0x400 31 | syscall_CSIZE = 0x300 32 | syscall_PARENB = 0x1000 33 | syscall_CS8 = 0x300 34 | syscall_VMIN = 0x10 35 | syscall_VTIME = 0x11 36 | 37 | syscall_TCGETS = 0x402c7413 38 | syscall_TCSETS = 0x802c7414 39 | ) 40 | -------------------------------------------------------------------------------- /src/github.com/nsf/termbox-go/syscalls_freebsd.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs syscalls.go 3 | 4 | package termbox 5 | 6 | type syscall_Termios struct { 7 | Iflag uint32 8 | Oflag uint32 9 | Cflag uint32 10 | Lflag uint32 11 | Cc [20]uint8 12 | Ispeed uint32 13 | Ospeed uint32 14 | } 15 | 16 | const ( 17 | syscall_IGNBRK = 0x1 18 | syscall_BRKINT = 0x2 19 | syscall_PARMRK = 0x8 20 | syscall_ISTRIP = 0x20 21 | syscall_INLCR = 0x40 22 | syscall_IGNCR = 0x80 23 | syscall_ICRNL = 0x100 24 | syscall_IXON = 0x200 25 | syscall_OPOST = 0x1 26 | syscall_ECHO = 0x8 27 | syscall_ECHONL = 0x10 28 | syscall_ICANON = 0x100 29 | syscall_ISIG = 0x80 30 | syscall_IEXTEN = 0x400 31 | syscall_CSIZE = 0x300 32 | syscall_PARENB = 0x1000 33 | syscall_CS8 = 0x300 34 | syscall_VMIN = 0x10 35 | syscall_VTIME = 0x11 36 | 37 | syscall_TCGETS = 0x402c7413 38 | syscall_TCSETS = 0x802c7414 39 | ) 40 | -------------------------------------------------------------------------------- /src/github.com/nsf/termbox-go/syscalls_linux.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs syscalls.go 3 | 4 | package termbox 5 | 6 | import "syscall" 7 | 8 | type syscall_Termios syscall.Termios 9 | 10 | const ( 11 | syscall_IGNBRK = syscall.IGNBRK 12 | syscall_BRKINT = syscall.BRKINT 13 | syscall_PARMRK = syscall.PARMRK 14 | syscall_ISTRIP = syscall.ISTRIP 15 | syscall_INLCR = syscall.INLCR 16 | syscall_IGNCR = syscall.IGNCR 17 | syscall_ICRNL = syscall.ICRNL 18 | syscall_IXON = syscall.IXON 19 | syscall_OPOST = syscall.OPOST 20 | syscall_ECHO = syscall.ECHO 21 | syscall_ECHONL = syscall.ECHONL 22 | syscall_ICANON = syscall.ICANON 23 | syscall_ISIG = syscall.ISIG 24 | syscall_IEXTEN = syscall.IEXTEN 25 | syscall_CSIZE = syscall.CSIZE 26 | syscall_PARENB = syscall.PARENB 27 | syscall_CS8 = syscall.CS8 28 | syscall_VMIN = syscall.VMIN 29 | syscall_VTIME = syscall.VTIME 30 | 31 | syscall_TCGETS = syscall.TCGETS 32 | syscall_TCSETS = syscall.TCSETS 33 | ) 34 | -------------------------------------------------------------------------------- /src/github.com/nsf/termbox-go/syscalls_netbsd.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs syscalls.go 3 | 4 | package termbox 5 | 6 | type syscall_Termios struct { 7 | Iflag uint32 8 | Oflag uint32 9 | Cflag uint32 10 | Lflag uint32 11 | Cc [20]uint8 12 | Ispeed int32 13 | Ospeed int32 14 | } 15 | 16 | const ( 17 | syscall_IGNBRK = 0x1 18 | syscall_BRKINT = 0x2 19 | syscall_PARMRK = 0x8 20 | syscall_ISTRIP = 0x20 21 | syscall_INLCR = 0x40 22 | syscall_IGNCR = 0x80 23 | syscall_ICRNL = 0x100 24 | syscall_IXON = 0x200 25 | syscall_OPOST = 0x1 26 | syscall_ECHO = 0x8 27 | syscall_ECHONL = 0x10 28 | syscall_ICANON = 0x100 29 | syscall_ISIG = 0x80 30 | syscall_IEXTEN = 0x400 31 | syscall_CSIZE = 0x300 32 | syscall_PARENB = 0x1000 33 | syscall_CS8 = 0x300 34 | syscall_VMIN = 0x10 35 | syscall_VTIME = 0x11 36 | 37 | syscall_TCGETS = 0x402c7413 38 | syscall_TCSETS = 0x802c7414 39 | ) 40 | -------------------------------------------------------------------------------- /src/github.com/nsf/termbox-go/syscalls_openbsd.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs syscalls.go 3 | 4 | package termbox 5 | 6 | type syscall_Termios struct { 7 | Iflag uint32 8 | Oflag uint32 9 | Cflag uint32 10 | Lflag uint32 11 | Cc [20]uint8 12 | Ispeed int32 13 | Ospeed int32 14 | } 15 | 16 | const ( 17 | syscall_IGNBRK = 0x1 18 | syscall_BRKINT = 0x2 19 | syscall_PARMRK = 0x8 20 | syscall_ISTRIP = 0x20 21 | syscall_INLCR = 0x40 22 | syscall_IGNCR = 0x80 23 | syscall_ICRNL = 0x100 24 | syscall_IXON = 0x200 25 | syscall_OPOST = 0x1 26 | syscall_ECHO = 0x8 27 | syscall_ECHONL = 0x10 28 | syscall_ICANON = 0x100 29 | syscall_ISIG = 0x80 30 | syscall_IEXTEN = 0x400 31 | syscall_CSIZE = 0x300 32 | syscall_PARENB = 0x1000 33 | syscall_CS8 = 0x300 34 | syscall_VMIN = 0x10 35 | syscall_VTIME = 0x11 36 | 37 | syscall_TCGETS = 0x402c7413 38 | syscall_TCSETS = 0x802c7414 39 | ) 40 | -------------------------------------------------------------------------------- /src/github.com/nsf/termbox-go/syscalls_windows.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs -- -DUNICODE syscalls.go 3 | 4 | package termbox 5 | 6 | const ( 7 | foreground_blue = 0x1 8 | foreground_green = 0x2 9 | foreground_red = 0x4 10 | foreground_intensity = 0x8 11 | background_blue = 0x10 12 | background_green = 0x20 13 | background_red = 0x40 14 | background_intensity = 0x80 15 | std_input_handle = -0xa 16 | std_output_handle = -0xb 17 | key_event = 0x1 18 | mouse_event = 0x2 19 | window_buffer_size_event = 0x4 20 | enable_window_input = 0x8 21 | enable_mouse_input = 0x10 22 | enable_extended_flags = 0x80 23 | 24 | vk_f1 = 0x70 25 | vk_f2 = 0x71 26 | vk_f3 = 0x72 27 | vk_f4 = 0x73 28 | vk_f5 = 0x74 29 | vk_f6 = 0x75 30 | vk_f7 = 0x76 31 | vk_f8 = 0x77 32 | vk_f9 = 0x78 33 | vk_f10 = 0x79 34 | vk_f11 = 0x7a 35 | vk_f12 = 0x7b 36 | vk_insert = 0x2d 37 | vk_delete = 0x2e 38 | vk_home = 0x24 39 | vk_end = 0x23 40 | vk_pgup = 0x21 41 | vk_pgdn = 0x22 42 | vk_arrow_up = 0x26 43 | vk_arrow_down = 0x28 44 | vk_arrow_left = 0x25 45 | vk_arrow_right = 0x27 46 | vk_backspace = 0x8 47 | vk_tab = 0x9 48 | vk_enter = 0xd 49 | vk_esc = 0x1b 50 | vk_space = 0x20 51 | 52 | left_alt_pressed = 0x2 53 | left_ctrl_pressed = 0x8 54 | right_alt_pressed = 0x1 55 | right_ctrl_pressed = 0x4 56 | shift_pressed = 0x10 57 | 58 | generic_read = 0x80000000 59 | generic_write = 0x40000000 60 | console_textmode_buffer = 0x1 61 | ) 62 | -------------------------------------------------------------------------------- /src/github.com/nsf/termbox-go/termbox_common.go: -------------------------------------------------------------------------------- 1 | package termbox 2 | 3 | // private API, common OS agnostic part 4 | 5 | type cellbuf struct { 6 | width int 7 | height int 8 | cells []Cell 9 | } 10 | 11 | func (this *cellbuf) init(width, height int) { 12 | this.width = width 13 | this.height = height 14 | this.cells = make([]Cell, width*height) 15 | } 16 | 17 | func (this *cellbuf) resize(width, height int) { 18 | if this.width == width && this.height == height { 19 | return 20 | } 21 | 22 | oldw := this.width 23 | oldh := this.height 24 | oldcells := this.cells 25 | 26 | this.init(width, height) 27 | this.clear() 28 | 29 | minw, minh := oldw, oldh 30 | 31 | if width < minw { 32 | minw = width 33 | } 34 | if height < minh { 35 | minh = height 36 | } 37 | 38 | for i := 0; i < minh; i++ { 39 | srco, dsto := i*oldw, i*width 40 | src := oldcells[srco : srco+minw] 41 | dst := this.cells[dsto : dsto+minw] 42 | copy(dst, src) 43 | } 44 | } 45 | 46 | func (this *cellbuf) clear() { 47 | for i := range this.cells { 48 | c := &this.cells[i] 49 | c.Ch = ' ' 50 | c.Fg = foreground 51 | c.Bg = background 52 | } 53 | } 54 | 55 | const cursor_hidden = -1 56 | 57 | func is_cursor_hidden(x, y int) bool { 58 | return x == cursor_hidden || y == cursor_hidden 59 | } 60 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2012 Richard Crowley. 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 | 1. Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following 12 | disclaimer in the documentation and/or other materials provided 13 | with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY RICHARD CROWLEY ``AS IS'' AND ANY EXPRESS 16 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL RICHARD CROWLEY OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | The views and conclusions contained in the software and documentation 28 | are those of the authors and should not be interpreted as representing 29 | official policies, either expressed or implied, of Richard Crowley. 30 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/cmd/metrics-bench/metrics-bench.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/rcrowley/go-metrics" 6 | "time" 7 | ) 8 | 9 | func main() { 10 | r := metrics.NewRegistry() 11 | for i := 0; i < 10000; i++ { 12 | r.Register(fmt.Sprintf("counter-%d", i), metrics.NewCounter()) 13 | r.Register(fmt.Sprintf("gauge-%d", i), metrics.NewGauge()) 14 | r.Register(fmt.Sprintf("gaugefloat64-%d", i), metrics.NewGaugeFloat64()) 15 | r.Register(fmt.Sprintf("histogram-uniform-%d", i), metrics.NewHistogram(metrics.NewUniformSample(1028))) 16 | r.Register(fmt.Sprintf("histogram-exp-%d", i), metrics.NewHistogram(metrics.NewExpDecaySample(1028, 0.015))) 17 | r.Register(fmt.Sprintf("meter-%d", i), metrics.NewMeter()) 18 | } 19 | time.Sleep(600e9) 20 | } 21 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/cmd/never-read/never-read.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | "net" 6 | ) 7 | 8 | func main() { 9 | addr, _ := net.ResolveTCPAddr("tcp", "127.0.0.1:2003") 10 | l, err := net.ListenTCP("tcp", addr) 11 | if nil != err { 12 | log.Fatalln(err) 13 | } 14 | log.Println("listening", l.Addr()) 15 | for { 16 | c, err := l.AcceptTCP() 17 | if nil != err { 18 | log.Fatalln(err) 19 | } 20 | log.Println("accepted", c.RemoteAddr()) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/counter_test.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import "testing" 4 | 5 | func BenchmarkCounter(b *testing.B) { 6 | c := NewCounter() 7 | b.ResetTimer() 8 | for i := 0; i < b.N; i++ { 9 | c.Inc(1) 10 | } 11 | } 12 | 13 | func TestCounterClear(t *testing.T) { 14 | c := NewCounter() 15 | c.Inc(1) 16 | c.Clear() 17 | if count := c.Count(); 0 != count { 18 | t.Errorf("c.Count(): 0 != %v\n", count) 19 | } 20 | } 21 | 22 | func TestCounterDec1(t *testing.T) { 23 | c := NewCounter() 24 | c.Dec(1) 25 | if count := c.Count(); -1 != count { 26 | t.Errorf("c.Count(): -1 != %v\n", count) 27 | } 28 | } 29 | 30 | func TestCounterDec2(t *testing.T) { 31 | c := NewCounter() 32 | c.Dec(2) 33 | if count := c.Count(); -2 != count { 34 | t.Errorf("c.Count(): -2 != %v\n", count) 35 | } 36 | } 37 | 38 | func TestCounterInc1(t *testing.T) { 39 | c := NewCounter() 40 | c.Inc(1) 41 | if count := c.Count(); 1 != count { 42 | t.Errorf("c.Count(): 1 != %v\n", count) 43 | } 44 | } 45 | 46 | func TestCounterInc2(t *testing.T) { 47 | c := NewCounter() 48 | c.Inc(2) 49 | if count := c.Count(); 2 != count { 50 | t.Errorf("c.Count(): 2 != %v\n", count) 51 | } 52 | } 53 | 54 | func TestCounterSnapshot(t *testing.T) { 55 | c := NewCounter() 56 | c.Inc(1) 57 | snapshot := c.Snapshot() 58 | c.Inc(1) 59 | if count := snapshot.Count(); 1 != count { 60 | t.Errorf("c.Count(): 1 != %v\n", count) 61 | } 62 | } 63 | 64 | func TestCounterZero(t *testing.T) { 65 | c := NewCounter() 66 | if count := c.Count(); 0 != count { 67 | t.Errorf("c.Count(): 0 != %v\n", count) 68 | } 69 | } 70 | 71 | func TestGetOrRegisterCounter(t *testing.T) { 72 | r := NewRegistry() 73 | NewRegisteredCounter("foo", r).Inc(47) 74 | if c := GetOrRegisterCounter("foo", r); 47 != c.Count() { 75 | t.Fatal(c) 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/debug_test.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "runtime" 5 | "runtime/debug" 6 | "testing" 7 | "time" 8 | ) 9 | 10 | func BenchmarkDebugGCStats(b *testing.B) { 11 | r := NewRegistry() 12 | RegisterDebugGCStats(r) 13 | b.ResetTimer() 14 | for i := 0; i < b.N; i++ { 15 | CaptureDebugGCStatsOnce(r) 16 | } 17 | } 18 | 19 | func TestDebugGCStatsBlocking(t *testing.T) { 20 | if g := runtime.GOMAXPROCS(0); g < 2 { 21 | t.Skipf("skipping TestDebugGCMemStatsBlocking with GOMAXPROCS=%d\n", g) 22 | return 23 | } 24 | ch := make(chan int) 25 | go testDebugGCStatsBlocking(ch) 26 | var gcStats debug.GCStats 27 | t0 := time.Now() 28 | debug.ReadGCStats(&gcStats) 29 | t1 := time.Now() 30 | t.Log("i++ during debug.ReadGCStats:", <-ch) 31 | go testDebugGCStatsBlocking(ch) 32 | d := t1.Sub(t0) 33 | t.Log(d) 34 | time.Sleep(d) 35 | t.Log("i++ during time.Sleep:", <-ch) 36 | } 37 | 38 | func testDebugGCStatsBlocking(ch chan int) { 39 | i := 0 40 | for { 41 | select { 42 | case ch <- i: 43 | return 44 | default: 45 | i++ 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/gauge_float64_test.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import "testing" 4 | 5 | func BenchmarkGuageFloat64(b *testing.B) { 6 | g := NewGaugeFloat64() 7 | b.ResetTimer() 8 | for i := 0; i < b.N; i++ { 9 | g.Update(float64(i)) 10 | } 11 | } 12 | 13 | func TestGaugeFloat64(t *testing.T) { 14 | g := NewGaugeFloat64() 15 | g.Update(float64(47.0)) 16 | if v := g.Value(); float64(47.0) != v { 17 | t.Errorf("g.Value(): 47.0 != %v\n", v) 18 | } 19 | } 20 | 21 | func TestGaugeFloat64Snapshot(t *testing.T) { 22 | g := NewGaugeFloat64() 23 | g.Update(float64(47.0)) 24 | snapshot := g.Snapshot() 25 | g.Update(float64(0)) 26 | if v := snapshot.Value(); float64(47.0) != v { 27 | t.Errorf("g.Value(): 47.0 != %v\n", v) 28 | } 29 | } 30 | 31 | func TestGetOrRegisterGaugeFloat64(t *testing.T) { 32 | r := NewRegistry() 33 | NewRegisteredGaugeFloat64("foo", r).Update(float64(47.0)) 34 | t.Logf("registry: %v", r) 35 | if g := GetOrRegisterGaugeFloat64("foo", r); float64(47.0) != g.Value() { 36 | t.Fatal(g) 37 | } 38 | } 39 | 40 | func TestFunctionalGaugeFloat64(t *testing.T) { 41 | var counter float64 42 | fg := NewFunctionalGaugeFloat64(func() float64 { 43 | counter++ 44 | return counter 45 | }) 46 | fg.Value() 47 | fg.Value() 48 | if counter != 2 { 49 | t.Error("counter != 2") 50 | } 51 | } 52 | 53 | func TestGetOrRegisterFunctionalGaugeFloat64(t *testing.T) { 54 | r := NewRegistry() 55 | NewRegisteredFunctionalGaugeFloat64("foo", r, func() float64 { return 47 }) 56 | if g := GetOrRegisterGaugeFloat64("foo", r); 47 != g.Value() { 57 | t.Fatal(g) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/gauge_test.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func BenchmarkGuage(b *testing.B) { 9 | g := NewGauge() 10 | b.ResetTimer() 11 | for i := 0; i < b.N; i++ { 12 | g.Update(int64(i)) 13 | } 14 | } 15 | 16 | func TestGauge(t *testing.T) { 17 | g := NewGauge() 18 | g.Update(int64(47)) 19 | if v := g.Value(); 47 != v { 20 | t.Errorf("g.Value(): 47 != %v\n", v) 21 | } 22 | } 23 | 24 | func TestGaugeSnapshot(t *testing.T) { 25 | g := NewGauge() 26 | g.Update(int64(47)) 27 | snapshot := g.Snapshot() 28 | g.Update(int64(0)) 29 | if v := snapshot.Value(); 47 != v { 30 | t.Errorf("g.Value(): 47 != %v\n", v) 31 | } 32 | } 33 | 34 | func TestGetOrRegisterGauge(t *testing.T) { 35 | r := NewRegistry() 36 | NewRegisteredGauge("foo", r).Update(47) 37 | if g := GetOrRegisterGauge("foo", r); 47 != g.Value() { 38 | t.Fatal(g) 39 | } 40 | } 41 | 42 | func TestFunctionalGauge(t *testing.T) { 43 | var counter int64 44 | fg := NewFunctionalGauge(func() int64 { 45 | counter++ 46 | return counter 47 | }) 48 | fg.Value() 49 | fg.Value() 50 | if counter != 2 { 51 | t.Error("counter != 2") 52 | } 53 | } 54 | 55 | func TestGetOrRegisterFunctionalGauge(t *testing.T) { 56 | r := NewRegistry() 57 | NewRegisteredFunctionalGauge("foo", r, func() int64 { return 47 }) 58 | if g := GetOrRegisterGauge("foo", r); 47 != g.Value() { 59 | t.Fatal(g) 60 | } 61 | } 62 | 63 | func ExampleGetOrRegisterGauge() { 64 | m := "server.bytes_sent" 65 | g := GetOrRegisterGauge(m, nil) 66 | g.Update(47) 67 | fmt.Println(g.Value()) // Output: 47 68 | } 69 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/graphite_test.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "net" 5 | "time" 6 | ) 7 | 8 | func ExampleGraphite() { 9 | addr, _ := net.ResolveTCPAddr("net", ":2003") 10 | go Graphite(DefaultRegistry, 1*time.Second, "some.prefix", addr) 11 | } 12 | 13 | func ExampleGraphiteWithConfig() { 14 | addr, _ := net.ResolveTCPAddr("net", ":2003") 15 | go GraphiteWithConfig(GraphiteConfig{ 16 | Addr: addr, 17 | Registry: DefaultRegistry, 18 | FlushInterval: 1 * time.Second, 19 | DurationUnit: time.Millisecond, 20 | Percentiles: []float64{0.5, 0.75, 0.99, 0.999}, 21 | }) 22 | } 23 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/healthcheck.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | // Healthchecks hold an error value describing an arbitrary up/down status. 4 | type Healthcheck interface { 5 | Check() 6 | Error() error 7 | Healthy() 8 | Unhealthy(error) 9 | } 10 | 11 | // NewHealthcheck constructs a new Healthcheck which will use the given 12 | // function to update its status. 13 | func NewHealthcheck(f func(Healthcheck)) Healthcheck { 14 | if UseNilMetrics { 15 | return NilHealthcheck{} 16 | } 17 | return &StandardHealthcheck{nil, f} 18 | } 19 | 20 | // NilHealthcheck is a no-op. 21 | type NilHealthcheck struct{} 22 | 23 | // Check is a no-op. 24 | func (NilHealthcheck) Check() {} 25 | 26 | // Error is a no-op. 27 | func (NilHealthcheck) Error() error { return nil } 28 | 29 | // Healthy is a no-op. 30 | func (NilHealthcheck) Healthy() {} 31 | 32 | // Unhealthy is a no-op. 33 | func (NilHealthcheck) Unhealthy(error) {} 34 | 35 | // StandardHealthcheck is the standard implementation of a Healthcheck and 36 | // stores the status and a function to call to update the status. 37 | type StandardHealthcheck struct { 38 | err error 39 | f func(Healthcheck) 40 | } 41 | 42 | // Check runs the healthcheck function to update the healthcheck's status. 43 | func (h *StandardHealthcheck) Check() { 44 | h.f(h) 45 | } 46 | 47 | // Error returns the healthcheck's status, which will be nil if it is healthy. 48 | func (h *StandardHealthcheck) Error() error { 49 | return h.err 50 | } 51 | 52 | // Healthy marks the healthcheck as healthy. 53 | func (h *StandardHealthcheck) Healthy() { 54 | h.err = nil 55 | } 56 | 57 | // Unhealthy marks the healthcheck as unhealthy. The error is stored and 58 | // may be retrieved by the Error method. 59 | func (h *StandardHealthcheck) Unhealthy(err error) { 60 | h.err = err 61 | } 62 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/json_test.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "bytes" 5 | "encoding/json" 6 | "testing" 7 | ) 8 | 9 | func TestRegistryMarshallJSON(t *testing.T) { 10 | b := &bytes.Buffer{} 11 | enc := json.NewEncoder(b) 12 | r := NewRegistry() 13 | r.Register("counter", NewCounter()) 14 | enc.Encode(r) 15 | if s := b.String(); "{\"counter\":{\"count\":0}}\n" != s { 16 | t.Fatalf(s) 17 | } 18 | } 19 | 20 | func TestRegistryWriteJSONOnce(t *testing.T) { 21 | r := NewRegistry() 22 | r.Register("counter", NewCounter()) 23 | b := &bytes.Buffer{} 24 | WriteJSONOnce(r, b) 25 | if s := b.String(); s != "{\"counter\":{\"count\":0}}\n" { 26 | t.Fail() 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/meter_test.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "testing" 5 | "time" 6 | ) 7 | 8 | func BenchmarkMeter(b *testing.B) { 9 | m := NewMeter() 10 | b.ResetTimer() 11 | for i := 0; i < b.N; i++ { 12 | m.Mark(1) 13 | } 14 | } 15 | 16 | func TestGetOrRegisterMeter(t *testing.T) { 17 | r := NewRegistry() 18 | NewRegisteredMeter("foo", r).Mark(47) 19 | if m := GetOrRegisterMeter("foo", r); 47 != m.Count() { 20 | t.Fatal(m) 21 | } 22 | } 23 | 24 | func TestMeterDecay(t *testing.T) { 25 | ma := meterArbiter{ 26 | ticker: time.NewTicker(time.Millisecond), 27 | } 28 | m := newStandardMeter() 29 | ma.meters = append(ma.meters, m) 30 | go ma.tick() 31 | m.Mark(1) 32 | rateMean := m.RateMean() 33 | time.Sleep(100 * time.Millisecond) 34 | if m.RateMean() >= rateMean { 35 | t.Error("m.RateMean() didn't decrease") 36 | } 37 | } 38 | 39 | func TestMeterNonzero(t *testing.T) { 40 | m := NewMeter() 41 | m.Mark(3) 42 | if count := m.Count(); 3 != count { 43 | t.Errorf("m.Count(): 3 != %v\n", count) 44 | } 45 | } 46 | 47 | func TestMeterSnapshot(t *testing.T) { 48 | m := NewMeter() 49 | m.Mark(1) 50 | if snapshot := m.Snapshot(); m.RateMean() != snapshot.RateMean() { 51 | t.Fatal(snapshot) 52 | } 53 | } 54 | 55 | func TestMeterZero(t *testing.T) { 56 | m := NewMeter() 57 | if count := m.Count(); 0 != count { 58 | t.Errorf("m.Count(): 0 != %v\n", count) 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/metrics.go: -------------------------------------------------------------------------------- 1 | // Go port of Coda Hale's Metrics library 2 | // 3 | // 4 | // 5 | // Coda Hale's original work: 6 | package metrics 7 | 8 | // UseNilMetrics is checked by the constructor functions for all of the 9 | // standard metrics. If it is true, the metric returned is a stub. 10 | // 11 | // This global kill-switch helps quantify the observer effect and makes 12 | // for less cluttered pprof profiles. 13 | var UseNilMetrics bool = false 14 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/opentsdb_test.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "net" 5 | "time" 6 | ) 7 | 8 | func ExampleOpenTSDB() { 9 | addr, _ := net.ResolveTCPAddr("net", ":2003") 10 | go OpenTSDB(DefaultRegistry, 1*time.Second, "some.prefix", addr) 11 | } 12 | 13 | func ExampleOpenTSDBWithConfig() { 14 | addr, _ := net.ResolveTCPAddr("net", ":2003") 15 | go OpenTSDBWithConfig(OpenTSDBConfig{ 16 | Addr: addr, 17 | Registry: DefaultRegistry, 18 | FlushInterval: 1 * time.Second, 19 | DurationUnit: time.Millisecond, 20 | }) 21 | } 22 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/runtime_cgo.go: -------------------------------------------------------------------------------- 1 | // +build cgo 2 | // +build !appengine 3 | 4 | package metrics 5 | 6 | import "runtime" 7 | 8 | func numCgoCall() int64 { 9 | return runtime.NumCgoCall() 10 | } 11 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/runtime_gccpufraction.go: -------------------------------------------------------------------------------- 1 | // +build go1.5 2 | 3 | package metrics 4 | 5 | import "runtime" 6 | 7 | func gcCPUFraction(memStats *runtime.MemStats) float64 { 8 | return memStats.GCCPUFraction 9 | } 10 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/runtime_no_cgo.go: -------------------------------------------------------------------------------- 1 | // +build !cgo appengine 2 | 3 | package metrics 4 | 5 | func numCgoCall() int64 { 6 | return 0 7 | } 8 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/runtime_no_gccpufraction.go: -------------------------------------------------------------------------------- 1 | // +build !go1.5 2 | 3 | package metrics 4 | 5 | import "runtime" 6 | 7 | func gcCPUFraction(memStats *runtime.MemStats) float64 { 8 | return 0 9 | } 10 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/syslog.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package metrics 4 | 5 | import ( 6 | "fmt" 7 | "log/syslog" 8 | "time" 9 | ) 10 | 11 | // Output each metric in the given registry to syslog periodically using 12 | // the given syslogger. 13 | func Syslog(r Registry, d time.Duration, w *syslog.Writer) { 14 | for _ = range time.Tick(d) { 15 | r.Each(func(name string, i interface{}) { 16 | switch metric := i.(type) { 17 | case Counter: 18 | w.Info(fmt.Sprintf("counter %s: count: %d", name, metric.Count())) 19 | case Gauge: 20 | w.Info(fmt.Sprintf("gauge %s: value: %d", name, metric.Value())) 21 | case GaugeFloat64: 22 | w.Info(fmt.Sprintf("gauge %s: value: %f", name, metric.Value())) 23 | case Healthcheck: 24 | metric.Check() 25 | w.Info(fmt.Sprintf("healthcheck %s: error: %v", name, metric.Error())) 26 | case Histogram: 27 | h := metric.Snapshot() 28 | ps := h.Percentiles([]float64{0.5, 0.75, 0.95, 0.99, 0.999}) 29 | w.Info(fmt.Sprintf( 30 | "histogram %s: count: %d min: %d max: %d mean: %.2f stddev: %.2f median: %.2f 75%%: %.2f 95%%: %.2f 99%%: %.2f 99.9%%: %.2f", 31 | name, 32 | h.Count(), 33 | h.Min(), 34 | h.Max(), 35 | h.Mean(), 36 | h.StdDev(), 37 | ps[0], 38 | ps[1], 39 | ps[2], 40 | ps[3], 41 | ps[4], 42 | )) 43 | case Meter: 44 | m := metric.Snapshot() 45 | w.Info(fmt.Sprintf( 46 | "meter %s: count: %d 1-min: %.2f 5-min: %.2f 15-min: %.2f mean: %.2f", 47 | name, 48 | m.Count(), 49 | m.Rate1(), 50 | m.Rate5(), 51 | m.Rate15(), 52 | m.RateMean(), 53 | )) 54 | case Timer: 55 | t := metric.Snapshot() 56 | ps := t.Percentiles([]float64{0.5, 0.75, 0.95, 0.99, 0.999}) 57 | w.Info(fmt.Sprintf( 58 | "timer %s: count: %d min: %d max: %d mean: %.2f stddev: %.2f median: %.2f 75%%: %.2f 95%%: %.2f 99%%: %.2f 99.9%%: %.2f 1-min: %.2f 5-min: %.2f 15-min: %.2f mean-rate: %.2f", 59 | name, 60 | t.Count(), 61 | t.Min(), 62 | t.Max(), 63 | t.Mean(), 64 | t.StdDev(), 65 | ps[0], 66 | ps[1], 67 | ps[2], 68 | ps[3], 69 | ps[4], 70 | t.Rate1(), 71 | t.Rate5(), 72 | t.Rate15(), 73 | t.RateMean(), 74 | )) 75 | } 76 | }) 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/validate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # check there are no formatting issues 6 | GOFMT_LINES=`gofmt -l . | wc -l | xargs` 7 | test $GOFMT_LINES -eq 0 || echo "gofmt needs to be run, ${GOFMT_LINES} files have issues" 8 | 9 | # run the tests for the root package 10 | go test . 11 | -------------------------------------------------------------------------------- /src/github.com/rcrowley/go-metrics/writer_test.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "sort" 5 | "testing" 6 | ) 7 | 8 | func TestMetricsSorting(t *testing.T) { 9 | var namedMetrics = namedMetricSlice{ 10 | {name: "zzz"}, 11 | {name: "bbb"}, 12 | {name: "fff"}, 13 | {name: "ggg"}, 14 | } 15 | 16 | sort.Sort(namedMetrics) 17 | for i, name := range []string{"bbb", "fff", "ggg", "zzz"} { 18 | if namedMetrics[i].name != name { 19 | t.Fail() 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/gopkg.in/inconshreveable/go-update.v0/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014 Alan Shreve 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /src/gopkg.in/inconshreveable/go-update.v0/README.md: -------------------------------------------------------------------------------- 1 | # go-update: Automatically update Go programs from the internet 2 | 3 | go-update allows a program to update itself by replacing its executable file 4 | with a new version. It provides the flexibility to implement different updating user experiences 5 | like auto-updating, or manual user-initiated updates. It also boasts 6 | advanced features like binary patching and code signing verification. 7 | 8 | Updating your program to a new version is as easy as: 9 | 10 | err, errRecover := update.New().FromUrl("http://release.example.com/2.0/myprogram") 11 | if err != nil { 12 | fmt.Printf("Update failed: %v\n", err) 13 | } 14 | 15 | ## Documentation and API Reference 16 | 17 | Comprehensive API documentation and code examples are available in the code documentation available on godoc.org: 18 | 19 | [![GoDoc](https://godoc.org/github.com/inconshreveable/go-update?status.svg)](https://godoc.org/github.com/inconshreveable/go-update) 20 | 21 | ## Features 22 | 23 | - Cross platform support (Windows too!) 24 | - Binary patch application 25 | - Checksum verification 26 | - Code signing verification 27 | - Support for updating arbitrary files 28 | 29 | ## [equinox.io](https://equinox.io) 30 | go-update provides the primitives for building self-updating applications, but there a number of other challenges 31 | involved in a complete updating solution such as hosting, code signing, update channels, gradual rollout, 32 | dynamically computing binary patches, tracking update metrics like versions and failures, plus more. 33 | 34 | I provide this service, a complete solution, free for open source projects, at [equinox.io](https://equinox.io). 35 | 36 | ## License 37 | Apache 38 | -------------------------------------------------------------------------------- /src/gopkg.in/inconshreveable/go-update.v0/hide_noop.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package update 4 | 5 | func hideFile(path string) error { 6 | return nil 7 | } 8 | -------------------------------------------------------------------------------- /src/gopkg.in/inconshreveable/go-update.v0/hide_windows.go: -------------------------------------------------------------------------------- 1 | package update 2 | 3 | import ( 4 | "syscall" 5 | "unsafe" 6 | ) 7 | 8 | func hideFile(path string) error { 9 | kernel32 := syscall.NewLazyDLL("kernel32.dll") 10 | setFileAttributes := kernel32.NewProc("SetFileAttributesW") 11 | 12 | r1, _, err := setFileAttributes.Call(uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(path))), 2) 13 | 14 | if r1 == 0 { 15 | return err 16 | } else { 17 | return nil 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/gopkg.in/yaml.v1/LICENSE.libyaml: -------------------------------------------------------------------------------- 1 | The following files were ported to Go from C files of libyaml, and thus 2 | are still covered by their original copyright and license: 3 | 4 | apic.go 5 | emitterc.go 6 | parserc.go 7 | readerc.go 8 | scannerc.go 9 | writerc.go 10 | yamlh.go 11 | yamlprivateh.go 12 | 13 | Copyright (c) 2006 Kirill Simonov 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of 16 | this software and associated documentation files (the "Software"), to deal in 17 | the Software without restriction, including without limitation the rights to 18 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 19 | of the Software, and to permit persons to whom the Software is furnished to do 20 | so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | -------------------------------------------------------------------------------- /src/gopkg.in/yaml.v1/suite_test.go: -------------------------------------------------------------------------------- 1 | package yaml_test 2 | 3 | import ( 4 | . "gopkg.in/check.v1" 5 | "testing" 6 | ) 7 | 8 | func Test(t *testing.T) { TestingT(t) } 9 | 10 | type S struct{} 11 | 12 | var _ = Suite(&S{}) 13 | -------------------------------------------------------------------------------- /src/ngrok/client/debug.go: -------------------------------------------------------------------------------- 1 | // +build !release 2 | 3 | package client 4 | 5 | var ( 6 | rootCrtPaths = []string{"assets/client/tls/ngrokroot.crt", "assets/client/tls/snakeoilca.crt"} 7 | ) 8 | 9 | func useInsecureSkipVerify() bool { 10 | return true 11 | } 12 | -------------------------------------------------------------------------------- /src/ngrok/client/main.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "fmt" 5 | "github.com/inconshreveable/mousetrap" 6 | "math/rand" 7 | "ngrok/log" 8 | "ngrok/util" 9 | "os" 10 | "runtime" 11 | "time" 12 | ) 13 | 14 | func init() { 15 | if runtime.GOOS == "windows" { 16 | if mousetrap.StartedByExplorer() { 17 | fmt.Println("请不要直接双击运行ngrok!") 18 | fmt.Println("你需要打开cmd.exe并从命令行中运行!") 19 | time.Sleep(5 * time.Second) 20 | os.Exit(1) 21 | } 22 | } 23 | } 24 | 25 | func Main() { 26 | // parse options 27 | opts, err := ParseArgs() 28 | if err != nil { 29 | fmt.Println(err) 30 | os.Exit(1) 31 | } 32 | 33 | // set up logging 34 | log.LogTo(opts.logto, opts.loglevel) 35 | 36 | // read configuration file 37 | config, err := LoadConfiguration(opts) 38 | if err != nil { 39 | fmt.Println(err) 40 | os.Exit(1) 41 | } 42 | 43 | // seed random number generator 44 | seed, err := util.RandomSeed() 45 | if err != nil { 46 | fmt.Printf("无法安全地生成随机数生成器!") 47 | os.Exit(1) 48 | } 49 | rand.Seed(seed) 50 | 51 | NewController().Run(config) 52 | } 53 | -------------------------------------------------------------------------------- /src/ngrok/client/metrics.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | metrics "github.com/rcrowley/go-metrics" 5 | ) 6 | 7 | const ( 8 | sampleSize int = 1028 9 | sampleAlpha float64 = 0.015 10 | ) 11 | 12 | type ClientMetrics struct { 13 | // metrics 14 | connGauge metrics.Gauge 15 | connMeter metrics.Meter 16 | connTimer metrics.Timer 17 | proxySetupTimer metrics.Timer 18 | bytesIn metrics.Histogram 19 | bytesOut metrics.Histogram 20 | bytesInCount metrics.Counter 21 | bytesOutCount metrics.Counter 22 | } 23 | 24 | func NewClientMetrics() *ClientMetrics { 25 | return &ClientMetrics{ 26 | connGauge: metrics.NewGauge(), 27 | connMeter: metrics.NewMeter(), 28 | connTimer: metrics.NewTimer(), 29 | proxySetupTimer: metrics.NewTimer(), 30 | bytesIn: metrics.NewHistogram(metrics.NewExpDecaySample(sampleSize, sampleAlpha)), 31 | bytesOut: metrics.NewHistogram(metrics.NewExpDecaySample(sampleSize, sampleAlpha)), 32 | bytesInCount: metrics.NewCounter(), 33 | bytesOutCount: metrics.NewCounter(), 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/ngrok/client/mvc/controller.go: -------------------------------------------------------------------------------- 1 | package mvc 2 | 3 | import ( 4 | "ngrok/util" 5 | ) 6 | 7 | type Controller interface { 8 | // how the model communicates that it has changed state 9 | Update(State) 10 | 11 | // instructs the controller to shut the app down 12 | Shutdown(message string) 13 | 14 | // PlayRequest instructs the model to play requests 15 | PlayRequest(tunnel Tunnel, payload []byte) 16 | 17 | // A channel of updates 18 | Updates() *util.Broadcast 19 | 20 | // returns the current state 21 | State() State 22 | 23 | // safe wrapper for running go-routines 24 | Go(fn func()) 25 | 26 | // the address where the web inspection interface is running 27 | GetWebInspectAddr() string 28 | } 29 | -------------------------------------------------------------------------------- /src/ngrok/client/mvc/model.go: -------------------------------------------------------------------------------- 1 | package mvc 2 | 3 | type Model interface { 4 | Run() 5 | 6 | Shutdown() 7 | 8 | PlayRequest(tunnel Tunnel, payload []byte) 9 | } 10 | -------------------------------------------------------------------------------- /src/ngrok/client/mvc/state.go: -------------------------------------------------------------------------------- 1 | package mvc 2 | 3 | import ( 4 | metrics "github.com/rcrowley/go-metrics" 5 | "ngrok/proto" 6 | ) 7 | 8 | type UpdateStatus int 9 | 10 | const ( 11 | UpdateNone = -1 * iota 12 | UpdateInstalling 13 | UpdateReady 14 | UpdateAvailable 15 | ) 16 | 17 | type ConnStatus int 18 | 19 | const ( 20 | ConnConnecting = iota 21 | ConnReconnecting 22 | ConnOnline 23 | ) 24 | 25 | type Tunnel struct { 26 | PublicUrl string 27 | Protocol proto.Protocol 28 | LocalAddr string 29 | } 30 | 31 | type ConnectionContext struct { 32 | Tunnel Tunnel 33 | ClientAddr string 34 | } 35 | 36 | type State interface { 37 | GetClientVersion() string 38 | GetServerVersion() string 39 | GetTunnels() []Tunnel 40 | GetProtocols() []proto.Protocol 41 | GetUpdateStatus() UpdateStatus 42 | GetConnStatus() ConnStatus 43 | GetConnectionMetrics() (metrics.Meter, metrics.Timer) 44 | GetBytesInMetrics() (metrics.Counter, metrics.Histogram) 45 | GetBytesOutMetrics() (metrics.Counter, metrics.Histogram) 46 | SetUpdateStatus(UpdateStatus) 47 | } 48 | -------------------------------------------------------------------------------- /src/ngrok/client/mvc/view.go: -------------------------------------------------------------------------------- 1 | package mvc 2 | 3 | type View interface { 4 | Shutdown() 5 | } 6 | -------------------------------------------------------------------------------- /src/ngrok/client/release.go: -------------------------------------------------------------------------------- 1 | // +build release 2 | 3 | package client 4 | 5 | var ( 6 | rootCrtPaths = []string{"assets/client/tls/ngrokroot.crt"} 7 | ) 8 | 9 | func useInsecureSkipVerify() bool { 10 | return false 11 | } 12 | -------------------------------------------------------------------------------- /src/ngrok/client/tls.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | _ "crypto/sha512" 5 | "crypto/tls" 6 | "crypto/x509" 7 | "encoding/pem" 8 | "fmt" 9 | "ngrok/client/assets" 10 | ) 11 | 12 | func LoadTLSConfig(rootCertPaths []string) (*tls.Config, error) { 13 | pool := x509.NewCertPool() 14 | 15 | for _, certPath := range rootCertPaths { 16 | rootCrt, err := assets.Asset(certPath) 17 | if err != nil { 18 | return nil, err 19 | } 20 | 21 | pemBlock, _ := pem.Decode(rootCrt) 22 | if pemBlock == nil { 23 | return nil, fmt.Errorf("Bad PEM data") 24 | } 25 | 26 | certs, err := x509.ParseCertificates(pemBlock.Bytes) 27 | if err != nil { 28 | return nil, err 29 | } 30 | 31 | pool.AddCert(certs[0]) 32 | } 33 | 34 | return &tls.Config{RootCAs: pool}, nil 35 | } 36 | -------------------------------------------------------------------------------- /src/ngrok/client/update_debug.go: -------------------------------------------------------------------------------- 1 | // +build !release,!autoupdate 2 | 3 | package client 4 | 5 | import ( 6 | "ngrok/client/mvc" 7 | ) 8 | 9 | // no auto-updating in debug mode 10 | func autoUpdate(state mvc.State, token string) { 11 | } 12 | -------------------------------------------------------------------------------- /src/ngrok/client/views/term/area.go: -------------------------------------------------------------------------------- 1 | // shared internal functions for handling output to the terminal 2 | package term 3 | 4 | import ( 5 | "fmt" 6 | termbox "github.com/nsf/termbox-go" 7 | ) 8 | 9 | const ( 10 | fgColor = termbox.ColorWhite 11 | bgColor = termbox.ColorDefault 12 | ) 13 | 14 | type area struct { 15 | // top-left corner 16 | x, y int 17 | 18 | // size of the area 19 | w, h int 20 | 21 | // default colors 22 | fgColor, bgColor termbox.Attribute 23 | } 24 | 25 | func NewArea(x, y, w, h int) *area { 26 | return &area{x, y, w, h, fgColor, bgColor} 27 | } 28 | 29 | func (a *area) Clear() { 30 | for i := 0; i < a.w; i++ { 31 | for j := 0; j < a.h; j++ { 32 | termbox.SetCell(a.x+i, a.y+j, ' ', a.fgColor, a.bgColor) 33 | } 34 | } 35 | } 36 | 37 | func (a *area) APrintf(fg termbox.Attribute, x, y int, arg0 string, args ...interface{}) { 38 | s := fmt.Sprintf(arg0, args...) 39 | for i, ch := range s { 40 | termbox.SetCell(a.x+x+i, a.y+y, ch, fg, bgColor) 41 | } 42 | } 43 | 44 | func (a *area) Printf(x, y int, arg0 string, args ...interface{}) { 45 | a.APrintf(a.fgColor, x, y, arg0, args...) 46 | } 47 | -------------------------------------------------------------------------------- /src/ngrok/client/views/web/view.go: -------------------------------------------------------------------------------- 1 | // interactive web user interface 2 | package web 3 | 4 | import ( 5 | "github.com/gorilla/websocket" 6 | "net/http" 7 | "ngrok/client/assets" 8 | "ngrok/client/mvc" 9 | "ngrok/log" 10 | "ngrok/proto" 11 | "ngrok/util" 12 | "path" 13 | ) 14 | 15 | type WebView struct { 16 | log.Logger 17 | 18 | ctl mvc.Controller 19 | 20 | // messages sent over this broadcast are sent to all websocket connections 21 | wsMessages *util.Broadcast 22 | } 23 | 24 | func NewWebView(ctl mvc.Controller, addr string) *WebView { 25 | wv := &WebView{ 26 | Logger: log.NewPrefixLogger("view", "web"), 27 | wsMessages: util.NewBroadcast(), 28 | ctl: ctl, 29 | } 30 | 31 | // for now, always redirect to the http view 32 | http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { 33 | http.Redirect(w, r, "/http/in", 302) 34 | }) 35 | 36 | // handle web socket connections 37 | http.HandleFunc("/_ws", func(w http.ResponseWriter, r *http.Request) { 38 | conn, err := websocket.Upgrade(w, r, nil, 1024, 1024) 39 | 40 | if err != nil { 41 | http.Error(w, "WebSocket升级失败", 400) 42 | wv.Warn("WebSocket升级失败: %v", err) 43 | return 44 | } 45 | 46 | msgs := wv.wsMessages.Reg() 47 | defer wv.wsMessages.UnReg(msgs) 48 | for m := range msgs { 49 | err := conn.WriteMessage(websocket.TextMessage, m.([]byte)) 50 | if err != nil { 51 | // connection is closed 52 | break 53 | } 54 | } 55 | }) 56 | 57 | // serve static assets 58 | http.HandleFunc("/static/", func(w http.ResponseWriter, r *http.Request) { 59 | buf, err := assets.Asset(path.Join("assets", "client", r.URL.Path[1:])) 60 | if err != nil { 61 | wv.Warn("服务静态文件的错误: %s", err.Error()) 62 | http.NotFound(w, r) 63 | return 64 | } 65 | w.Write(buf) 66 | }) 67 | 68 | wv.Info("Web服务接口 %s", addr) 69 | wv.ctl.Go(func() { http.ListenAndServe(addr, nil) }) 70 | return wv 71 | } 72 | 73 | func (wv *WebView) NewHttpView(proto *proto.Http) *WebHttpView { 74 | return newWebHttpView(wv.ctl, wv, proto) 75 | } 76 | 77 | func (wv *WebView) Shutdown() { 78 | } 79 | -------------------------------------------------------------------------------- /src/ngrok/conn/tee.go: -------------------------------------------------------------------------------- 1 | package conn 2 | 3 | import ( 4 | "bufio" 5 | "io" 6 | ) 7 | 8 | // conn.Tee is a wraps a conn.Conn 9 | // causing all writes/reads to be tee'd just 10 | // like the unix command such that all data that 11 | // is read and written to the connection through its 12 | // interfaces will also be copied into two dedicated pipes 13 | // used for consuming a copy of the data stream 14 | // 15 | // this is useful for introspecting the traffic flowing 16 | // over a connection without having to tamper with the actual 17 | // code that reads and writes over the connection 18 | // 19 | // NB: the data is Tee'd into a shared-memory io.Pipe which 20 | // has a limited (and small) buffer. If you are not consuming from 21 | // the ReadBuffer() and WriteBuffer(), you are going to block 22 | // your application's real traffic from flowing over the connection 23 | 24 | type Tee struct { 25 | rd io.Reader 26 | wr io.Writer 27 | readPipe struct { 28 | rd *io.PipeReader 29 | wr *io.PipeWriter 30 | } 31 | writePipe struct { 32 | rd *io.PipeReader 33 | wr *io.PipeWriter 34 | } 35 | Conn 36 | } 37 | 38 | func NewTee(conn Conn) *Tee { 39 | c := &Tee{ 40 | rd: nil, 41 | wr: nil, 42 | Conn: conn, 43 | } 44 | 45 | c.readPipe.rd, c.readPipe.wr = io.Pipe() 46 | c.writePipe.rd, c.writePipe.wr = io.Pipe() 47 | 48 | c.rd = io.TeeReader(c.Conn, c.readPipe.wr) 49 | c.wr = io.MultiWriter(c.Conn, c.writePipe.wr) 50 | return c 51 | } 52 | 53 | func (c *Tee) ReadBuffer() *bufio.Reader { 54 | return bufio.NewReader(c.readPipe.rd) 55 | } 56 | 57 | func (c *Tee) WriteBuffer() *bufio.Reader { 58 | return bufio.NewReader(c.writePipe.rd) 59 | } 60 | 61 | func (c *Tee) Read(b []byte) (n int, err error) { 62 | n, err = c.rd.Read(b) 63 | if err != nil { 64 | c.readPipe.wr.Close() 65 | } 66 | return 67 | } 68 | 69 | func (c *Tee) ReadFrom(r io.Reader) (n int64, err error) { 70 | n, err = io.Copy(c.wr, r) 71 | if err != nil { 72 | c.writePipe.wr.Close() 73 | } 74 | return 75 | } 76 | 77 | func (c *Tee) Write(b []byte) (n int, err error) { 78 | n, err = c.wr.Write(b) 79 | if err != nil { 80 | c.writePipe.wr.Close() 81 | } 82 | return 83 | } 84 | -------------------------------------------------------------------------------- /src/ngrok/main/ngrok/ngrok.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "ngrok/client" 5 | ) 6 | 7 | func main() { 8 | client.Main() 9 | } 10 | -------------------------------------------------------------------------------- /src/ngrok/main/ngrokd/ngrokd.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "ngrok/server" 5 | ) 6 | 7 | func main() { 8 | server.Main() 9 | } 10 | -------------------------------------------------------------------------------- /src/ngrok/msg/conn.go: -------------------------------------------------------------------------------- 1 | package msg 2 | 3 | import ( 4 | "encoding/binary" 5 | "errors" 6 | "fmt" 7 | "ngrok/conn" 8 | ) 9 | 10 | func readMsgShared(c conn.Conn) (buffer []byte, err error) { 11 | c.Debug("等待读取消息") 12 | 13 | var sz int64 14 | err = binary.Read(c, binary.LittleEndian, &sz) 15 | if err != nil { 16 | return 17 | } 18 | c.Debug("读取消息长度: %d", sz) 19 | 20 | buffer = make([]byte, sz) 21 | n, err := c.Read(buffer) 22 | c.Debug("读取消息 %s", buffer) 23 | 24 | if err != nil { 25 | return 26 | } 27 | 28 | if int64(n) != sz { 29 | err = errors.New(fmt.Sprintf("预期要读取 %d bytes, 但只读取 %d", sz, n)) 30 | return 31 | } 32 | 33 | return 34 | } 35 | 36 | func ReadMsg(c conn.Conn) (msg Message, err error) { 37 | buffer, err := readMsgShared(c) 38 | if err != nil { 39 | return 40 | } 41 | 42 | return Unpack(buffer) 43 | } 44 | 45 | func ReadMsgInto(c conn.Conn, msg Message) (err error) { 46 | buffer, err := readMsgShared(c) 47 | if err != nil { 48 | return 49 | } 50 | return UnpackInto(buffer, msg) 51 | } 52 | 53 | func WriteMsg(c conn.Conn, msg interface{}) (err error) { 54 | buffer, err := Pack(msg) 55 | if err != nil { 56 | return 57 | } 58 | 59 | c.Debug("写消息: %s", string(buffer)) 60 | err = binary.Write(c, binary.LittleEndian, int64(len(buffer))) 61 | 62 | if err != nil { 63 | return 64 | } 65 | 66 | if _, err = c.Write(buffer); err != nil { 67 | return 68 | } 69 | 70 | return nil 71 | } 72 | -------------------------------------------------------------------------------- /src/ngrok/msg/pack.go: -------------------------------------------------------------------------------- 1 | package msg 2 | 3 | import ( 4 | "encoding/json" 5 | "errors" 6 | "fmt" 7 | "reflect" 8 | ) 9 | 10 | func unpack(buffer []byte, msgIn Message) (msg Message, err error) { 11 | var env Envelope 12 | if err = json.Unmarshal(buffer, &env); err != nil { 13 | return 14 | } 15 | 16 | if msgIn == nil { 17 | t, ok := TypeMap[env.Type] 18 | 19 | if !ok { 20 | err = errors.New(fmt.Sprintf("不支持的消息类型 %s", env.Type)) 21 | return 22 | } 23 | 24 | // guess type 25 | msg = reflect.New(t).Interface().(Message) 26 | } else { 27 | msg = msgIn 28 | } 29 | 30 | err = json.Unmarshal(env.Payload, &msg) 31 | return 32 | } 33 | 34 | func UnpackInto(buffer []byte, msg Message) (err error) { 35 | _, err = unpack(buffer, msg) 36 | return 37 | } 38 | 39 | func Unpack(buffer []byte) (msg Message, err error) { 40 | return unpack(buffer, nil) 41 | } 42 | 43 | func Pack(payload interface{}) ([]byte, error) { 44 | return json.Marshal(struct { 45 | Type string 46 | Payload interface{} 47 | }{ 48 | Type: reflect.TypeOf(payload).Elem().Name(), 49 | Payload: payload, 50 | }) 51 | } 52 | -------------------------------------------------------------------------------- /src/ngrok/proto/interface.go: -------------------------------------------------------------------------------- 1 | package proto 2 | 3 | import ( 4 | "ngrok/conn" 5 | ) 6 | 7 | type Protocol interface { 8 | GetName() string 9 | WrapConn(conn.Conn, interface{}) conn.Conn 10 | } 11 | -------------------------------------------------------------------------------- /src/ngrok/proto/tcp.go: -------------------------------------------------------------------------------- 1 | package proto 2 | 3 | import ( 4 | "ngrok/conn" 5 | ) 6 | 7 | type Tcp struct{} 8 | 9 | func NewTcp() *Tcp { 10 | return new(Tcp) 11 | } 12 | 13 | func (h *Tcp) GetName() string { return "tcp" } 14 | 15 | func (h *Tcp) WrapConn(c conn.Conn, ctx interface{}) conn.Conn { 16 | return c 17 | } 18 | -------------------------------------------------------------------------------- /src/ngrok/server/cli.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "flag" 5 | ) 6 | 7 | type Options struct { 8 | httpAddr string 9 | httpsAddr string 10 | tunnelAddr string 11 | domain string 12 | tlsCrt string 13 | tlsKey string 14 | logto string 15 | loglevel string 16 | } 17 | 18 | func parseArgs() *Options { 19 | httpAddr := flag.String("httpAddr", ":80", "HTTP连接端口,禁用空字符串") 20 | httpsAddr := flag.String("httpsAddr", ":443", "HTTPS连接端口,禁用空字符串") 21 | tunnelAddr := flag.String("tunnelAddr", ":4443", "ngrok客户端连接端口,禁用空字符串") 22 | domain := flag.String("domain", "chengang.win", "承载隧道的域名") 23 | tlsCrt := flag.String("tlsCrt", "", "TLS证书文件的路径") 24 | tlsKey := flag.String("tlsKey", "", "TLS密钥文件的路径") 25 | logto := flag.String("log", "ngrok_log.txt", "将日志消息写入此文件。 'stdout'和'none'有特殊意义) 26 | loglevel := flag.String("log-level", "INFO", "要记录的消息级别。 其中之一: DEBUG, INFO, WARNING, ERROR") 27 | flag.Parse() 28 | 29 | return &Options{ 30 | httpAddr: *httpAddr, 31 | httpsAddr: *httpsAddr, 32 | tunnelAddr: *tunnelAddr, 33 | domain: *domain, 34 | tlsCrt: *tlsCrt, 35 | tlsKey: *tlsKey, 36 | logto: *logto, 37 | loglevel: *loglevel, 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/ngrok/server/tls.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "crypto/tls" 5 | "io/ioutil" 6 | "ngrok/server/assets" 7 | ) 8 | 9 | func LoadTLSConfig(crtPath string, keyPath string) (tlsConfig *tls.Config, err error) { 10 | fileOrAsset := func(path string, default_path string) ([]byte, error) { 11 | loadFn := ioutil.ReadFile 12 | if path == "" { 13 | loadFn = assets.Asset 14 | path = default_path 15 | } 16 | 17 | return loadFn(path) 18 | } 19 | 20 | var ( 21 | crt []byte 22 | key []byte 23 | cert tls.Certificate 24 | ) 25 | 26 | if crt, err = fileOrAsset(crtPath, "assets/server/tls/snakeoil.crt"); err != nil { 27 | return 28 | } 29 | 30 | if key, err = fileOrAsset(keyPath, "assets/server/tls/snakeoil.key"); err != nil { 31 | return 32 | } 33 | 34 | if cert, err = tls.X509KeyPair(crt, key); err != nil { 35 | return 36 | } 37 | 38 | tlsConfig = &tls.Config{ 39 | Certificates: []tls.Certificate{cert}, 40 | } 41 | 42 | return 43 | } 44 | -------------------------------------------------------------------------------- /src/ngrok/util/broadcast.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | type Broadcast struct { 4 | listeners []chan interface{} 5 | reg chan (chan interface{}) 6 | unreg chan (chan interface{}) 7 | in chan interface{} 8 | } 9 | 10 | func NewBroadcast() *Broadcast { 11 | b := &Broadcast{ 12 | listeners: make([]chan interface{}, 0), 13 | reg: make(chan (chan interface{})), 14 | unreg: make(chan (chan interface{})), 15 | in: make(chan interface{}), 16 | } 17 | 18 | go func() { 19 | for { 20 | select { 21 | case l := <-b.unreg: 22 | // remove L from b.listeners 23 | // this operation is slow: O(n) but not used frequently 24 | // unlike iterating over listeners 25 | oldListeners := b.listeners 26 | b.listeners = make([]chan interface{}, 0, len(oldListeners)) 27 | for _, oldL := range oldListeners { 28 | if l != oldL { 29 | b.listeners = append(b.listeners, oldL) 30 | } 31 | } 32 | 33 | case l := <-b.reg: 34 | b.listeners = append(b.listeners, l) 35 | 36 | case item := <-b.in: 37 | for _, l := range b.listeners { 38 | l <- item 39 | } 40 | } 41 | } 42 | }() 43 | 44 | return b 45 | } 46 | 47 | func (b *Broadcast) In() chan interface{} { 48 | return b.in 49 | } 50 | 51 | func (b *Broadcast) Reg() chan interface{} { 52 | listener := make(chan interface{}) 53 | b.reg <- listener 54 | return listener 55 | } 56 | 57 | func (b *Broadcast) UnReg(listener chan interface{}) { 58 | b.unreg <- listener 59 | } 60 | -------------------------------------------------------------------------------- /src/ngrok/util/errors.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "fmt" 5 | "runtime" 6 | ) 7 | 8 | const crashMessage = `panic: %v 9 | 10 | %s 11 | 12 | Oh noes! ngrok crashed! 13 | 14 | Please submit the stack trace and any relevant information to: 15 | github.com/inconshreveable/ngrok/issues` 16 | 17 | func MakePanicTrace(err interface{}) string { 18 | stackBuf := make([]byte, 4096) 19 | n := runtime.Stack(stackBuf, false) 20 | return fmt.Sprintf(crashMessage, err, stackBuf[:n]) 21 | } 22 | 23 | // Runs the given function and converts any panic encountered while doing so 24 | // into an error. Useful for sending to channels that will close 25 | func PanicToError(fn func()) (err error) { 26 | defer func() { 27 | if r := recover(); r != nil { 28 | err = fmt.Errorf("Panic: %v", r) 29 | } 30 | }() 31 | fn() 32 | return 33 | } 34 | -------------------------------------------------------------------------------- /src/ngrok/util/id.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "crypto/rand" 5 | "encoding/binary" 6 | "fmt" 7 | mrand "math/rand" 8 | ) 9 | 10 | func RandomSeed() (seed int64, err error) { 11 | err = binary.Read(rand.Reader, binary.LittleEndian, &seed) 12 | return 13 | } 14 | 15 | // creates a random identifier of the specified length 16 | func RandId(idlen int) string { 17 | b := make([]byte, idlen) 18 | var randVal uint32 19 | for i := 0; i < idlen; i++ { 20 | byteIdx := i % 4 21 | if byteIdx == 0 { 22 | randVal = mrand.Uint32() 23 | } 24 | b[i] = byte((randVal >> (8 * uint(byteIdx))) & 0xFF) 25 | } 26 | return fmt.Sprintf("%x", b) 27 | } 28 | 29 | // like RandId, but uses a crypto/rand for secure random identifiers 30 | func SecureRandId(idlen int) (id string, err error) { 31 | b := make([]byte, idlen) 32 | n, err := rand.Read(b) 33 | 34 | if n != idlen { 35 | err = fmt.Errorf("Only generated %d random bytes, %d requested", n, idlen) 36 | return 37 | } 38 | 39 | if err != nil { 40 | return 41 | } 42 | 43 | id = fmt.Sprintf("%x", b) 44 | return 45 | } 46 | 47 | func SecureRandIdOrPanic(idlen int) string { 48 | id, err := SecureRandId(idlen) 49 | if err != nil { 50 | panic(err) 51 | } 52 | return id 53 | } 54 | -------------------------------------------------------------------------------- /src/ngrok/util/ring.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "container/list" 5 | "sync" 6 | ) 7 | 8 | type Ring struct { 9 | sync.Mutex 10 | *list.List 11 | capacity int 12 | } 13 | 14 | func NewRing(capacity int) *Ring { 15 | return &Ring{capacity: capacity, List: list.New()} 16 | } 17 | 18 | func (r *Ring) Add(item interface{}) interface{} { 19 | r.Lock() 20 | defer r.Unlock() 21 | 22 | // add new item 23 | r.PushFront(item) 24 | 25 | // remove old item if at capacity 26 | var old interface{} 27 | if r.Len() >= r.capacity { 28 | old = r.Remove(r.Back()) 29 | } 30 | 31 | return old 32 | } 33 | 34 | func (r *Ring) Slice() []interface{} { 35 | r.Lock() 36 | defer r.Unlock() 37 | 38 | i := 0 39 | items := make([]interface{}, r.Len()) 40 | for e := r.Front(); e != nil; e = e.Next() { 41 | items[i] = e.Value 42 | i++ 43 | } 44 | 45 | return items 46 | } 47 | -------------------------------------------------------------------------------- /src/ngrok/util/shutdown.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "sync" 5 | ) 6 | 7 | // A small utility class for managing controlled shutdowns 8 | type Shutdown struct { 9 | sync.Mutex 10 | inProgress bool 11 | begin chan int // closed when the shutdown begins 12 | complete chan int // closed when the shutdown completes 13 | } 14 | 15 | func NewShutdown() *Shutdown { 16 | return &Shutdown{ 17 | begin: make(chan int), 18 | complete: make(chan int), 19 | } 20 | } 21 | 22 | func (s *Shutdown) Begin() { 23 | s.Lock() 24 | defer s.Unlock() 25 | if s.inProgress == true { 26 | return 27 | } else { 28 | s.inProgress = true 29 | close(s.begin) 30 | } 31 | } 32 | 33 | func (s *Shutdown) WaitBegin() { 34 | <-s.begin 35 | } 36 | 37 | func (s *Shutdown) Complete() { 38 | close(s.complete) 39 | } 40 | 41 | func (s *Shutdown) WaitComplete() { 42 | <-s.complete 43 | } 44 | -------------------------------------------------------------------------------- /src/ngrok/version/version.go: -------------------------------------------------------------------------------- 1 | package version 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | const ( 8 | Proto = "2" 9 | Major = "1" 10 | Minor = "8" 11 | ) 12 | 13 | func MajorMinor() string { 14 | return fmt.Sprintf("%s.%s", Major, Minor) 15 | } 16 | 17 | func Full() string { 18 | return fmt.Sprintf("%s-%s.%s", Proto, Major, Minor) 19 | } 20 | 21 | func Compat(client string, server string) bool { 22 | return client == server 23 | } 24 | --------------------------------------------------------------------------------