diff --git a/.gitignore b/.gitignore index b95279c..6dd3af6 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,6 @@ build_hook.go *.md !LICENSE !README_FA.md -!.bat \ No newline at end of file +!README.md +!Linux/ +!Linux/*.sh \ No newline at end of file diff --git a/Linux/README.md b/Linux/README.md new file mode 100644 index 0000000..92093a7 --- /dev/null +++ b/Linux/README.md @@ -0,0 +1,77 @@ +# MHR-CFW Go - Linux / Termux + +Scripts to build and run MHR-CFW on Linux and Termux (Android). + +## Requirements + +### Linux +- Go 1.22+ +- Git + +### Termux +```bash +pkg install golang git +``` + +## Quick Start + +### 1. Clone the project (or copy Linux folder) +```bash +git clone https://github.com/ThisIsDara/mhr-cfw-go.git +cd mhr-cfw-go/Linux +``` + +### 2. Build +```bash +chmod +x build.sh +./build.sh +``` + +### 3. Run +```bash +chmod +x run.sh +./run.sh +``` + +Or run directly: +```bash +./mhr-cfw-go +``` + +## Scripts + +| Script | Description | +| --- | --- | +| `build.sh` | Build the Go binary | +| `run.sh` | Run the proxy | +| `termux-setup.sh` | Install dependencies and build for Termux | + +## Usage + +```bash +# Run with menu +./mhr-cfw-go + +# Run without menu +./mhr-cfw-go --no-menu + +# Install CA certificate +./mhr-cfw-go --install-cert + +# Show version +./mhr-cfw-go --version +``` + +## Default Ports +- HTTP Proxy: `127.0.0.1:8080` +- SOCKS5 Proxy: `127.0.0.1:1080` + +## Termux Notes + +1. Install Termux from F-Droid or Play Store +2. Run `termux-setup.sh` to install dependencies +3. The proxy will work the same as on desktop + +## Stopping + +Press `Ctrl+C` to stop the proxy. \ No newline at end of file diff --git a/Linux/build.sh b/Linux/build.sh new file mode 100644 index 0000000..7615ada --- /dev/null +++ b/Linux/build.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +echo "========================================" +echo " MHR-CFW Go - Build Script" +echo "========================================" +echo "" + +if [ ! -f "go.mod" ]; then + echo "Error: go.mod not found" + exit 1 +fi + +echo "Building mhr-cfw-go..." +go build -ldflags "-s -w" -o mhr-cfw-go ./cmd/mhr-cfw + +if [ $? -ne 0 ]; then + echo "" + echo "Build FAILED!" + exit 1 +fi + +echo "" +echo "Build successful: mhr-cfw-go" +echo "========================================" \ No newline at end of file diff --git a/Linux/run.sh b/Linux/run.sh new file mode 100644 index 0000000..1170479 --- /dev/null +++ b/Linux/run.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +echo "========================================" +echo " MHR-CFW Go" +echo "========================================" +echo "" + +if [ ! -f "mhr-cfw-go" ]; then + echo "Error: mhr-cfw-go not found" + echo "Run build.sh first to build the executable" + exit 1 +fi + +echo "Starting proxy server..." +echo "" +echo "Default: http://127.0.0.1:8080" +echo "Default SOCKS5: 127.0.0.1:1080" +echo "" +echo "Press Ctrl+C to stop" +echo "========================================" +echo "" + +./mhr-cfw-go "$@" \ No newline at end of file diff --git a/Linux/termux-setup.sh b/Linux/termux-setup.sh new file mode 100644 index 0000000..fa10930 --- /dev/null +++ b/Linux/termux-setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Termux setup script for MHR-CFW Go + +echo "========================================" +echo " MHR-CFW Go - Termux Setup" +echo "========================================" +echo "" + +# Check if running in Termux +if [ ! -d "$PREFIX" ]; then + echo "Error: This script must be run in Termux" + exit 1 +fi + +echo "Installing dependencies..." +pkg update -y +pkg install -y golang git + +echo "" +echo "Building mhr-cfw-go..." +go build -ldflags "-s -w" -o mhr-cfw-go ./cmd/mhr-cfw + +if [ $? -ne 0 ]; then + echo "" + echo "Build FAILED!" + exit 1 +fi + +echo "" +echo "Build successful!" +echo "" +echo "Run: ./run.sh" +echo "========================================" \ No newline at end of file