Commit graph

11 commits

Author SHA1 Message Date
da8b77d625 docs: reorganize documentation structure
- Move all documentation to docs/ directory for better organization
- Rewrite README.md following Linux kernel style (English only)
- Rename HACKING -> CONTRIBUTING.md
- Rename QUICKREF -> QUICKREF.md
- Rename README -> README.old
- Add comprehensive Development-Guide.md for contributors

Documentation structure:
- README.md: Project overview and quick start
- docs/Development-Guide.md: Complete developer manual
- docs/CONTRIBUTING.md: Contribution guidelines
- docs/DEPLOYMENT.md: Production deployment guide
- docs/SECURITY_QUICKREF.md: Security config reference
- docs/QUICKREF.md: Command cheat sheet

This aligns with Linux kernel documentation practices:
simple, organized, and accessible.
2026-02-07 23:31:53 +08:00
07fd7b1513
refactor: optimize rendering, log loading, and migrate to libssh callback API (#9)
This PR addresses critical performance bottlenecks, improves UX, and eliminates technical debt.

### Key Changes

**1. Performance Optimization:**
- **Startup**: Rewrote `message_load` to scan `messages.log` backwards from the end
  - Complexity reduced from O(FileSize) to O(MaxMessages)
  - Large log file startup: seconds → milliseconds
- **Rendering**: Optimized TUI rendering to use line clearing (`\033[K`) instead of full-screen clearing (`\033[2J`)
  - Eliminated visual flicker

**2. libssh API Migration:**
- Replaced deprecated message-based API with callback-based server implementation
- Removed `#pragma GCC diagnostic ignored "-Wdeprecated-declarations"`
- Ensures future libssh compatibility

**3. User Experience (Vim Mode):**
- Added `Ctrl+W` (Delete Word) and `Ctrl+U` (Delete Line) in Insert/Command modes
- Modified `Ctrl+C` behavior to safely switch modes instead of terminating connection
- Added support for `\n` as Enter key (fixing piped input issues)

**4. Project Structure:**
- Moved all test scripts to `tests/` directory
- Added `make test` target
- Updated CI/CD to run comprehensive test suite

### Verification
-  All tests passing (17/17)
-  CI passing on Ubuntu and macOS
-  AddressSanitizer clean
-  Valgrind clean (no memory leaks)
-  Zero compilation warnings

### Code Quality
**Rating:** 🟢 Good Taste
- Algorithm-driven optimization (not hacks)
- Simplified architecture (callback-based API)
- Zero breaking changes (all tests pass)
2026-02-07 23:17:55 +08:00
5f8b8fd843 feat: enhance anonymous access and long-term stability
Improvements for low-barrier anonymous access:
- Enhanced welcome message to clarify anonymous access
- Added EASY_SETUP.md guide in Chinese and English
- Updated README with anonymous access notes

Long-term stability enhancements:
- Improved systemd service with auto-restart and resource limits
- Added log rotation script (scripts/logrotate.sh)
- Added health check script (scripts/healthcheck.sh)
- Added cron setup script for automated maintenance
- Added anonymous access test suite

Testing:
- All security features verified (10/10 passed)
- Anonymous access tests passed (2/2)
- Health check verified

This ensures:
- Zero-barrier SSH access (any username, any password)
- Stable long-term operation with auto-restart
- Automated log management
- Continuous health monitoring
2026-01-22 15:06:54 +08:00
fa348041e5 docs: document comprehensive security fixes
- Add Security section to README.md with configuration examples
- Document all new environment variables (access token, rate limiting, SSH options)
- Add comprehensive CHANGELOG entry for security audit fixes
- Categorize fixes by severity (Critical, High, Medium)
- Include security improvements summary table
- Maintain backward compatibility notes

New environment variables documented:
- TNT_ACCESS_TOKEN: Optional password authentication
- TNT_BIND_ADDR: Configurable bind address
- TNT_SSH_LOG_LEVEL: SSH logging verbosity
- TNT_RATE_LIMIT: Enable/disable rate limiting
- TNT_MAX_CONNECTIONS: Global connection limit
- TNT_MAX_CONN_PER_IP: Per-IP connection limit

Documentation follows Unix-style concise format.
2026-01-22 14:12:55 +08:00
abe477f713 Rewrite README in classic Unix style
- README: BSD man page format (NAME/SYNOPSIS/OPTIONS/etc)
- README.md: Minimal markdown (82 lines vs 200+)

Philosophy: Dense information, no fluff, reference style.
Inspired by original Unix manuals and BSD docs.

Changes:
- Removed emojis and badges
- Condensed verbose sections
- Clear command examples
- Direct references to detailed docs
2025-12-02 12:57:18 +08:00
8e24ae5633 Add CI/CD and deployment automation
GitHub Actions workflows:
- ci.yml: Auto-test on push/PR
  * Build on Ubuntu and macOS
  * Run AddressSanitizer
  * Memory leak checks with Valgrind

- release.yml: Auto-release on tags
  * Build for Linux (amd64, arm64)
  * Build for macOS (amd64, arm64)
  * Generate checksums
  * Create GitHub release with binaries

Deployment tools:
- install.sh: One-line installer
  * Auto-detect OS and arch
  * Download from releases
  * Install to /usr/local/bin

- tnt.service: systemd unit file
  * Auto-restart on failure
  * Security hardening
  * Runs as dedicated user

- DEPLOYMENT.md: Complete deployment guide
  * Quick install
  * systemd setup
  * Firewall config
  * Docker alternative

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

Create release:
  git tag v1.0.0
  git push origin v1.0.0
2025-12-02 12:47:15 +08:00
5c11fb1b04 Add developer documentation
New files:
- HACKING      - Architecture, debugging, common pitfalls
- QUICKREF     - One-page reference card
- Updated CHANGELOG.md with recent fixes
- Updated README.md with development section

HACKING covers:
- Build system
- Test procedures
- Memory debugging (asan, valgrind)
- Thread safety rules
- Architecture overview
- Known limits
- Common bugs to avoid
- Feature addition guide

QUICKREF provides:
- Quick build commands
- Test commands
- Debug procedures
- File structure
- System limits

Follows minimalist Unix documentation philosophy.
No fluff, just facts.
2025-12-02 15:00:00 +08:00
a4d67be103 Replace telnet with SSH and fix full-screen display
- Implement SSH server using libssh for secure connections
- Replace insecure telnet with encrypted SSH protocol
- Add automatic terminal size detection via PTY requests
- Support dynamic window resize (SIGWINCH handling)
- Fix UI display bug by using SSH channel instead of fd
- Update tui_clear_screen to work with SSH connections
- Add RSA host key auto-generation on first run
- Update README with SSH instructions and security notes
- Add libssh dependency to Makefile with auto-detection
- Remove all telnet-related code

Security improvements:
- All traffic now encrypted
- Host key authentication
- No more plaintext transmission
2025-11-24 16:48:14 +08:00
6e9eb38c78 Remove development timeline from README 2025-10-01 11:00:00 +08:00
e27665654b Create project structure (include/, src/) 2025-07-05 11:00:00 +08:00
63274b92ba Initial commit 2025-07-01 09:00:00 +08:00