Rustdesk手动编译客户端并自定义服务器在Windows系统 | 使用NSIS并打包集成

· Special

环境配置

安装LLVM

  1. 下载LLVM

    https://releases.llvm.org/download.html
  2. 安装LLVM

安装Vcpkg

  1. git clone https://github.com/microsoft/vcpkg
    ./vcpkg/bootstrap-vcpkg.bat
  2. 添加到系统路径(比如我所在的是"D:\vcpkg\vcpkg")
    ![](https://images.asuna.one/rustdesk/3.png)

安装Vcpkg所需库

vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static aom:x64-windows-static

克隆Rustdesk项目并编译

  1. 拉取项目并编译
    git clone https://github.com/rustdesk/rustdesk
    cd rustdesk
    cargo run
  2. 将[sciter.dll](curl -O https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll
    )放入已经生成的 'target/debug' 目录下,并将rustdesk根目录下的 '/src'文件夹一起放入'target/debug'

获取部署完成的服务器的地址和密钥(略)

服务器部署注意
  1. 服务器部署hbbr以及bbbs
  2. 放行防火墙端口:
  3. TCP(21115, 21116, 21117, 21118, 21119)
  4. UDP(21116)
  5. 默认情况下,hbbs 监听21115(tcp), 21116(tcp/udp), 21118(tcp),hbbr 监听21117(tcp), 21119(tcp)。务必在防火墙开启这几个端口, 请注意21116同时要开启TCP和UDP。其中21115是hbbs用作NAT类型测试,21116/UDP是hbbs用作ID注册与心跳服务,21116/TCP是hbbs用作TCP打洞与连接服务,21117是hbbr用作中继服务, 21118和21119是为了支持网页客户端。如果您不需要网页客户端(21118,21119)支持,对应端口可以不开。

修改内置服务地址

  1. 找到'/libs/hbb_common/src/config.rs',修改

    101 pub const RENDEZVOUS_SERVERS: &[&str] = &["1.1.1.1"];
    102 pub const RS_PUB_KEY: &str = "AAIIFD+8OmsEgr4xlfOnk7SAJkvAWn3yDkn2F6yK7v0=";

开始编译

cargo run

至此编译已经完成,结果可在"\target\release"看到,后续可利用NSIS工具编译成自动安装程序。

程序打包

获取NSIS

'''

Outfile "rustdesk-setup.exe"
InstallDir "$PROGRAMFILES\RustDesk"
Page directory
Page instfiles

Section ""
SetOutPath $INSTDIR
File "target\release\rustdesk.exe"
File "Z:\ru\rustdesk\target\release\sciter.dll"

CreateShortCut "$DESKTOP\RustDesk.lnk" "$INSTDIR\rustdesk.exe"

SetOutPath "$INSTDIR\src"
File /r "Z:\ru\rustdesk\target\release\src*.*"

SectionEnd

'''

成功后运行Rustdesk-setup.msi文件,安装即可选择释放文件。

windows · Rustdesk · Rust


评论