#warp #xterm #personal-project #host-port

bin+lib web-terminal

使用 WebSocket 的 Rust 应用,用于启动 Web 终端。

1 个不稳定版本

0.1.0 2024年6月1日

#116 in WebSocket

Apache-2.0

33KB
257

WEB 终端

使用 WebSocket 的 Rust 应用,用于启动 Web 终端。

使用 cargo 运行

cargo run -- --host 0.0.0.0 --port 3032

构建

cargo build --release

部署

帮助命令

cargo run -- --help

Parameters when running the web terminal app.

Usage: web-terminal [OPTIONS]

Options:
      --host <HOST>
          The ip of the server.
          
          [default: 127.0.0.1]

      --port <PORT>
          The port of the server.
          
          [default: 3030]

      --heartbeat-interval <HEARTBEAT_INTERVAL>
          The heartbeat interval.
          
          [default: 30]

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

使用 cargo 运行

cargo run -- --host 0.0.0.0 --port 3032

使用编译后的二进制文件运行。

执行二进制文件

./target/release/web-terminal --host 0.0.0.0 --port 3032

测试

您可以使用提供的客户端应用模拟 Web 终端。

  1. 执行 docker-compose 以设置前端。
docker-compose -f docker-compose up -d
  1. 查找前端容器。
docker ps 

Example:
CONTAINER ID   IMAGE         COMMAND                  CREATED        STATUS        PORTS                  NAMES
85a2f260ffda   node:latest   "docker-entrypoint.s…"   20 hours ago   Up 20 hours   0.0.0.0:7060->80/tcp   web-terminal-termi-1
  1. 获取容器 ID
docker exec -it e6b8bedb2193 "bash"
  1. 运行开发服务器。
yarn dev
  1. 打开浏览器,然后访问
https://127.0.0.1:7060

开发者

JP Mateo ([email protected])

依赖项

~14–25MB
~368K SLoC