【开源】go实现Rustdesk Api及后台管理
本帖最后由 bulesky 于 2024-11-21 09:37 编辑自己用GO实现了一个Rustdesk api,并带上了管理后台和web client
【20241119】新增了Web Client V2 Preview
【20241009】增加分享功能,可以分享给游客
功能截图
1.登录,实现了oauth和直接web后台授权登录
2.地址簿
3.群组
后台
登录默认用户名密码是admin admin,第一次使用记得即时修改密码
1.群组配置,创建的群组类型分为普通和共享
2.oauth
3.webclient,直接点击地址簿中的按钮打开webclient
WebClient
1.自动填写了api服务器,可以直接登录,登录后会同步ID服务器和KEY,会同步地址簿
2.如果后台已登录,webclient就是登录状态
文档,使用 Swag 生成 API 文档,方便开发和使用 API
1. 后台文档 `<youer server>/admin/swagger/index.html`
2. PC端文档 `<youer server>/swagger/index.html`
更多相关信息可以查看源码和readme
源码地址
github地址https://github.com/lejianwen/rustdesk-api
厉害了,学习一下 本帖最后由 bulesky 于 2024-9-21 13:54 编辑
lx0113 发表于 2024-9-20 23:15
大佬,使用的官方rustdesk/rustdesk-server-s6:latest,docker-compose搭建,该如何自定义key
rustdesk-server-s6是由S6管理服务,你可以将run脚本挂载进去,我看容器中的run
```
#!/command/with-contenv sh
cd /data
PARAMS=
[ "${ENCRYPTED_ONLY}" = "1" ] && PARAMS="-k _"
/usr/bin/hbbr $PARAMS
/data # exit
```
```
#!/command/with-contenv sh
sleep 2
cd /data
PARAMS=
[ "${ENCRYPTED_ONLY}" = "1" ] && PARAMS="-k _"
/usr/bin/hbbs -r $RELAY $PARAMS
```
可以改写下
mkdir ./hbbr
touch ./hbbr/run
然后写入./hbbr/run
```
#!/command/with-contenv sh
cd /data
PARAMS=
[ "${ENCRYPTED_ONLY}" = "1" ] && PARAMS="-k ${KEY}"
/usr/bin/hbbr $PARAMS
```
同样hbbs
mkdir ./hbbs
touch ./hbbs/run
然后写入./hbbs/run
```
#!/command/with-contenv sh
sleep 2
cd /data
PARAMS=
[ "${ENCRYPTED_ONLY}" = "1" ] && PARAMS="-k ${KEY}"
/usr/bin/hbbs -r $RELAY $PARAMS
```
然后compose配置中挂载
```
environment:
- "RELAY=192.168.1.66:21117"
- "ENCRYPTED_ONLY=1"
- KEY=abc123456789
volumes:
- ./data:/data
- ./hbbr/run:/etc/s6-overlay/s6-rc.d/hbbr/run
- ./hbbs/run:/etc/s6-overlay/s6-rc.d/hbbs/run
```
然后启动就可以了
结果
厉害 看看学习一下 看看怎么样 之前测试过 会导致连接速度很慢..连接的时候转圈2030秒之后才连得上..现在有改善么 .. 想问下,如何向被控端发送文字(比如在记事本中) 厉害,大哥,下了学习一下 这个swagger版本有点低 uzcool 发表于 2024-9-19 18:15
之前测试过 会导致连接速度很慢..连接的时候转圈2030秒之后才连得上..现在有改善么 ..
这个只能通过自定义KEY来避免
我看管饭源码因为在hbbr和hbbs的版本落后导致的,但是客户端代码更新,比如https://github.com/rustdesk/rustdesk/blob/master/libs/hbb_common/protos/rendezvous.proto
中
message RendezvousMessage {
oneof union {
RegisterPeer register_peer = 6;
RegisterPeerResponse register_peer_response = 7;
PunchHoleRequest punch_hole_request = 8;
PunchHole punch_hole = 9;
PunchHoleSent punch_hole_sent = 10;
PunchHoleResponse punch_hole_response = 11;
FetchLocalAddr fetch_local_addr = 12;
LocalAddr local_addr = 13;
ConfigUpdate configure_update = 14;
RegisterPk register_pk = 15;
RegisterPkResponse register_pk_response = 16;
SoftwareUpdate software_update = 17;
RequestRelay request_relay = 18;
RelayResponse relay_response = 19;
TestNatRequest test_nat_request = 20;
TestNatResponse test_nat_response = 21;
PeerDiscovery peer_discovery = 22;
OnlineRequest online_request = 23;
OnlineResponse online_response = 24;
KeyExchange key_exchange = 25;
HealthCheck hc = 26;
}
}
但server中
https://github.com/rustdesk/rustdesk-server/blob/master/libs/hbb_common/protos/rendezvous.proto
message RendezvousMessage {
oneof union {
RegisterPeer register_peer = 6;
RegisterPeerResponse register_peer_response = 7;
PunchHoleRequest punch_hole_request = 8;
PunchHole punch_hole = 9;
PunchHoleSent punch_hole_sent = 10;
PunchHoleResponse punch_hole_response = 11;
FetchLocalAddr fetch_local_addr = 12;
LocalAddr local_addr = 13;
ConfigUpdate configure_update = 14;
RegisterPk register_pk = 15;
RegisterPkResponse register_pk_response = 16;
SoftwareUpdate software_update = 17;
RequestRelay request_relay = 18;
RelayResponse relay_response = 19;
TestNatRequest test_nat_request = 20;
TestNatResponse test_nat_response = 21;
PeerDiscovery peer_discovery = 22;
OnlineRequest online_request = 23;
OnlineResponse online_response = 24;
}
}
KEY相关的代码在这块
https://github.com/rustdesk/rustdesk/blob/master/src/client.rs#L540 8taizi 发表于 2024-9-19 18:31
想问下,如何向被控端发送文字(比如在记事本中)
这个知识API sever
rustdesk客户端有传文件的功能