SOCKS5 support #452

Merged
Medvedinca merged 6 commits from feature-socks5-support into dev-1.10.0 2025-12-20 02:35:40 +00:00
Medvedinca commented 2025-12-18 07:49:06 +00:00 (Migrated from github.com)

Add Complete SOCKS5 and Proxy Chain Support

Summary

This PR implements comprehensive SOCKS5 proxy support with proxy chain functionality across all SSH operations in Termix. Users can now configure either a single SOCKS5 proxy or a chain of multiple proxies for all SSH connections.

Features

SOCKS5 Proxy Modes:

  • Single Proxy: Connect through one SOCKS5 proxy server
  • Proxy Chain: Connect through multiple SOCKS5 proxies in sequence (e.g., proxy1 → proxy2 → target)

Supported Operations:

  • Terminal connections
  • SFTP/File Manager operations
  • SSH Tunnels
  • Server statistics collection
  • Server status monitoring

Implementation

Backend Infrastructure:

  • Created socks5-helper.ts utility with createSocks5Connection() for both single proxy and chain connections
  • Added SOCKS5 fields to database schema: useSocks5, socks5Host, socks5Port, socks5Username, socks5Password, socks5ProxyChain
  • Integrated SOCKS5 support in all SSH connection points (terminal, file-manager, tunnel, server-stats)
  • Connection pool properly handles SOCKS5 settings in host keys
  • Automatic refresh of proxy settings from database

Frontend UI:

  • Created Socks5ProxyConfig component for proxy configuration
  • Two modes: Single proxy or Proxy chain
  • Dynamic proxy chain editor (add/remove/edit nodes)
  • Integrated into HostManagerEditor
  • Full translation support (EN/RU)

Type System:

  • Added ProxyNode interface for chain nodes
  • Added SOCKS5 fields to SSHHost, SSHHostData, and TunnelConfig interfaces
  • Type-safe proxy configuration throughout the application

Technical Details

Proxy Chain Flow:

Client → Proxy1 (SOCKS4/5) → Proxy2 (SOCKS4/5) → ... → Target Server

Each proxy node supports:

  • SOCKS4 or SOCKS5 protocol
  • Optional authentication (username/password)
  • Custom port configuration

Database Schema:

useSocks5: boolean
socks5Host: string (for single proxy)
socks5Port: number
socks5Username: string
socks5Password: string
socks5ProxyChain: JSON array of ProxyNode[]

Usage Example

Single Proxy:

  • Host: proxy.example.com
  • Port: 1080
  • Auth: username:password

Proxy Chain:

[
  { "host": "proxy1.com", "port": 1080, "type": 5, "username": "user1", "password": "pass1" },
  { "host": "proxy2.com", "port": 1080, "type": 5, "username": "user2", "password": "pass2" }
]

image image
# Add Complete SOCKS5 and Proxy Chain Support ## Summary This PR implements comprehensive SOCKS5 proxy support with proxy chain functionality across all SSH operations in Termix. Users can now configure either a single SOCKS5 proxy or a chain of multiple proxies for all SSH connections. ## Features **SOCKS5 Proxy Modes:** - **Single Proxy**: Connect through one SOCKS5 proxy server - **Proxy Chain**: Connect through multiple SOCKS5 proxies in sequence (e.g., `proxy1 → proxy2 → target`) **Supported Operations:** - Terminal connections - SFTP/File Manager operations - SSH Tunnels - Server statistics collection - Server status monitoring ## Implementation **Backend Infrastructure:** - Created `socks5-helper.ts` utility with `createSocks5Connection()` for both single proxy and chain connections - Added SOCKS5 fields to database schema: `useSocks5`, `socks5Host`, `socks5Port`, `socks5Username`, `socks5Password`, `socks5ProxyChain` - Integrated SOCKS5 support in all SSH connection points (terminal, file-manager, tunnel, server-stats) - Connection pool properly handles SOCKS5 settings in host keys - Automatic refresh of proxy settings from database **Frontend UI:** - Created `Socks5ProxyConfig` component for proxy configuration - Two modes: Single proxy or Proxy chain - Dynamic proxy chain editor (add/remove/edit nodes) - Integrated into HostManagerEditor - Full translation support (EN/RU) **Type System:** - Added `ProxyNode` interface for chain nodes - Added SOCKS5 fields to `SSHHost`, `SSHHostData`, and `TunnelConfig` interfaces - Type-safe proxy configuration throughout the application ## Technical Details **Proxy Chain Flow:** ``` Client → Proxy1 (SOCKS4/5) → Proxy2 (SOCKS4/5) → ... → Target Server ``` Each proxy node supports: - SOCKS4 or SOCKS5 protocol - Optional authentication (username/password) - Custom port configuration **Database Schema:** ```typescript useSocks5: boolean socks5Host: string (for single proxy) socks5Port: number socks5Username: string socks5Password: string socks5ProxyChain: JSON array of ProxyNode[] ``` ## Usage Example **Single Proxy:** - Host: `proxy.example.com` - Port: `1080` - Auth: `username:password` **Proxy Chain:** ```json [ { "host": "proxy1.com", "port": 1080, "type": 5, "username": "user1", "password": "pass1" }, { "host": "proxy2.com", "port": 1080, "type": 5, "username": "user2", "password": "pass2" } ] ``` --- <img width="1642" height="773" alt="image" src="https://github.com/user-attachments/assets/6e02d17b-5416-4a5c-9675-d4dbe0f2de9a" /> <img width="1633" height="808" alt="image" src="https://github.com/user-attachments/assets/a94a88ff-dfc6-4ba9-b47a-2e97befab430" />
Sign in to join this conversation.