feat: v0.3.0 版本 - SSH终端、SFTP、端口转发功能实现
核心功能: - SSH终端: 密码/密钥认证、XTerm.js终端、多主题配色、IP高亮 - SFTP管理: 双栏文件管理、上传下载、传输队列 - 端口转发: 本地/远程转发、SOCKS5动态代理、规则管理 架构改进: - 拆分大型组件 (SFTPView/TabBar/Sidebar) - 添加统一日志和错误处理 - 修复React严格模式下的终端黑屏问题 UI更新: - 新增端口转发视图 - 更新UI预览文档 - 左侧栏右键菜单支持SFTP快捷打开
This commit is contained in:
1 parent
cf1c054381
commit
484d850abd
105 files changed
+25330
-64
No files matched your search
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* Connection Types - 统一的连接类型定义
|
||||
* 在主进程和渲染进程间共享
|
||||
*/
|
||||
|
||||
import type { SSHConnectionConfig } from './session.types'
|
||||
|
||||
// Re-export for convenience
|
||||
export type { SSHConnectionConfig as ConnectionConfig } from './session.types'
|
||||
|
||||
// 连接状态
|
||||
export type ConnectionState =
|
||||
| 'disconnected' // 初始/已关闭
|
||||
| 'connecting' // 正在连接
|
||||
| 'connected' // 活跃连接
|
||||
| 'background' // 后台保持
|
||||
| 'suspended' // 挂起 (长时间未操作)
|
||||
| 'error' // 连接错误
|
||||
| 'reconnecting' // 正在重连
|
||||
|
||||
// 连接统计信息
|
||||
export interface ConnectionStats {
|
||||
connectedAt: number // 连接建立时间
|
||||
lastActivityAt: number // 最后活动时间
|
||||
lastBackgroundAt?: number // 进入后台时间
|
||||
bytesTransferred: number // 传输字节数
|
||||
commandsExecuted: number // 执行的命令数 (估算)
|
||||
}
|
||||
|
||||
// 连接池配置
|
||||
export interface PoolConfig {
|
||||
maxConnections: number // 最大连接数 (默认 10)
|
||||
maxBackgroundConnections: number // 最大后台连接数 (默认 5)
|
||||
idleTimeoutMs: number // 空闲超时 (默认 5 分钟)
|
||||
suspendTimeoutMs: number // 挂起超时 (默认 30 分钟)
|
||||
keepaliveIntervalMs: number // 保活间隔 (默认 60 秒)
|
||||
maxReconnectAttempts: number // 最大重连次数 (默认 3)
|
||||
}
|
||||
|
||||
// 连接池中的连接项
|
||||
export interface PooledConnection {
|
||||
connectionId: string
|
||||
config: SSHConnectionConfig
|
||||
state: ConnectionState
|
||||
error?: string
|
||||
|
||||
// 引用管理
|
||||
refCount: number // 引用计数
|
||||
tabIds: Set<string> // 哪些标签在使用这个连接
|
||||
activeTabId: string | null // 当前活跃的标签
|
||||
|
||||
// 会话 ID
|
||||
sessionId?: string
|
||||
|
||||
// Shell/SFTP 会话
|
||||
shellIds: Set<string> // 该连接上创建的 shell 会话
|
||||
sftpIds: Set<string> // 该连接上创建的 sftp 会话
|
||||
|
||||
// 统计
|
||||
stats: ConnectionStats
|
||||
|
||||
// 定时器 ID (浏览器环境)
|
||||
keepaliveInterval?: number // 保活定时器 ID
|
||||
idleTimeout?: number // 空闲超时定时器 ID
|
||||
|
||||
// 重连
|
||||
reconnectAttempts: number // 重连尝试次数
|
||||
maxReconnectAttempts: number // 最大重连次数
|
||||
}
|
||||
|
||||
// 连接结果
|
||||
export interface ConnectionResult {
|
||||
success: boolean
|
||||
connectionId?: string
|
||||
error?: string
|
||||
isExisting?: boolean
|
||||
}
|
||||
|
||||
// Shell 会话信息
|
||||
export interface ShellInfo {
|
||||
shellId: string
|
||||
connectionId: string
|
||||
cols: number
|
||||
rows: number
|
||||
}
|
||||
Reference in new issue
Block a user