├── showcase_linux_armv5.gif ├── showcase_linux_x86-64.gif ├── go.mod ├── .gitignore ├── package.json ├── go.sum ├── README.md ├── index.html ├── LICENSE └── main.go /showcase_linux_armv5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaisuXu/web-terminal-demo-with-golang-and-xterm/HEAD/showcase_linux_armv5.gif -------------------------------------------------------------------------------- /showcase_linux_x86-64.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NaisuXu/web-terminal-demo-with-golang-and-xterm/HEAD/showcase_linux_x86-64.gif -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module webterminal 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/creack/pty v1.1.18 7 | github.com/olahol/melody v1.1.3 8 | ) 9 | 10 | require github.com/gorilla/websocket v1.5.0 // indirect 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/* 2 | !/node_modules/xterm 3 | /node_modules/xterm/* 4 | !/node_modules/xterm/css 5 | /node_modules/xterm/css/* 6 | !/node_modules/xterm/css/xterm.css 7 | !/node_modules/xterm/lib 8 | /node_modules/xterm/lib/* 9 | !/node_modules/xterm/lib/xterm.js 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "web-terminal-demo-with-golang-and-xterm", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "xterm": "^5.1.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= 2 | github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= 3 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 4 | github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= 5 | github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= 6 | github.com/olahol/melody v1.1.3 h1:7Eo8egmejdrhdCM64uPgWj7NLSAVKl7Iv9NloFlzb60= 7 | github.com/olahol/melody v1.1.3/go.mod h1:GgkTl6Y7yWj/HtfD48Q5vLKPVoZOH+Qqgfa7CvJgJM4= 8 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 9 | github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= 10 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WebTerminal demo with Golang and Xterm.js 2 | 3 | ## 简介 / Brief 4 | 5 | 这是一个 `WebTerminal` 的项目演示,使用 `Golang` 和 `Xterm.js` 实现。This is a demo for `WebTerminal`, based on `Golang` and `Xterm. js` . 6 | 7 | 8 | 9 | ## 用法 / Usage 10 | 11 | 下载可执行文件到服务器设备中,然后启动服务。Download the executable file to the server device, and then start the service. 12 | 13 | ```shell 14 | chmod +x webterminal_xxxx 15 | ./webterminal_xxxx 16 | ``` 17 | 18 | 在客户端浏览器中打开 `http://server_ip_address:22333/` 。Navigate your browser to `http://server_ip_address:22333/` . 19 | 20 | 21 | 22 | ## 演示 / Showcase 23 | 24 | **linux_x86-64 (Ununtu 22.04 AMD Ryzen 5 PRO 4650U):** 25 | 26 |  27 | 28 | 29 | 30 | **linux_armv5 (NUC980 Linux buildroot 5.10.103+ armv5tejl GNU/Linux):** 31 | 32 |  33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 |