High-performance tunnel proxy with real-time monitoring and analytics
Features • Installation • Usage • API • Configuration
- High performance proxy for mining connections
- Real-time monitoring and statistics
- REST API for integration
- SQLite database for data storage
- WebSocket support for live logs
- Multi-pool support
- TLS encryption support
- Prometheus metrics endpoint
- Go 1.21 or higher
- Git
- gcc (for CGO dependencies)
wget https://go.dev/dl/go1.21.5.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.21.5.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc
go versionDownload and run the installer from golang.org/dl
git clone https://github.com/Mytai20100/tunnel.git
cd tunnelgo mod download
go mod tidy# Linux/macOS
go build -o tunnel main.go
# Windows
go build -o tunnel.exe main.goCreate config.yml file:
pools:
pool1:
host: "pool.example.com"
port: 4444
name: "Example Pool"
pool2:
host: "another-pool.com"
port: 3333
name: "Another Pool"
tunnels:
tunnel1:
ip: "0.0.0.0"
port: 3333
pool: "pool1"
tunnel2:
ip: "0.0.0.0"
port: 3334
pool: "pool2"
api_port: 8080
database:
host: "localhost"
port: 3306
user: "root"
password: "password"
dbname: "mining_tunnel"# Run server
./tunnel
# Run without database
./tunnel --nodata
# Run without API
./tunnel --noapi
# Run with minimal output
./tunnel --nodebug
# Run with TLS
./tunnel --tls --tlscert=cert.pem --tlskey=key.pem
# Show help
./tunnel --help
# Show version
./tunnel --version| Option | Description |
|---|---|
--nodata |
Disable database logging |
--noapi |
Disable API server |
--nodebug |
Minimal output mode |
--tls |
Enable TLS support |
--tlscert |
TLS certificate file (default: cert.pem) |
--tlskey |
TLS key file (default: key.pem) |
--help |
Show help message |
--version |
Show version |
Generate self-signed certificate:
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodesRun with TLS:
./tunnel --tls --tlscert=cert.pem --tlskey=key.pemGET http://localhost:8080/api/metricsGET http://localhost:8080/api/i/{wallet_address}GET http://localhost:8080/api/network/stats?hours=24GET http://localhost:8080/api/shares/stats?wallet={address}&hours=24GET http://localhost:8080/metricsWS ws://localhost:8080/api/logs/streamGET /api/metrics:
{
"system": {
"cpu_model": "Intel Core i7",
"cpu_cores": 8,
"cpu_usage_percent": "25.50%",
"ram_total_bytes": 17179869184,
"ram_used_bytes": 8589934592,
"uptime_seconds": 3600
},
"network": {
"total_download_gb": 1.25,
"total_upload_gb": 0.85,
"packets_sent": 150000,
"packets_received": 145000
},
"miners": {
"active_count": 5,
"list": [...]
}
}FROM golang:1.21-alpine AS builder
WORKDIR /app
COPY . .
RUN go mod download
RUN go build -o tunnel main.go
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=builder /app/tunnel .
COPY config.yml .
EXPOSE 3333 8080
CMD ["./tunnel"]docker build -t tunnel:latest .
docker run -d -p 3333:3333 -p 8080:8080 --name tunnel tunnel:latestCreate /etc/systemd/system/tunnel.service:
[Unit]
Description=Tunnel Mining Proxy
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/root/tunnel
ExecStart=/root/tunnel/tunnel
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.targetEnable and start:
sudo systemctl daemon-reload
sudo systemctl enable tunnel
sudo systemctl start tunnel
sudo systemctl status tunnel# Application logs
tail -f /var/log/tunnel.log
# Systemd logs
journalctl -u tunnel -fMIT License
- Built with Go
- Uses Gorilla WebSocket
- Database: modernc.org/sqlite
- System metrics: gopsutil
Made by Mytai