GOTTY使用總結(jié)

1.安裝GoTTy

Go環(huán)境

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安裝是否正常工作,寫一個(gè)小的Go Hello World程序

$ mkdir -p ~/go_projects/src/hello 然后用你喜歡的編輯器來創(chuàng)建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安裝和運(yùn)行它的程序:

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

$ $GOBIN/hello

GoTTY

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

下載對應(yīng)版本直接運(yùn)行

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

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容