Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支援 bahamut BBS websocket #44

Open
ElvisChiang opened this issue Dec 15, 2022 · 2 comments
Open

支援 bahamut BBS websocket #44

ElvisChiang opened this issue Dec 15, 2022 · 2 comments

Comments

@ElvisChiang
Copy link

via https://gist.github.com/ShikChen/b6664174d8ed067bb610dba0ca805335

安裝 websocat

修改 proxy.sh

懶得寫判斷了,大概意思是...

--- proxy.sh.bak        2022-12-15 14:40:45.000000000 +0800
+++ proxy.sh    2022-12-15 14:58:12.000000000 +0800
@@ -1,7 +1,11 @@
 #!/usr/bin/env bash
 echo "Connecting to BBS via Websockets..."
 BASEDIR=$(dirname "$0")
-echo "$BASEDIR/usock2wsock" -u $1 -r $2
-"$BASEDIR/usock2wsock" -u $1 -r $2 &
+killall websocat > /dev/null 2>&1
+/usr/local/bin/websocat --oneshot --binary \
+    --ping-interval=10 \
+    --origin=https://term.gamer.com.tw \
+    tcp-l:127.0.0.1:1337 \
+    wss://term.gamer.com.tw/bbs &
 sleep 2
-"$BASEDIR/telnet" -8 -u /tmp/telnetBYwebsocket.$2.sock
+"$BASEDIR/telnet" -8 localhost 1337

1337 是隨意指定的 port

@ElvisChiang
Copy link
Author

不過中文輸入有問題,不知道怎解決 XD

@ElvisChiang
Copy link
Author

ElvisChiang commented Dec 15, 2022

啊,不對 我想歪了

https://github.com/clyang/Go-UnixSocket2WebSocket/blob/a496560930c6e25ac7b70814946259b6c7196c88/main.go#L76

    c, _, err := dialer.Dial(*ws_url, http.Header{"Origin": {"app://welly"}})

修改成

    c, _, err := dialer.Dial(*ws_url, http.Header{"Origin": {"https://term.gamer.com.tw"}})

重 compile usock2wsock 然後替換掉就好了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant