update dockerfile

This commit is contained in:
Jason
2020-08-31 02:52:44 +08:00
parent 2eb63fbdbd
commit 945daa2ee6
2 changed files with 5 additions and 8 deletions

View File

@@ -13,11 +13,11 @@ RUN apk add --update --no-cache \
FROM alpine:latest
COPY ./tun2socks.sh /
COPY ./entrypoint.sh /
COPY --from=builder /tun2socks-src/bin/tun2socks /tun2socks
RUN apk add --update --no-cache iptables iproute2 \
&& chmod +x /tun2socks.sh
&& chmod +x /entrypoint.sh
ENV TUN tun0
ENV ETH eth0
@@ -34,4 +34,4 @@ ENV FAKEDNS=
ENV BACKEND_DNS=
ENV HOSTS=
ENTRYPOINT ["/tun2socks.sh"]
ENTRYPOINT ["/entrypoint.sh"]

View File

@@ -2,12 +2,9 @@
TUN="${TUN:-tun0}"
ETH="${ETH:-eth0}"
ETH_ADDR="${ETH_ADDR:-172.16.1.1}"
TUN_ADDR="${TUN_ADDR:-198.18.0.1}"
TUN_MASK="${TUN_MASK:-255.254.0.0}"
PROXY="${PROXY:-172.16.1.2:1080}"
LOGLEVEL="${LOGLEVEL:-warning}"
EXCLUDED="${EXCLUDED:-172.16.1.2/32}"
MONITOR="${MONITOR:-1}"
MONITOR_ADDR="${MONITOR_ADDR:-0.0.0.0:80}"
@@ -25,9 +22,9 @@ ip route del default > /dev/null
ip route add default via "$TUN_ADDR" dev "$TUN"
# add to ip route
for ip in $(echo "$EXCLUDED" | tr ',' '\n')
for addr in $(echo "$EXCLUDED" | tr ',' '\n')
do
ip route add "$ip" via "$ETH_ADDR"
ip route add "$addr" via "$ETH_ADDR"
done
if [ -n "$EXTRACMD" ]; then