RustDesk Server 是一个开源的远程桌面解决方案,允许用户自托管自己的远程桌面服务器。该项目是免费且开源的,支持多种平台和环境。RustDesk Server 提供了 ID/Rendezvous 服务器和 Relay 服务器,以及一些 CLI 工具,方便用户进行远程管理和控制。
安装依赖
首先,确保你的系统已经安装了 cargo 和 rust。
克隆项目
克隆 RustDesk Server 项目到本地:
git clone https://github.com/rustdesk/rustdesk-server.git
cd rustdesk-server
构建项目
使用 cargo 构建项目:
cargo build --release
构建完成后,会在 target/release 目录下生成三个可执行文件:
hbbs.exe - RustDesk ID/Rendezvous 服务器
hbbr.exe - RustDesk Relay 服务器
rustdesk-utils.exe - RustDesk CLI 工具
启动服务器
运行以下命令启动服务器:
./target/release/hbbs
./target/release/hbbr
编译log:
E:\1github_pro\rustdesk\rustdesk-server>cargo build --release
Updating crates.io index
Updating git repository `https://github.com/open-trade/confy`
Updating git repository `https://github.com/open-trade/tokio-socks`
Updating git repository `https://github.com/open-trade/async-speed-limit`
Downloaded cfg-if v1.0.0
Downloaded instant v0.1.12
...
Downloaded rand v0.8.5
warning: spurious network error (3 tries remaining): [28] Timeout was reached (download of `regex-syntax v0.6.25` failed to transfer more than 10 bytes in 30s)
warning: spurious network error (3 tries remaining): [28] Timeout was reached (failed to download any data for `regex v1.5.5` within 30s)
Downloaded tower v0.4.12
...
Downloaded regex-syntax v0.6.25
warning: spurious network error (3 tries remaining): [92] Stream error in the HTTP/2 framing layer (HTTP/2 stream 61 was not closed cleanly: PROTOCOL_ERROR (err 1))
Downloaded tokio v1.20.0
Downloaded windows_x86_64_msvc v0.36.1
Downloaded windows_x86_64_msvc v0.48.0
Downloaded zstd-sys v1.6.2+zstd.1.5.1
warning: spurious network error (3 tries remaining): [92] Stream error in the HTTP/2 framing layer (HTTP/2 stream 19 was not closed cleanly: PROTOCOL_ERROR (err 1))
warning: spurious network error (3 tries remaining): [92] Stream error in the HTTP/2 framing layer (HTTP/2 stream 177 was not closed cleanly: PROTOCOL_ERROR (err 1))
Downloaded winapi v0.3.9
Downloaded sodiumoxide v0.2.7
...
Compiling hbb_common v0.1.0 (E:\1github_pro\rustdesk\rustdesk-server\libs\hbb_common)
Compiling axum v0.5.5
Compiling sqlx-macros v0.6.0
Compiling sqlx v0.6.0
Compiling hbbs v1.1.11-1 (E:\1github_pro\rustdesk\rustdesk-server)
warning: fields `id`, `user`, and `status` are never read
--> src\database.rs:41:9
|
39 | pub struct Peer {
| ---- fields in this struct
40 | pub guid: Vec<u8>,
41 | pub id: String,
| ^^
...
44 | pub user: Option<Vec<u8>>,
| ^^^^
45 | pub info: String,
46 | pub status: Option<i64>,
| ^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: `hbbs` (lib) generated 1 warning
Finished `release` profile [optimized] target(s) in 26m 56s
warning: the following packages contain code that will be rejected by a future version of Rust: nom v5.1.2
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`
E:\1github_pro\rustdesk\rustdesk-server>