- 一个端口按路径分发:/cnchess /cngo /cs 进程型,/alonelyroad /myword 静态目录 - 进程型首次访问以动态端口拉起子进程,就绪探测后转发;空闲 600s 且无 WS 连接才回收 - WebSocket 走原始 TCP 隧道(握手转发 + 101 透传 + 双向对拷,任一方向 EOF 即拆连) - 文本响应就地重写根绝对路径(href/src/fetch/url(/ 与 location.host}/ws),游戏源码零改动 - 入口页只显示状态与进入入口,不提供管理按钮;网关/运维接口为 /api/* - 配置 games.json 磁盘优先、内嵌兜底,改完刷新即生效
35 lines
740 B
TOML
35 lines
740 B
TOML
[package]
|
|
name = "game-center"
|
|
version = "1.0.0"
|
|
edition = "2021"
|
|
description = "游戏中心:1818 单端口、按路径分发、按需拉起 / 空闲释放的统一代理"
|
|
license = "MIT"
|
|
|
|
[[bin]]
|
|
name = "game-center"
|
|
path = "src/main.rs"
|
|
|
|
[dependencies]
|
|
axum = "0.8"
|
|
tokio = { version = "1", features = [
|
|
"rt-multi-thread",
|
|
"macros",
|
|
"net",
|
|
"time",
|
|
"sync",
|
|
"io-util",
|
|
"fs",
|
|
"process",
|
|
"signal",
|
|
] }
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
http-body-util = "0.1"
|
|
hyper = { version = "1", features = ["client", "http1", "server"] }
|
|
hyper-util = { version = "0.1", features = ["client-legacy", "http1", "tokio"] }
|
|
|
|
[profile.release]
|
|
lto = "thin"
|
|
codegen-units = 1
|
|
strip = true
|