Skip to content

Commit 3429c82

Browse files
committed
fix: squid start
1 parent 25773ad commit 3429c82

3 files changed

Lines changed: 28 additions & 4 deletions

File tree

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ RUN apt update && \
88
iproute2 \
99
socat \
1010
squid \
11+
curl net-tools \
1112
ca-certificates && \
1213
# 清理缓存
1314
apt clean && \

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,6 @@ docker rm vpn-proxy
174174

175175
# 参考
176176

177-
https://github.com/Ericwyn/ovpn-proxy
177+
https://github.com/Ericwyn/ovpn-proxy
178+
179+
https://github.com/JefferyBoy/openvpn-to-http-proxy

start.sh

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22

33
set -e
44

5-
echo "==== Try Start Squid Proxy ===="
6-
# 启动 squid
7-
squid
5+
# Start squid service
6+
start_squid()
7+
{
8+
service squid start
9+
if [ ! `service squid status | grep "squid is running" | wc -l` -gt 0 ]; then
10+
echo "Error: failed to start squid service" >&2;
11+
return 1
12+
fi
13+
return 0
14+
}
815

916
# 启动OpenVPN (后台运行)
1017
echo "=== Starting OpenVPN ==="
@@ -16,6 +23,20 @@ echo "=== Starting RDP Forwarder ==="
1623
/rdp-forward.sh &
1724
RDP_FORWARD_PID=$!
1825

26+
echo "==== Try Start Squid Proxy ===="
27+
# 启动 squid
28+
for i in `seq 3`
29+
do
30+
start_squid
31+
if [ $? -eq 0 ]; then
32+
break
33+
fi
34+
if [ $i -eq 3 ]; then
35+
echo "Error: failed to start squid service." >&2
36+
exit 1
37+
fi
38+
done
39+
service squid status
1940

2041
# 捕获退出信号
2142
trap "kill $OPENVPN_PID $RDP_FORWARD_PID 2>/dev/null; exit 0" SIGINT SIGTERM

0 commit comments

Comments
 (0)