Skip to content

feat: add --ssh flag with direct SSH fallback#8

Open
coolaj86 wants to merge 2 commits into
mainfrom
feat-ssh-fallback
Open

feat: add --ssh flag with direct SSH fallback#8
coolaj86 wants to merge 2 commits into
mainfrom
feat-ssh-fallback

Conversation

@coolaj86
Copy link
Copy Markdown
Contributor

Summary

  • Adds --ssh <fallback-port> CLI flag that sets SSH ALPN and enables fallback
  • When TLS+SSH ALPN negotiation fails on port 443, automatically falls back to a plain TCP connection on the specified port (e.g. --ssh 22)
  • Extracts dialRemote() helper that encapsulates TLS-first-then-fallback logic, used by both the test connection and per-client connections

Usage

sclient --ssh 22 example.com 3000

Tries TLS with ssh ALPN on 443 first. If refused, connects directly to example.com:22 instead.

Test plan

  • sclient --ssh 22 telebit.cloud 3000 against a server that accepts SSH over TLS — verify TLS path works
  • sclient --ssh 22 github.com 3000 against a server that doesn't accept SSH ALPN — verify fallback to port 22
  • sclient example.com 3000 without --ssh — verify no behavioral change
  • sclient --ssh 22 --alpn h2 example.com 3000 — verify explicit --alpn is not overridden by --ssh

Try TLS connection with SSH ALPN first; if the remote doesn't accept it,
fall back to a plain TCP connection on the specified port (e.g. 22).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant