TNT's Not Tunnel
Find a file
m1ngsama 1c5bd790ea Fix SSH connection stability issues
Addresses the "Key exchange failed: Socket error: disconnected"
errors that were causing service instability.

Changes:
- Add 10-second timeout for SSH network operations to prevent hung connections
- Enable TCP keepalive with aggressive parameters (60s idle, 10s interval, 3 probes)
- Disable SSH compression to reduce CPU overhead
- Set log verbosity to NOLOG to eliminate excessive logging that was
  filling up systemd journal and potentially impacting performance
- Remove error logging for failed key exchanges to reduce log spam
  (these are normal when clients disconnect during handshake)

The timeout and keepalive settings ensure dead connections are detected
and cleaned up quickly, while reduced logging minimizes I/O overhead
during high connection churn scenarios.

Tested: Server builds cleanly and starts successfully on macOS.
TCP keepalive is Linux-specific and properly guarded with #ifdef.
2025-12-08 10:49:47 +08:00
.github/workflows Add CI/CD and deployment automation 2025-12-02 12:47:15 +08:00
include Fix critical memory and concurrency bugs 2025-11-30 09:00:00 +08:00
src Fix SSH connection stability issues 2025-12-08 10:49:47 +08:00
.gitignore Add development and testing infrastructure 2025-12-02 10:00:00 +08:00
CHANGELOG.md Add developer documentation 2025-12-02 15:00:00 +08:00
CICD.md Add CI/CD and deployment automation 2025-12-02 12:47:15 +08:00
DEPLOYMENT.md Add CI/CD and deployment automation 2025-12-02 12:47:15 +08:00
HACKING Add developer documentation 2025-12-02 15:00:00 +08:00
install.sh Add CI/CD and deployment automation 2025-12-02 12:47:15 +08:00
LICENSE Initial commit 2025-07-01 09:00:00 +08:00
Makefile Add development and testing infrastructure 2025-12-02 10:00:00 +08:00
QUICKREF Add developer documentation 2025-12-02 15:00:00 +08:00
README Rewrite README in classic Unix style 2025-12-02 12:57:18 +08:00
README.md Rewrite README in classic Unix style 2025-12-02 12:57:18 +08:00
test_basic.sh Add development and testing infrastructure 2025-12-02 10:00:00 +08:00
test_stress.sh Add development and testing infrastructure 2025-12-02 10:00:00 +08:00
tnt.service Add CI/CD and deployment automation 2025-12-02 12:47:15 +08:00

TNT

Terminal chat server. Vim-style interface. SSH-based.

Install

curl -sSL https://raw.githubusercontent.com/m1ngsama/TNT/main/install.sh | sh

Or download from releases.

Run

tnt              # port 2222
tnt -p 3333      # custom port
PORT=3333 tnt    # env var

Connect: ssh -p 2222 localhost

Keys

INSERT (default)

  • ESC → NORMAL
  • Enter → send
  • Backspace → delete

NORMAL

  • i → INSERT
  • : → COMMAND
  • j/k → scroll
  • g/G → top/bottom
  • ? → help

COMMAND

  • :list → users
  • :help → commands
  • ESC → back

Build

make              # normal
make debug        # with symbols
make asan         # sanitizer
make check        # static analysis

Requires: libssh

Deploy

See DEPLOYMENT.md for systemd setup.

Files

messages.log      chat history
host_key          SSH key (auto-gen)
tnt.service       systemd unit

Test

./test_basic.sh         # functional
./test_stress.sh 50     # 50 clients

Docs

  • README - man page style
  • HACKING - dev guide
  • DEPLOYMENT.md - production
  • CICD.md - automation
  • QUICKREF - cheat sheet

License

MIT