GOTTY使用总结

1.安装GoTTy

Go环境

wget -chttps://storage.googleapis.com/golang/go1.7.3.linux-amd64.tar.gz

sudo tar -C /usr/local -xvzf go1.7.3.linux-amd64.tar.gz

mkdir -p ~/go_projects/{bin,src,pkg}

mkdir -p /root/go

cd ~/go_projects

ls

vi ~/.bash_profile

export  PATH=$PATH:/usr/local/go/bin

export GOPATH="$HOME/go_projects"

export PATH=$PATH:$GOPATH

export GOBIN="$GOPATH/bin"

export PATH=$PATH:GOBIN

unset GOROOT

source ~/.bash_profile

go version

go env

测试Go安装是否正常工作,写一个小的Go Hello World程序

$ mkdir -p ~/go_projects/src/hello 然后用你喜欢的编辑器来创建hello.go文件:

$ vi ~/go_projects/src/hello/hello.go 在文件中添加以下行,保存并退出:

package main

import "fmt"

func main() {

fmt.Printf("Hello, you have successfully installed GoLang in Linux\n")

}

编译上面使用Go安装和运行它的程序:

$ go install $GOPATH/src/hello/hello.go

$ $GOBIN/hello

GoTTY

go getgithub.com/yudai/gotty安装不了,什么鬼。。。

下载对应版本直接运行

brew install yudai/gotty/gotty

gotty -p 8000 --reconnect --reconnect-time "2" --random-url tmux new -A -s gotty

gotty -p 8000 -w top

用法说明

--address value, -a value     IP address to listen (default: "0.0.0.0") [$GOTTY_ADDRESS]

--port value, -p value        Port number to liten (default: "8080") [$GOTTY_PORT]

--permit-write, -w            Permit clients to write to the TTY (BE CAREFUL) [$GOTTY_PERMIT_WRITE]

--credential value, -c value  Credential for Basic Authentication (ex: user:pass, default disabled) [$GOTTY_CREDENTIAL]

--random-url, -r              Add a random string to the URL [$GOTTY_RANDOM_URL]

--random-url-length value     Random URL length (default: 8) [$GOTTY_RANDOM_URL_LENGTH]

--tls, -t                     Enable TLS/SSL [$GOTTY_TLS]

--tls-crt value               TLS/SSL certificate file path (default: "~/.gotty.crt") [$GOTTY_TLS_CRT]

--tls-key value               TLS/SSL key file path (default: "~/.gotty.key") [$GOTTY_TLS_KEY]

--tls-ca-crt value            TLS/SSL CA certificate file for client certifications (default: "~/.gotty.ca.crt") [$GOTTY_TLS_CA_CRT]

--index value                 Custom index.html file [$GOTTY_INDEX]

--title-format value          Title format of browser window (default: "{{ .command }}@{{ .hostname }}") [$GOTTY_TITLE_FORMAT]

--reconnect                   Enable reconnection [$GOTTY_RECONNECT]

--reconnect-time value        Time to reconnect (default: 10) [$GOTTY_RECONNECT_TIME]

--max-connection value        Maximum connection to gotty (default: 0) [$GOTTY_MAX_CONNECTION]

--once                        Accept only one client and exit on disconnection [$GOTTY_ONCE]

--timeout value               Timeout seconds for waiting a client(0 to disable) (default: 0) [$GOTTY_TIMEOUT]

--permit-arguments            Permit clients to send command line arguments in URL (e.g.http://example.com:8080/?arg=AAA&arg=BBB) [$GOTTY_PERMIT_ARGUMENTS]

--width value                 Static width of the screen, 0(default) means dynamically resize (default: 0) [$GOTTY_WIDTH]

--height value                Static height of the screen, 0(default) means dynamically resize (default: 0) [$GOTTY_HEIGHT]

--ws-origin value             A regular expression that matches origin URLs to be accepted by WebSocket. No cross origin requests are acceptable by default [$GOTTY_WS_ORIGIN]

--term value                  Terminal name to use on the browser, one of xterm or hterm. (default: "xterm") [$GOTTY_TERM]

--close-signal value          Signal sent to the command process when gotty close it (default: SIGHUP) (default: 1) [$GOTTY_CLOSE_SIGNAL]

--close-timeout value         Time in seconds to force kill process after client is disconnected (default: -1) (default: -1) [$GOTTY_CLOSE_TIMEOUT]

--config value                Config file path (default: "~/.gotty") [$GOTTY_CONFIG]

--version, -v                 print the version

你可能感兴趣的:(GOTTY使用总结)