A high-performance SSH tunnel server with dynamic port allocation.
380
A high-performance SSH tunnel server with dynamic port allocation and structured logging.
make
# or
make build
make all
make dev
# Pull and run from Docker Hub
docker run -d \
--name ssh-tunnel-server \
-p 2022:2022 \
-p 10000-15000:10000-15000 \
longkeyy/ssh-tunnel-server:latest
# Or use docker-compose
wget https://raw.githubusercontent.com/longkeyy/ssh-tunnel-server/main/docker-compose.yml
docker-compose up -d
# Build image
make docker-build
# Start service
make docker-run
# View logs
make docker-logs
# Stop service
make docker-stop
# Production - port 2022, range 10000-15000
docker-compose up -d
# Development - port 2023, range 20000-25000, debug enabled
docker-compose --profile dev up -d
# View logs
docker-compose logs -f
# Stop service
docker-compose down
# Basic run
docker run -d \
--name ssh-tunnel-server \
-p 2022:2022 \
-p 10000-15000:10000-15000 \
longkeyy/ssh-tunnel-server:latest
# Custom parameters
docker run -d \
--name ssh-tunnel-server \
-p 2022:2022 \
-p 20000-25000:20000-25000 \
longkeyy/ssh-tunnel-server:latest \
-l 0.0.0.0:2022 -s 20000 -e 25000 -m random -d
# Default multi-arch build (linux/amd64, linux/arm64, linux/arm/v7)
make docker-build
# Single architecture build (current platform)
./scripts/docker-build.sh --single-arch
# Build and push to registry
./scripts/docker-build.sh --push -r your-registry.com
# Custom tag and push
./scripts/docker-build.sh -t v1.0.0 --push -r your-registry.com
# Use latest version
docker pull longkeyy/ssh-tunnel-server:latest
# Use specific version (if release tags available)
docker pull longkeyy/ssh-tunnel-server:v1.0.0
# Use development version
docker pull longkeyy/ssh-tunnel-server:main
./ssh-tunnel-server
| Parameter | Default | Description |
|---|---|---|
-l | 0.0.0.0:2022 | SSH server listen address |
-k | "" | SSH host key file path |
-d | false | Enable debug logging |
-j | false | Use JSON format for logs |
-o | "" | Log file output path |
-s | 10000 | Port allocation range start |
-e | 50000 | Port allocation range end |
-m | sequential | Port allocation mode (sequential|random) |
./ssh-tunnel-server -m random -s 20000 -e 25000
./ssh-tunnel-server -d -j
./ssh-tunnel-server -l :2023 -s 15000 -e 20000
./ssh-tunnel-server -o /var/log/ssh-tunnel.log
ssh -p 2022 -R0:localhost:22 user@server-ip
ssh -p 2022 -R8080:localhost:80 user@server-ip
ssh -p 2022 -R0:localhost:22 -N -f user@server-ip
2025-06-28 02:47:01 INFO SSH tunnel server started {"address": "0.0.0.0:2022", "port_start": 10000}
{"level":"info","ts":"2025-06-28T02:47:01.147+0800","caller":"logger/logger.go:67","msg":"SSH tunnel server started","address":"0.0.0.0:2022","port_start":10000}
make # Build current platform (default)
make build # Same as 'make'
make all # Cross-compile for all platforms
make clean # Clean build artifacts
make test # Run tests
make run # Build and run in debug mode
make dev # Development mode (auto-reload)
make lint # Code linting
make fmt # Format code
make docker-build # Build Docker image
make docker-run # Start server with docker-compose
make docker-stop # Stop docker-compose services
make docker-logs # Show container logs
make docker-dev # Start development server (port 2023)
Build Features:
-trimpath -a parameters for reproducible buildsbuild/ directoryMIT License
Content type
Image
Digest
sha256:1fbddd766…
Size
8 MB
Last updated
about 1 year ago
docker pull longkeyy/ssh-tunnel-server