mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-28 16:41:52 +08:00
feat(rustdesk): 完整实现RustDesk协议和P2P连接
重大变更: - 从prost切换到protobuf 3.4实现完整的RustDesk协议栈 - 新增P2P打洞模块(punch.rs)支持直连和中继回退 - 重构加密系统:临时Curve25519密钥对+Ed25519签名 - 完善HID适配器:支持CapsLock状态同步和修饰键映射 - 添加音频流支持:Opus编码+音频帧适配器 - 优化视频流:改进帧适配器和编码器协商 - 移除pacer.rs简化视频管道 扩展系统: - 在设置向导中添加扩展步骤(ttyd/rustdesk切换) - 扩展可用性检测和自动启动 - 新增WebConfig handler用于Web服务器配置 前端改进: - SetupView增加第4步扩展配置 - 音频设备列表和配置界面 - 新增多语言支持(en-US/zh-CN) - TypeScript类型生成更新 文档: - 更新系统架构文档 - 完善config/hid/rustdesk/video/webrtc模块文档
This commit is contained in:
42
src/main.rs
42
src/main.rs
@@ -33,20 +33,20 @@ enum LogLevel {Error, Warn, #[default] Info, Verbose, Debug, Trace,}
|
||||
#[command(name = "one-kvm")]
|
||||
#[command(version, about = "A open and lightweight IP-KVM solution", long_about = None)]
|
||||
struct CliArgs {
|
||||
/// Listen address
|
||||
#[arg(short = 'a', long, value_name = "ADDRESS", default_value = "0.0.0.0")]
|
||||
address: String,
|
||||
/// Listen address (overrides database config)
|
||||
#[arg(short = 'a', long, value_name = "ADDRESS")]
|
||||
address: Option<String>,
|
||||
|
||||
/// HTTP port (used when HTTPS is disabled)
|
||||
#[arg(short = 'p', long, value_name = "PORT", default_value = "8080")]
|
||||
http_port: u16,
|
||||
/// HTTP port (overrides database config)
|
||||
#[arg(short = 'p', long, value_name = "PORT")]
|
||||
http_port: Option<u16>,
|
||||
|
||||
/// HTTPS port (used when HTTPS is enabled)
|
||||
#[arg(long, value_name = "PORT", default_value = "8443")]
|
||||
https_port: u16,
|
||||
/// HTTPS port (overrides database config)
|
||||
#[arg(long, value_name = "PORT")]
|
||||
https_port: Option<u16>,
|
||||
|
||||
/// Enable HTTPS
|
||||
#[arg(long, default_value = "false")]
|
||||
/// Enable HTTPS (overrides database config)
|
||||
#[arg(long)]
|
||||
enable_https: bool,
|
||||
|
||||
/// Path to SSL certificate file (generates self-signed if not provided)
|
||||
@@ -99,11 +99,19 @@ async fn main() -> anyhow::Result<()> {
|
||||
let config_store = ConfigStore::new(&db_path).await?;
|
||||
let mut config = (*config_store.get()).clone();
|
||||
|
||||
// Apply CLI argument overrides to config
|
||||
config.web.bind_address = args.address;
|
||||
config.web.http_port = args.http_port;
|
||||
config.web.https_port = args.https_port;
|
||||
config.web.https_enabled = args.enable_https;
|
||||
// Apply CLI argument overrides to config (only if explicitly specified)
|
||||
if let Some(addr) = args.address {
|
||||
config.web.bind_address = addr;
|
||||
}
|
||||
if let Some(port) = args.http_port {
|
||||
config.web.http_port = port;
|
||||
}
|
||||
if let Some(port) = args.https_port {
|
||||
config.web.https_port = port;
|
||||
}
|
||||
if args.enable_https {
|
||||
config.web.https_enabled = true;
|
||||
}
|
||||
|
||||
if let Some(cert_path) = args.ssl_cert {
|
||||
config.web.ssl_cert_path = Some(cert_path.to_string_lossy().to_string());
|
||||
@@ -426,6 +434,8 @@ async fn main() -> anyhow::Result<()> {
|
||||
.update(|cfg| {
|
||||
cfg.rustdesk.public_key = updated_config.public_key.clone();
|
||||
cfg.rustdesk.private_key = updated_config.private_key.clone();
|
||||
cfg.rustdesk.signing_public_key = updated_config.signing_public_key.clone();
|
||||
cfg.rustdesk.signing_private_key = updated_config.signing_private_key.clone();
|
||||
cfg.rustdesk.uuid = updated_config.uuid.clone();
|
||||
})
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user