Add Mac client mode and simplify local proxy UI
This commit is contained in:
@@ -4,18 +4,24 @@ set -euo pipefail
|
||||
BASE_IMAGE="${BASE_IMAGE:-mirror.gcr.io/library/debian:bookworm-slim}"
|
||||
RUNTIME_BASE_IMAGE="${RUNTIME_BASE_IMAGE:-vpn-proxy-runtime-base:bookworm-slim}"
|
||||
SINGBOX_VERSION="${SINGBOX_VERSION:-1.12.13}"
|
||||
APT_MIRROR="${APT_MIRROR:-http://mirror.yandex.ru/debian}"
|
||||
APT_SECURITY_MIRROR="${APT_SECURITY_MIRROR:-http://mirror.yandex.ru/debian-security}"
|
||||
HTTP_PROXY="${HTTP_PROXY:-$(docker info 2>/dev/null | awk -F': ' '/HTTP Proxy:/ {print $2; exit}')}"
|
||||
HTTPS_PROXY="${HTTPS_PROXY:-$(docker info 2>/dev/null | awk -F': ' '/HTTPS Proxy:/ {print $2; exit}')}"
|
||||
NO_PROXY="${NO_PROXY:-$(docker info 2>/dev/null | awk -F': ' '/No Proxy:/ {print $2; exit}')}"
|
||||
|
||||
echo "Building runtime base: ${RUNTIME_BASE_IMAGE}"
|
||||
echo "Source base image: ${BASE_IMAGE}"
|
||||
echo "APT mirror: ${APT_MIRROR}"
|
||||
echo "APT security mirror: ${APT_SECURITY_MIRROR}"
|
||||
if [ -n "${HTTP_PROXY}" ]; then echo "HTTP proxy: ${HTTP_PROXY}"; fi
|
||||
if [ -n "${HTTPS_PROXY}" ]; then echo "HTTPS proxy: ${HTTPS_PROXY}"; fi
|
||||
|
||||
docker build \
|
||||
--build-arg BASE_IMAGE="${BASE_IMAGE}" \
|
||||
--build-arg SINGBOX_VERSION="${SINGBOX_VERSION}" \
|
||||
--build-arg APT_MIRROR="${APT_MIRROR}" \
|
||||
--build-arg APT_SECURITY_MIRROR="${APT_SECURITY_MIRROR}" \
|
||||
--build-arg HTTP_PROXY="${HTTP_PROXY}" \
|
||||
--build-arg HTTPS_PROXY="${HTTPS_PROXY}" \
|
||||
--build-arg NO_PROXY="${NO_PROXY}" \
|
||||
|
||||
78
scripts/install-macos-client.sh
Executable file
78
scripts/install-macos-client.sh
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
INSTALL_DIR="${VPN_PROXY_INSTALL_DIR:-$HOME/.vpn-proxy-client}"
|
||||
REPO_URL="${VPN_PROXY_REPO_URL:-https://git.dokops.ru/dokril/vpn-proxy.git}"
|
||||
BRANCH="${VPN_PROXY_BRANCH:-master}"
|
||||
COMPOSE_FILE="docker-compose.client.yml"
|
||||
|
||||
log() {
|
||||
printf '[vpn-proxy-client] %s\n' "$*"
|
||||
}
|
||||
|
||||
die() {
|
||||
printf '[vpn-proxy-client] error: %s\n' "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
need() {
|
||||
command -v "$1" >/dev/null 2>&1 || die "$1 is required"
|
||||
}
|
||||
|
||||
if [[ "$(uname -s)" != "Darwin" ]]; then
|
||||
die "this installer is intended for macOS"
|
||||
fi
|
||||
|
||||
need git
|
||||
need docker
|
||||
|
||||
docker compose version >/dev/null 2>&1 || die "Docker Compose plugin is required"
|
||||
docker info >/dev/null 2>&1 || die "Docker Desktop is not running"
|
||||
|
||||
if [[ -d "$INSTALL_DIR/.git" ]]; then
|
||||
log "updating $INSTALL_DIR"
|
||||
git -C "$INSTALL_DIR" fetch origin "$BRANCH"
|
||||
git -C "$INSTALL_DIR" checkout "$BRANCH"
|
||||
git -C "$INSTALL_DIR" pull --ff-only origin "$BRANCH"
|
||||
else
|
||||
log "cloning $REPO_URL#$BRANCH to $INSTALL_DIR"
|
||||
mkdir -p "$(dirname "$INSTALL_DIR")"
|
||||
git clone --branch "$BRANCH" "$REPO_URL" "$INSTALL_DIR"
|
||||
fi
|
||||
|
||||
cd "$INSTALL_DIR"
|
||||
|
||||
if [[ ! -f .env && -f .env.example ]]; then
|
||||
cp .env.example .env
|
||||
fi
|
||||
|
||||
log "building and starting Docker client"
|
||||
docker compose -f "$COMPOSE_FILE" up -d --build
|
||||
|
||||
cat <<'EOF'
|
||||
|
||||
VPN Proxy Client is running.
|
||||
|
||||
UI:
|
||||
http://127.0.0.1:3456
|
||||
|
||||
Proxy:
|
||||
HTTP/SOCKS5 127.0.0.1:8080
|
||||
|
||||
Useful commands:
|
||||
cd ~/.vpn-proxy-client
|
||||
docker compose -f docker-compose.client.yml logs -f
|
||||
docker compose -f docker-compose.client.yml restart
|
||||
docker compose -f docker-compose.client.yml down
|
||||
|
||||
Optional macOS system proxy example:
|
||||
networksetup -setwebproxy Wi-Fi 127.0.0.1 8080
|
||||
networksetup -setsecurewebproxy Wi-Fi 127.0.0.1 8080
|
||||
networksetup -setsocksfirewallproxy Wi-Fi 127.0.0.1 8080
|
||||
|
||||
Disable later:
|
||||
networksetup -setwebproxystate Wi-Fi off
|
||||
networksetup -setsecurewebproxystate Wi-Fi off
|
||||
networksetup -setsocksfirewallproxystate Wi-Fi off
|
||||
|
||||
EOF
|
||||
Reference in New Issue
Block a user