为何青睐 rustdesk
远程功能刚需,parsec 近期总是延迟莫名爆表,故而转投 rustdesk 。在搭建了自己的信号、中继服务器和第三方 api 以后,无比心水官方付费的自定义客户端功能,因此采用了本篇的廉价 0 元方案。
前期准备
- 会使用 git 远程连接 github 仓库,并会简单的 git push 指令已搭建好 rustdesk 自托管服务器和 api 服务器本指南适用于目前最新的 1.4.0 版本
操作指南
- fork 或者 import rustdesk/hbb_common 和 rustdesk/rustdesk 这两个项目(建议 import 并设置不公开,因为后面如果需要固定被控端密码的话,你的密码会以明文的形式公开在自己名下的仓库中)针对 hbb_common 仓库的操作git clone 你自己名下的 hbb_common 仓库到本地,在 src/config.rs 中修改 RSENDZVOUS_SERVER 字段为自己的服务器地址,修改 RS_PUB_KEY 字段为自己的服务器 key (简单的替换即可)
还是 src/config.rs 文件,找到 HARD_SETTINGS 字段将那一整行替换为如下代码块:
pub static ref HARD_SETTINGS: RwLock<HashMap<String, String>> = { let mut map = HashMap::new(); map.insert("password".to_string(), "<明文填写你要固定的被控端密码>".to_string()); RwLock::new(map) };
最后,将以上所有调整 push 到 github 仓库( hbb_common 仓库的相关改动直接在网页修改也可以)
- 针对 rustdesk 仓库的操作git clone 你自己名下的 rustdesk 仓库到本地,首先删除官方源码中的引用 hbb_common 子模块(直接在本地删除 libs/hbb_common 那个空文件夹即可)cd 到本地 rustdesk 仓库根目录,添加上面自己修改过的 hbb_common 子模块
git submodule add https://github.com/<你自己的 github 用户名>/hbb_common libs/hbb_common
替换过子模块后 push ,再输一次如下指令强制更新子模块
git submodule sync
查找到 rustdesk 仓库中 src/common.rs 文件的 get_custom_rendezvous_server 这个函数,下面有个官方的 api 地址,将其替换成自己的,最后 push (这一步其实也可以直接在网页操作)
对两个仓库所作的修改完毕,务必记得一定要 push 到 github 上自己名下的仓库!!!
- 使用 github action 在线编译在<自己名下的>/rustdesk 项目,找到 Settings -> Actions -> General ,确保勾选 Allow all actions and reusable workflows 和 Read and write permissions 两项
回到本地 rustdesk 仓库,创建一个 tag
git tag -a <自己拟一个 tag 名> -m "这是我的自定义客户端 tag"
在<自己名下的>/rustdesk 项目,找到 Actions ,点击"i understand xxxx"那个按钮
回到本地 rustdesk 仓库,输入
git push --tags
将刚才新创建的标签同步到远程仓库
在 actions 页找到 Full Flutter CI ,选择"run workflow"并点开 branch 下拉,选择刚才创建的标签
然后,愉快的开始 run ,等跑完去 releases 就能下到自己的专属 rustdesk 客户端啦~