mirror of
https://github.com/fiddyschmitt/File-Tunnel.git
synced 2026-10-21 22:01:23 +00:00
Adds ft equivalents of SSH's dynamic forwarding: -D [bind:]port opens a local SOCKS proxy (the remote side dials each destination), and a bare -R [bind:]port (no destination) opens one on the remote side (the local side dials). Supports the same surface modern OpenSSH implements: SOCKS4, SOCKS4a and SOCKS5; CONNECT only; no authentication; no BIND or UDP ASSOCIATE. A new SocksServer performs the per-connection handshake and produces a tcp://host:port destination that flows through the existing Connect/relay path unchanged - so hostnames (SOCKS4a/5) and IPv6 resolve on the exit side, exactly like SSH. -R rides the existing CreateListener command via a "socks" protocol sentinel and a listen-spec partition in ProvideRemoteForwardsToCounterpart. SOCKS replies carry accurate result codes. Since ft had no positive per-connection dial signal, a new ConnectResult command (id 12) reports the outcome (SocketError mapped to a SOCKS reply code) from the dialing side back to the SOCKS host, which blocks until it arrives before answering its client. The reply is written before any relaying so it is the first thing the client sees. No existing wire command changed; -L/-U behaviour is untouched. Tested hermetically (SOCKS4/4a/5 negotiator byte-level tests, listen-spec parsing, ConnectResult serialization, and in-process end-to-end -D/-R transfers incl. far-side resolution and an accurate-failure-reply case) and verified with a real curl client in both directions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SjajJ7d3BhSZGfsMrGRS5S |
||
|---|---|---|
| .. | ||
| Command.cs | ||
| Connect.cs | ||
| ConnectResult.cs | ||
| CreateListener.cs | ||
| Forward.cs | ||
| Ping.cs | ||
| Purge.cs | ||
| TearDown.cs | ||