Files
opsxshell/shared/types/session.types.ts
T
OpsXShell Dev 07c4a5b14f feat(proxy): HTTP/SOCKS5 代理支持,按会话独立配置 | 15 files +483/-23 | 96/96 tests passing
功能:
- 代理类型定义 (ProxyType, ProxyConfig)
- 代理工具函数 (验证、解析、构建URL) + 24 测试
- SSH 连接通过 HTTP CONNECT / SOCKS5 隧道
- 数据库 proxy 列持久化 (JSON)
- SessionDialog 代理配置 UI (可折叠面板)
- 连接池传递 proxy 到 IPC
- sessionStore 类型添加 proxy 支持
2026-04-25 05:14:27 +08:00

68 lines
1.4 KiB
TypeScript

/**
* Session Types - 统一的会话类型定义
* 在主进程和渲染进程间共享
*/
// 认证方式
export type AuthType = 'password' | 'key' | 'agent'
// 代理类型
export type ProxyType = 'none' | 'http' | 'socks5'
// 代理配置
export interface ProxyConfig {
type: ProxyType
host: string
port: number
username?: string
password?: string
}
// 会话配置 (用于快速连接)
export interface SSHConnectionConfig {
host: string
port: number
username: string
password?: string
privateKey?: string
passphrase?: string
authType?: AuthType
proxy?: ProxyConfig
}
// 持久化会话
export interface Session {
id: string
name: string
host: string
port: number
username: string
authType: AuthType
password?: string // 加密存储
privateKey?: string // 私钥路径或内容
passphrase?: string // 私钥密码
proxy?: ProxyConfig // 代理配置
group?: string
tags?: string[]
createdAt?: number
updatedAt?: number
}
// 会话创建请求
export interface SessionCreateRequest {
name: string
host: string
port: number
username: string
authType: AuthType
password?: string
privateKey?: string
passphrase?: string
proxy?: ProxyConfig
group?: string
tags?: string[]
}
// 会话更新请求
export type SessionUpdateRequest = Partial<Omit<Session, 'id' | 'createdAt' | 'updatedAt'>>