Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于PC端链接超时或者链接不上的问题以及解决方案 | About the problem of timeout or connection failure on PC and how to solve it #92

Open
lejianwen opened this issue Dec 30, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@lejianwen
Copy link
Owner

lejianwen commented Dec 30, 2024

因为server不会发起客户端的secure_tcp请求,所以客户端超时。
相关代码代码位置在https://github.com/rustdesk/rustdesk/blob/master/src/client.rs

    if !key.is_empty() && !token.is_empty() {
    // mainly for the security of token
    allow_err!(secure_tcp(&mut socket, key).await);
    }

可看到当keytoken都不为空时,会调用secure_tcp,但是server端不会响应,所以客户端超时
但不登录API账户,则不会有token,所以非登录状态下不会超时,但非登录状态下还是可以加密链接的,所以可以将secure_tcp直接返回
secure_tcp 代码位置在 https://github.com/rustdesk/rustdesk/blob/master/src/common.rs#L1234

pub async fn secure_tcp(conn: &mut FramedStream, key: &str) -> ResultType<()>
...

解决方案

  1. server端指定key。
hbbs -r <relay-server-ip[:port]> -k <key>
hbbr -k <key>

比如

hbbs -r <relay-server-ip[:port]> -k abc1234567
hbbr -k abc1234567
  1. server端使用系统生成的key,或者自定义的密钥对,但如果client已登录,链接时容易超时或者链接不上,可以退出登录后再链接就可以了,webclient可以不用退出登录

  2. server端使用系统生成的key,或者自定义的密钥对,fork官方客户端的代码将secure_tcp修改成直接返回,然后通过Github Actions编译,下载编译后的客户端。
    参考官方文档

  3. 使用我fork的客户端,已经修改了secure_tcp,可以直接下载使用,下载地址

  4. 使用其他fork的server

对链接加密要求不高的可以使用1,对链接加密要求高的可以使用345

@lejianwen lejianwen added the documentation Improvements or additions to documentation label Dec 30, 2024
@lejianwen lejianwen pinned this issue Dec 30, 2024
@lejianwen lejianwen changed the title 关于PC端链接超时或者链接不上的问题以及解决方案 关于PC端链接超时或者链接不上的问题以及解决方案 | About the problem of timeout or connection failure on PC and how to solve it Dec 30, 2024
lejianwen added a commit that referenced this issue Dec 30, 2024
Connection timeout issues move to #92
lejianwen added a commit that referenced this issue Dec 30, 2024
Connection timeout issues move to #92
lejianwen added a commit that referenced this issue Dec 30, 2024
Connection timeout issues move to #92
@nizongdai
Copy link

这个问题是不是只有等官方新版本的server端更新修复才能解决?

@lejianwen
Copy link
Owner Author

这个问题是不是只有等官方新版本的server端更新修复才能解决?

官方应该不会管这个,这个只有登录了账号才会遇到这个问题,而api是pro才有的功能,开源版不会遇到这个问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants