Spaces:
Paused
Paused
Commit ·
51c527c
1
Parent(s): 2e7fb4b
Update start.sh
Browse files
start.sh
CHANGED
|
@@ -1,9 +1,10 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
|
| 5 |
-
#
|
| 6 |
|
|
|
|
| 7 |
run_warp() {
|
| 8 |
echo "Setting up WARP..."
|
| 9 |
# Check if an account file already exists
|
|
@@ -16,24 +17,22 @@ run_warp() {
|
|
| 16 |
|
| 17 |
echo "Generating WireProxy config..."
|
| 18 |
# Generate WireGuard profile from account
|
| 19 |
-
wgcf generate --config /config/wgcf-account.toml --profile /config/wgcf-profile.conf
|
| 20 |
|
| 21 |
# Extract info from the WireGuard profile to create wireproxy.conf
|
| 22 |
PRIVATE_KEY=$(grep "PrivateKey" /config/wgcf-profile.conf | cut -d' ' -f3)
|
| 23 |
PUBLIC_KEY=$(grep "PublicKey" /config/wgcf-profile.conf | cut -d' ' -f3)
|
| 24 |
-
RESERVED=$(grep "Reserved" /config/wgcf-profile.conf | cut -d' ' -f3)
|
| 25 |
ENDPOINT=$(grep "Endpoint" /config/wgcf-profile.conf | cut -d' ' -f3)
|
| 26 |
|
| 27 |
# Create wireproxy.conf
|
| 28 |
cat > /config/wireproxy.conf <<EOF
|
| 29 |
-
[
|
| 30 |
PrivateKey = $PRIVATE_KEY
|
| 31 |
Address = 172.16.0.2/32
|
| 32 |
DNS = 1.1.1.1
|
| 33 |
|
| 34 |
[Peer]
|
| 35 |
PublicKey = $PUBLIC_KEY
|
| 36 |
-
Reserved = $RESERVED
|
| 37 |
Endpoint = $ENDPOINT
|
| 38 |
PersistentKeepalive = 25
|
| 39 |
|
|
@@ -48,38 +47,46 @@ EOF
|
|
| 48 |
echo "WARP SOCKS5 proxy should be running on 127.0.0.1:40000"
|
| 49 |
}
|
| 50 |
|
| 51 |
-
# 1. Start WARP
|
| 52 |
-
run_warp
|
| 53 |
|
| 54 |
-
#
|
| 55 |
-
sleep 3
|
| 56 |
-
|
| 57 |
-
# Function to run chisel client in a loop
|
| 58 |
run_chisel() {
|
| 59 |
while true; do
|
| 60 |
-
echo "Starting chisel client
|
| 61 |
-
|
|
|
|
| 62 |
echo "Chisel client exited. Restarting in 5 seconds..."
|
| 63 |
-
sleep
|
| 64 |
done
|
| 65 |
}
|
| 66 |
|
| 67 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
run_chisel &
|
| 69 |
|
| 70 |
-
# Wait a moment for the background process to
|
| 71 |
-
sleep
|
| 72 |
|
| 73 |
-
#
|
| 74 |
-
|
|
|
|
| 75 |
|
| 76 |
-
|
| 77 |
/usr/local/x-ui/x-ui setting -webBasePath /
|
| 78 |
|
| 79 |
-
|
| 80 |
/usr/local/x-ui/x-ui setting -username prog10 -password 04091968
|
| 81 |
|
| 82 |
-
# Start
|
| 83 |
echo "Starting x-ui panel..."
|
| 84 |
cd /usr/local/x-ui
|
| 85 |
-
./x-ui
|
|
|
|
| 1 |
+
##!/bin/bash
|
| 2 |
|
| 3 |
+
# ==============================================================================
|
| 4 |
+
# WARP + X-UI & Chisel Tunnel Start Script
|
| 5 |
+
# ==============================================================================
|
| 6 |
|
| 7 |
+
# --- WARP SOCKS5 Proxy Setup ---
|
| 8 |
run_warp() {
|
| 9 |
echo "Setting up WARP..."
|
| 10 |
# Check if an account file already exists
|
|
|
|
| 17 |
|
| 18 |
echo "Generating WireProxy config..."
|
| 19 |
# Generate WireGuard profile from account
|
| 20 |
+
wgcf generate --config /config/wgcf-account.toml --profile /config/wgcf-profile.conf
|
| 21 |
|
| 22 |
# Extract info from the WireGuard profile to create wireproxy.conf
|
| 23 |
PRIVATE_KEY=$(grep "PrivateKey" /config/wgcf-profile.conf | cut -d' ' -f3)
|
| 24 |
PUBLIC_KEY=$(grep "PublicKey" /config/wgcf-profile.conf | cut -d' ' -f3)
|
|
|
|
| 25 |
ENDPOINT=$(grep "Endpoint" /config/wgcf-profile.conf | cut -d' ' -f3)
|
| 26 |
|
| 27 |
# Create wireproxy.conf
|
| 28 |
cat > /config/wireproxy.conf <<EOF
|
| 29 |
+
[Interface]
|
| 30 |
PrivateKey = $PRIVATE_KEY
|
| 31 |
Address = 172.16.0.2/32
|
| 32 |
DNS = 1.1.1.1
|
| 33 |
|
| 34 |
[Peer]
|
| 35 |
PublicKey = $PUBLIC_KEY
|
|
|
|
| 36 |
Endpoint = $ENDPOINT
|
| 37 |
PersistentKeepalive = 25
|
| 38 |
|
|
|
|
| 47 |
echo "WARP SOCKS5 proxy should be running on 127.0.0.1:40000"
|
| 48 |
}
|
| 49 |
|
|
|
|
|
|
|
| 50 |
|
| 51 |
+
# --- Chisel Client Configuration ---
|
|
|
|
|
|
|
|
|
|
| 52 |
run_chisel() {
|
| 53 |
while true; do
|
| 54 |
+
echo "Starting chisel client..."
|
| 55 |
+
/usr/local/bin/chisel client -v --auth "cloud:2025" "https://vds1.iri1968.dpdns.org/chisel-ws" R:8001:127.0.0.1:2053
|
| 56 |
+
|
| 57 |
echo "Chisel client exited. Restarting in 5 seconds..."
|
| 58 |
+
sleep 5
|
| 59 |
done
|
| 60 |
}
|
| 61 |
|
| 62 |
+
# --- Main Execution ---
|
| 63 |
+
|
| 64 |
+
# 1. Start cron daemon for sync jobs
|
| 65 |
+
echo "Starting cron daemon..."
|
| 66 |
+
cron
|
| 67 |
+
echo "Cron daemon started."
|
| 68 |
+
|
| 69 |
+
# 2. Start WARP
|
| 70 |
+
run_warp
|
| 71 |
+
|
| 72 |
+
# 2. Start chisel client in the background.
|
| 73 |
+
echo "Forking chisel client to background..."
|
| 74 |
run_chisel &
|
| 75 |
|
| 76 |
+
# Wait a moment for the background process to establish the tunnel.
|
| 77 |
+
sleep 3
|
| 78 |
|
| 79 |
+
# 3. Configure X-UI Panel
|
| 80 |
+
echo "Configuring x-ui panel port..."
|
| 81 |
+
/usr/local/x-ui/x-ui setting -port 2053
|
| 82 |
|
| 83 |
+
echo "Configuring x-ui web base path..."
|
| 84 |
/usr/local/x-ui/x-ui setting -webBasePath /
|
| 85 |
|
| 86 |
+
echo "Resetting x-ui admin credentials..."
|
| 87 |
/usr/local/x-ui/x-ui setting -username prog10 -password 04091968
|
| 88 |
|
| 89 |
+
# 4. Start X-UI Panel
|
| 90 |
echo "Starting x-ui panel..."
|
| 91 |
cd /usr/local/x-ui
|
| 92 |
+
./x-ui
|