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 支持
This commit is contained in:
OpsXShell Dev committed 2026-04-25 05:14:27 +08:00
1 parent 3f636b1b0e
commit 07c4a5b14f
15 files changed
+757 -23

No files matched your search

+2 -1
View File
@@ -3,7 +3,7 @@
* 定义所有 IPC 请求/响应的类型
*/
import type { Session } from './session.types'
import type { Session, ProxyConfig } from './session.types'
// ============== SSH IPC ==============
@@ -14,6 +14,7 @@ export interface SSHConnectRequest {
password?: string
privateKey?: string
passphrase?: string
proxy?: ProxyConfig
}
export interface SSHConnectResponse {
+15
View File
@@ -6,6 +6,18 @@
// 认证方式
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
@@ -15,6 +27,7 @@ export interface SSHConnectionConfig {
privateKey?: string
passphrase?: string
authType?: AuthType
proxy?: ProxyConfig
}
// 持久化会话
@@ -28,6 +41,7 @@ export interface Session {
password?: string // 加密存储
privateKey?: string // 私钥路径或内容
passphrase?: string // 私钥密码
proxy?: ProxyConfig // 代理配置
group?: string
tags?: string[]
createdAt?: number
@@ -44,6 +58,7 @@ export interface SessionCreateRequest {
password?: string
privateKey?: string
passphrase?: string
proxy?: ProxyConfig
group?: string
tags?: string[]
}