diff --git a/docker/v2ray/run.sh b/docker/v2ray/run.sh index a3ee9536..2e021e55 100644 --- a/docker/v2ray/run.sh +++ b/docker/v2ray/run.sh @@ -1,5 +1,14 @@ #!/bin/bash +UPTIME=`cat /proc/uptime |awk '{print $1}'` +if [[ `echo "$UPTIME < 100"|bc` -eq 1 ]];then + LOCAL_IP=`curl -s http://api.ipify.org 2>/dev/null` + if [[ -e /root/.iptables ]];then + [[ `echo $LOCAL_IP|grep :` ]] && IPTABLE_WAY="ip6tables" || IPTABLE_WAY="iptables" + $IPTABLE_WAY-restore -c < /root/.iptables + fi +fi + if [[ ! -e /etc/v2ray ]];then mkdir /etc/v2ray v2ray new >/dev/null 2>&1 diff --git a/docker/xray/run.sh b/docker/xray/run.sh index 78b7ff58..be493e1a 100644 --- a/docker/xray/run.sh +++ b/docker/xray/run.sh @@ -1,5 +1,14 @@ #!/bin/bash +UPTIME=`cat /proc/uptime |awk '{print $1}'` +if [[ `echo "$UPTIME < 100"|bc` -eq 1 ]];then + LOCAL_IP=`curl -s http://api.ipify.org 2>/dev/null` + if [[ -e /root/.iptables ]];then + [[ `echo $LOCAL_IP|grep :` ]] && IPTABLE_WAY="ip6tables" || IPTABLE_WAY="iptables" + $IPTABLE_WAY-restore -c < /root/.iptables + fi +fi + if [[ ! -e /etc/xray ]];then mkdir /etc/xray xray new >/dev/null 2>&1 diff --git a/setup.py b/setup.py index e6e59c19..250cfaf2 100644 --- a/setup.py +++ b/setup.py @@ -40,5 +40,6 @@ 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', ] ) \ No newline at end of file diff --git a/v2ray.sh b/v2ray.sh index 0ff7f1ba..c5aa9463 100644 --- a/v2ray.sh +++ b/v2ray.sh @@ -102,6 +102,8 @@ removeV2Ray() { rm -rf /etc/bash_completion.d/v2ray.bash >/dev/null 2>&1 rm -rf /usr/local/bin/v2ray >/dev/null 2>&1 rm -rf /etc/v2ray_util >/dev/null 2>&1 + rm -rf /etc/profile.d/iptables.sh >/dev/null 2>&1 + rm -rf /root/.iptables >/dev/null 2>&1 #删除v2ray定时更新任务 crontab -l|sed '/SHELL=/d;/v2ray/d'|sed '/SHELL=/d;/xray/d' > crontab.txt @@ -162,6 +164,16 @@ installDependent(){ updateProject() { [[ ! $(type pip 2>/dev/null) ]] && colorEcho $RED "pip no install!" && exit 1 + if [[ -e /etc/v2ray_util && ! -e /etc/profile.d/iptables.sh ]];then + LOCAL_IP=`curl -s http://api.ipify.org 2>/dev/null` + [[ `echo $LOCAL_IP|grep :` ]] && IPTABLE_WAY="ip6tables" || IPTABLE_WAY="iptables" + cat > /etc/profile.d/iptables.sh << EOF +#!/bin/bash +$IPTABLE_WAY-restore -c < /root/.iptables +EOF + chmod +x /etc/profile.d/iptables.sh + fi + pip install -U v2ray_util if [[ -e $UTIL_PATH ]];then diff --git a/v2ray_util/__init__.py b/v2ray_util/__init__.py index be5667b6..a1f94d93 100644 --- a/v2ray_util/__init__.py +++ b/v2ray_util/__init__.py @@ -1,4 +1,4 @@ -__version__ = '3.10.5.3' +__version__ = '3.10.6' import sys if "xray" in sys.argv[0]: