Skip to content

feat(proxy): connection proxy support (HTTP CONNECT / SOCKS5, per-host) - #76

Merged
thangnm93 merged 10 commits into
masterfrom
develop
Jun 16, 2026
Merged

feat(proxy): connection proxy support (HTTP CONNECT / SOCKS5, per-host)#76
thangnm93 merged 10 commits into
masterfrom
develop

Conversation

@thangnm93

@thangnm93 thangnm93 commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a per-host outbound proxy so SSH hosts on restricted networks can be reached through an HTTP CONNECT or SOCKS5 proxy. Applies to local-originated TCP dials (direct target + first bastion) and complements the existing jump chain. Closes #74.

Changes

  • proxy_settings.dartProxyType enum (none/http/socks5) + ProxySettings value.
  • proxy_handshake.dart — pure ByteReader + httpConnectHandshake (Basic auth, 200 check) + socks5Handshake (RFC 1929 auth, ATYP-domain remote DNS, reply-code messages) + ProxyException. Over-read bytes are preserved so the SSH banner isn't lost.
  • connection_proxy.dartConnectionProxy.connect dials the proxy, runs the handshake, returns a _ProxiedSocket (an SSHSocket) that re-emits the leftover ahead of live data; destroys the socket on failure; optional whole-operation timeout.
  • HostproxyType/proxyHost/proxyPort/proxyUsername (sync round-trip, unknown type → none). Proxy password in secure storage (proxy_pw_<id>), never in JSON.
  • SshServiceloadProxyPassword/saveProxyPassword, injectable directDialer/proxyDialer, and localDial wired into the three local-originated dial sites (connect, dialHop hop0, testConnection). No dartssh2 fork change.
  • Host panel — PROXY section (SSH-only): type dropdown + host/port/username/password, persisted on save.

Type of change

  • feat — new feature

How was this tested?

  • cd app && flutter analyze — no new warnings (6 touched files clean)
  • cd app && flutter test — 18 new tests (settings 2, HTTP 3, SOCKS5 4, proxy socket 1, host 4, ssh_service 2, panel 2) + full host-panel + test/models/ (189) regression pass
  • Manually verified on: pending (needs a live proxy — e.g. ssh -D 1080 for SOCKS5, tinyproxy for HTTP CONNECT)

Security notes

  • SOCKS5 sends the target as a domain (remote DNS); proxy password kept in secure storage only.
  • Handshake failures (HTTP non-200, SOCKS reply != 0, auth failure, early close) raise ProxyException with a clear message; the proxy socket is destroyed on any failure.

Checklist

  • PR title follows Conventional Commits
  • Code and comments are written in English
  • New/changed behavior is covered by tests
  • No secrets, credentials, or personal data in the diff

@thangnm93 thangnm93 added the enhancement New feature or request label Jun 16, 2026
@thangnm93 thangnm93 self-assigned this Jun 16, 2026
@thangnm93
thangnm93 merged commit 97da874 into master Jun 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Connection proxy support (HTTP CONNECT / SOCKS5)

1 participant