feat(slave-app): 新建对话框支持 TLS — Transport::TcpTls + 持久化#3
Merged
Conversation
- ui-shared/project.rs: TcpSpec 新增 #[serde(default)] tls: Option<TlsSpec>
TlsSpec 字段对齐 SlaveTlsConfig(cert/key/ca/pkcs12/password/require_client_cert)
schema_version 不动,旧 .modbusproj 文件 default=None 自然兼容
- egui/app.rs:
- SlaveApp 加 new_use_tls / new_cert_file / new_key_file /
new_pkcs12_file / new_pkcs12_password / new_ca_file /
new_require_client_cert 表单字段
- 新建对话框:☐ 启用 TLS 折叠区,PEM (cert+key) 或 PKCS#12 二选一,
可选 CA + mTLS require_client_cert
- allocate_connection 标签前缀 TLS:// vs TCP,
spawn_create_tcp 接受 Option<SlaveTlsConfig> 并构造 Transport::TcpTls,
create_tcp_connection 校验 TLS 字段非空
- load_project / build_project 双向同步 TLS 配置
- ui-shared 单元测试新增 slave_tls_roundtrip_and_legacy_compat
在 Selection::None 空状态内联一块 Hero 画布(参考 egui demo 的 dancing_strings),三条弦按 Holding/Coil/DiscreteInput 的 accent/ success/warn 三色分派,振幅由 LogCollector 的 1s 滚动 TX/RX 计数 驱动,有 Error 级日志时三弦暂时转 danger 红。模块独立放进 modbussim-ui-shared 方便 Master 端未来复用,app.rs 不再继续膨胀。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
TcpSpec 在 ui-shared 加了 tls: Option<TlsSpec> 字段后, master crate 的 save 路径字面量未同步更新,导致 CI 编译失败。 Master 暂不暴露 TLS UI,save 时一律写 None; 旧 .modbusproj 读取由 #[serde(default)] 自动兼容。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
☐ 启用 TLS折叠区(PEM cert+key 或 PKCS#12 二选一 + 可选 CA + mTLSrequire_client_cert)Transport::TcpTls+SlaveConnection::with_tls_config;连接标签前缀TLS host:portvsTCP host:port.modbusprojschema 拓展:TcpSpec.tls: Option<TlsSpec>via#[serde(default)],schema_version不动,旧项目文件天然兼容(tls=None 即明文 TCP)load_project / build_project双向同步 TLS 配置底层 (
modbussim-core) 早已有完整 TLS 实现(tls_slave.rs/Transport::TcpTls/ e2e 测试),但 egui 子站 UI 之前只暴露Transport::Tcp。本 PR 把已有能力接入子站前端。Test plan
cargo check -p modbussim-egui -p modbussim-ui-shared干净cargo clippy -p modbussim-egui -p modbussim-ui-shared --no-deps -- -D warnings干净cargo fmt --all --check通过cargo test -p modbussim-ui-shared --lib全绿(含新增slave_tls_roundtrip_and_legacy_compat)cargo build -p modbussim-egui --release成功.modbusproj(无tls字段)确认明文 TCP 仍能启动