Skip to content

Commit

Permalink
Merge pull request #5 from h0tw1r3/improve-script
Browse files Browse the repository at this point in the history
optimize script ipv6 condition
  • Loading branch information
h0tw1r3 authored Apr 22, 2024
2 parents 05a7b86 + b2ef07d commit b4b225f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
9 changes: 3 additions & 6 deletions scripts/shield-trigger
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@ null_route() {
# louzy detection of IPv4 or IPv6 address
#
TASK="$1"
INET=$(echo "$2" | sed 's/[0-9\.]//g')
if [ -z "$INET" ]
then
INET=""
GW="127.0.0.1"
else
INET=""
GW="127.0.0.1"
if [ "${2#*:}" != "$2" ] ; then
INET="-f inet6"
GW="::1"
fi
Expand Down
12 changes: 2 additions & 10 deletions scripts/shield-trigger-iptables
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,8 @@
#

run_iptables() {
#
# louzy detection of IPv4 or IPv6 address
#
IPT=$(echo "$2" | sed 's/[0-9\.]//g')
if [ -z "$IPT" ]
then
IPT=iptables
else
IPT=ip6tables
fi
IPT="iptables"
[ "${2#*:}" != "$2" ] && IPT="ip6tables"

# switch -A for iptables to -I
if [ "$1" = "-A" ]
Expand Down

0 comments on commit b4b225f

Please sign in to comment.