github actions云编译
On your fork you just created go to “Settings → Secrets and variables → Actions”.
Click “New repository secret”, for the name put RENDEZVOUS_SERVER, for the secret put your servers name/ip address.
Click “Add secret”.
Click “New repository secret”, for the name put RS_PUB_KEY, for the secret put your servers public key.
Click “Add secret”.
克隆Rustdesk的源码
git clone https://github.com/rustdesk/rustdesk
cd rustdesk
安装依赖
curl --proto '=https' --tlsv1.2 -sSf [https://sh.rustup.rs](https://sh.rustup.rs/) | sh
#选1默认安装
apt-get update
apt-get install -y binutils-mingw-w64 build-essential gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 cmake libssl-dev mingw-w64
#安装windows编译依赖
rustup target add x86_64-pc-windows-msvc
#安装x86_64-pc-windows-msv编译工具
rustup target add x86_64-pc-windows-gnu
rustup toolchain install stable-x86_64-pc-windows-msvc
#安装windows编译工具链
#读取环境变量
source $HOME/.cargo/env
source $HOME/.config/fish/conf.d/rustup.fish
export CC=x86_64-w64-mingw32-gcc
export CXX=x86_64-w64-mingw32-g++
export AR=x86_64-w64-mingw32-ar
export RANLIB=x86_64-w64-mingw32-ranlib
export PKG_CONFIG_PATH=/usr/x86_64-w64-mingw32/lib/pkgconfig
export PKG_CONFIG_LIBDIR=/usr/x86_64-w64-mingw32/lib
修改服务端IP端口和key
libs/hbb_common/src/config.rs
中
pub const RENDEZVOUS_SERVERS: &[&str] = &["服务器ip"];
pub const PUBLIC_RS_PUB_KEY: &str = "key";
pub const RS_PUB_KEY: &str = match option_env!("RS_PUB_KEY") {
Some(key) if !key.is_empty() => key,
_ => PUBLIC_RS_PUB_KEY,
};
pub const RENDEZVOUS_PORT: i32 = 21116;
pub const RELAY_PORT: i32 = 21117;
编译命令
windows
cargo install cargo-wix
cargo build --release --target x86_64-pc-windows-msvc
#或使用 cargo build --release --target x86_64-pc-windows-gnu
#手工配置环境变量
linux
cargo build --release --target x86_64-unknown-linux-gnu
自建API保存连接信息
客户端编译带 API 服务器
上期视频已经讲解了客户端编译时把服务端信息和 key 编译进客户端,这期视频就不重复讲解,只讲解再把 API 服务器编译进客户端
路径:src/common.rs
把里面的 https://admin.rustdesk.com 地址修改为我们服务器 API 的地址即可
本地搭建的 API 服务端有 7000 的端口,需要加上
欢迎指出任何有错误或不够清晰的表达,可以在下面评论区评论。