$ git clone https://github.com/clamtestbbs/us2ws
# apt install -y golang upx socat
a. set go path
i. If you are using Linux platform ( Debian , Ubuntu , CentOS , RHEL ...) :
$ cd us2ws && export GOPATH=$PWD
(use go env
to check)
ii. If you are using BSD platform ( FreeBSD , OpenBSD , Apple ...) :
$ cd us2ws && setenv GOPATH $PWD
(use go env
to check)
b. "go get" websocket repo in github
$ go get github.com/gorilla/websocket
$ go run main.go -h
Usage of ... :
-r int
Assign a random number to distinguish unix domain sockets (default 9487)
-u string
Assign the websockets endpoint. Starting with ws:// or wss://
For example:
$ go run main.go -r 9487 -u wss://ws.ptt.cc/bbs &
to add /tmp/telnetBYwebsocket.9487.sock
https://serverfault.com/questions/517906
For example:
$ socat TCP-LISTEN:12345 UNIX-CONNECT:/tmp/telnetBYwebsocket.9487.sock &
$ telnet 0 <forwarded-port>
For example:
$ telnet 0 12345
$ telnet -8 -u /tmp/telnetBYwebsocket.<NUMBER>.sock
For example:
$ telnet -8 -u /tmp/telnetBYwebsocket.9487.sock