34 lines
811 B
Bash
Executable File
34 lines
811 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
# Colors for output
|
|
GREEN='\033[0;32m'
|
|
RED='\033[0;31m'
|
|
NC='\033[0m' # No Color
|
|
|
|
echo -e "${GREEN}Building SSH Tunnel Manager...${NC}"
|
|
|
|
# Check if Go is installed
|
|
if ! command -v go &> /dev/null; then
|
|
echo -e "${RED}Error: Go is not installed. Please install Go first.${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
# Create bin directory if it doesn't exist
|
|
mkdir -p bin
|
|
|
|
# Build the application
|
|
echo "Compiling..."
|
|
go build -o bin/sshtunnel ./cmd
|
|
|
|
# Make the binary executable
|
|
chmod +x bin/sshtunnel
|
|
|
|
echo -e "${GREEN}Build successful! Binary is available at bin/sshtunnel${NC}"
|
|
echo ""
|
|
echo "Usage examples:"
|
|
echo " ./bin/sshtunnel list"
|
|
echo " ./bin/sshtunnel start -local 8080 -remote 80 -host example.com -server user@ssh-server.com"
|
|
echo " ./bin/sshtunnel stop -id 1"
|
|
echo " ./bin/sshtunnel stop -all" |