Merged
Conversation
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.
feat(ssh): 新增自动公钥认证模式
Description:
背景
onetcli 现有三种 SSH 认证方式(密码、私钥文件、SSH Agent),但用户仍需理解"客户端私钥/服务器公钥"的 SSH 细节,与系统
ssh user@host自动发现本机身份的体验不一致。变更内容
新增「自动公钥认证」模式,连接时自动按以下顺序尝试本机已有身份:
~/.ssh/id_ed25519、id_rsa、id_ecdsa、id_dsa用户无需手动填写私钥路径,体验与系统
ssh一致。功能演示
认证方式配置
测试连接
保存连接(测试通过后才允许保存)
编辑回显
技术实现
SshAuthMethod::AutoPublicKey— 新增存储枚举变体,只保存认证策略,不保存实际私钥路径expand_auto_publickey_auth()— 将 AutoPublicKey 展开为按优先级排列的候选身份列表authenticate_session_with_fallbacks()— 顺序尝试候选身份,全部失败时聚合可读错误authenticate_with_strategy()— 统一认证入口,SSH 终端、SFTP、文件管理面板复用同一逻辑影响范围
ssh_form_window.rs)terminal.rs)sftp_view/lib.rs)file_manager_panel.rs)sftp/russh_impl.rs)测试
cargo test -p ssh— 6 个单元测试全部通过cargo test -p terminal_view— 9 个单元测试全部通过