initial commit
This commit is contained in:
110
README.md
Normal file
110
README.md
Normal file
@@ -0,0 +1,110 @@
|
||||
# SSH Tunnel Manager
|
||||
|
||||
A Go-based command-line tool to manage SSH tunnels. This tool allows you to:
|
||||
|
||||
- List currently active SSH tunnels
|
||||
- Start new SSH tunnels as background daemons
|
||||
- Stop running SSH tunnels
|
||||
- Monitor traffic statistics for SSH tunnels
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
go install github.com/yourusername/sshtunnel/cmd@latest
|
||||
```
|
||||
|
||||
Or clone this repository and build it yourself:
|
||||
|
||||
```
|
||||
git clone https://github.com/yourusername/sshtunnel.git
|
||||
cd sshtunnel
|
||||
go build -o sshtunnel ./cmd
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Listing active tunnels
|
||||
|
||||
```
|
||||
sshtunnel list
|
||||
```
|
||||
|
||||
This will display all active SSH tunnels with their IDs, local ports, remote endpoints, and process IDs.
|
||||
|
||||
### Starting a new tunnel
|
||||
|
||||
```
|
||||
sshtunnel start -local 8080 -remote 80 -host example.com -server user@ssh-server.com
|
||||
```
|
||||
|
||||
Options:
|
||||
- `-local`: Local port to forward (required)
|
||||
- `-remote`: Remote port to forward to (required)
|
||||
- `-host`: Remote host to forward to (default: "localhost")
|
||||
- `-server`: SSH server address in the format user@host (required)
|
||||
- `-identity`: Path to SSH identity file (optional)
|
||||
|
||||
### Stopping tunnels
|
||||
|
||||
Stop a specific tunnel by ID:
|
||||
```
|
||||
sshtunnel stop -id 1
|
||||
```
|
||||
|
||||
Stop all active tunnels:
|
||||
```
|
||||
sshtunnel stop -all
|
||||
```
|
||||
|
||||
Options:
|
||||
- `-id`: ID of the tunnel to stop
|
||||
- `-all`: Stop all tunnels
|
||||
|
||||
### Viewing traffic statistics
|
||||
|
||||
View statistics for all tunnels:
|
||||
```
|
||||
sshtunnel stats --all
|
||||
```
|
||||
|
||||
View statistics for a specific tunnel:
|
||||
```
|
||||
sshtunnel stats --id 1
|
||||
```
|
||||
|
||||
Monitor tunnel traffic in real-time:
|
||||
```
|
||||
sshtunnel stats --id 1 --watch
|
||||
```
|
||||
|
||||
Options:
|
||||
- `--id`: ID of the tunnel to show statistics for
|
||||
- `--all`: Show statistics for all tunnels
|
||||
- `--watch`: Continuously monitor statistics (only with specific tunnel ID)
|
||||
- `--interval`: Update interval in seconds for watch mode (default: 5)
|
||||
|
||||
### Debugging tunnels
|
||||
|
||||
Run diagnostics to troubleshoot issues with SSH tunnels:
|
||||
```
|
||||
sshtunnel debug
|
||||
```
|
||||
|
||||
This command will:
|
||||
1. Check if SSH client is properly installed
|
||||
2. Verify the tunnel directory exists and is accessible
|
||||
3. Validate all recorded tunnels and their current state
|
||||
4. Show active SSH tunnel processes and their status
|
||||
|
||||
## How it works
|
||||
|
||||
The tool creates SSH tunnels using the system's SSH client and manages them by tracking their process IDs in a hidden directory (`~/.sshtunnels/`). Each tunnel is assigned a unique ID for easy management. Traffic statistics are collected and stored to help you monitor data transfer through your tunnels.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Go 1.16 or higher
|
||||
- SSH client installed on your system
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
Reference in New Issue
Block a user