Metadata-Version: 2.4
Name: tcptune
Version: 1.0.0
Summary: Tune Linux TCP/sysctl, detect bottlenecks, adjust buffers.
Author-email: Jax <muxover@jax-development.com>
License: MIT
Project-URL: Repository, https://github.com/muxover/tcptune
Project-URL: Changelog, https://github.com/muxover/tcptune/blob/main/CHANGELOG.md
Keywords: linux,tcp,sysctl,networking,performance,cli
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Networking
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: click>=8.0
Requires-Dist: rich>=13.0
Provides-Extra: yaml
Requires-Dist: pyyaml>=6.0; extra == "yaml"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: black; extra == "dev"

# TcpTune

<div align="center">

[![CI](https://github.com/muxover/tcptune/actions/workflows/ci.yml/badge.svg)](https://github.com/muxover/tcptune/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

**Tune Linux TCP/sysctl, detect bottlenecks, adjust buffers.**

</div>

---

TcpTune is a Linux-only CLI for tuning TCP and related sysctl parameters, detecting retransmission and interface drop issues, computing BDP-based buffer recommendations, and viewing live TCP stats. Intended for system administrators and anyone optimizing network performance on Linux.

## Features

- Apply named presets (throughput, low-latency, wan, conservative) to sysctl
- Backup current values before applying; restore from a backup file
- Detect bottlenecks (retransmission rate, interface drops) from procfs
- Recommend and optionally apply buffer sizes from bandwidth and RTT (BDP)
- Live view of retransmission rate and connection count
- Export sysctl and TCP stats to JSON or HTML

## Installation

```bash
pip install tcptune
```

From source:

```bash
git clone https://github.com/muxover/tcptune.git
cd tcptune
pip install -e .
```

Requires Python 3.10+ and Linux. Root is required only for applying presets or buffer values.

## Commands

| Command | Description |
|---------|-------------|
| `tcptune tune -p PRESET` | Apply a preset (use `--dry-run` or `--backup PATH` as needed) |
| `tcptune restore --from-file PATH` | Restore sysctl from a backup JSON file |
| `tcptune detect` | Show retransmission rate and any findings |
| `tcptune buffers -b BANDWIDTH -r RTT` | Show BDP and recommended buffers; use `--apply` to set them |
| `tcptune info` | Show current sysctl and kernel version |
| `tcptune viz` | Live view of retrans rate and connections |
| `tcptune report --json PATH` / `--html PATH` | Export snapshot to JSON or HTML |

## Quick Start

```bash
# See current settings
tcptune info

# See what would be applied (no root)
tcptune tune -p throughput --dry-run

# Apply a preset (root), backing up first
sudo tcptune tune -p throughput --backup ./backup.json

# Restore if needed
sudo tcptune restore --from-file ./backup.json

# Check for issues
tcptune detect
```

## Project Layout

```
tcptune/
  src/tcptune/     # CLI and core logic
  tests/           # Unit tests
  pyproject.toml
```

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md).

## License

Licensed under [MIT](LICENSE).

## Links

- Repository: https://github.com/muxover/tcptune
- Issues: https://github.com/muxover/tcptune/issues
- Changelog: [CHANGELOG.md](CHANGELOG.md)

---

<p align="center">Made with ❤️ by Jax (@muxover)</p>
