fixed identation and make status default command

This commit is contained in:
System Administrator 2024-03-19 11:38:12 +11:00
parent a747348477
commit dd6b3538d6

View File

@ -13,7 +13,7 @@ IPTABLES_CMD=iptables-legacy
ZT_IFACE="zt+" ZT_IFACE="zt+"
# function to add and remove the requisite rules # function to add and remove the requisite rules
# - $1 is either "A" (add) or "D" (delete) # - $1 is either "I" (insert), "A" (add) or "D" (delete)
# - $2 is requested mode # - $2 is requested mode
_update_iptables() { _update_iptables() {
local action local action
@ -87,16 +87,16 @@ _get_current_mode() {
_usage() { _usage() {
echo "Usage: $0 inbound | outbound | both | none | disable | status" echo "Usage: $0 [inbound | outbound | both | none | disable | status]"
echo "Set, query or disable gateway mode." echo "Set, query or disable gateway mode."
echo "" echo ""
echo "Commands:" echo "Command:"
echo " inbound Only permit traffic from the ZeroTier cloud to the local physical interfaces." echo " inbound Only permit traffic from the ZeroTier cloud to the local physical interfaces."
echo " outbound Only permit traffic from the local physical interfaces to the ZeroTier cloud." echo " outbound Only permit traffic from the local physical interfaces to the ZeroTier cloud."
echo " both Permit bi-directional traffic between the local physical interfaces and the ZeroTier cloud." echo " both Permit bi-directional traffic between the local physical interfaces and the ZeroTier cloud."
echo " none Block all traffic between the local physical interfaces and the ZeroTier cloud." echo " none Block all traffic between the local physical interfaces and the ZeroTier cloud."
echo " disable Remove iptable rules. NOTE: because default forward rule is accept, this behaves like \"both\"." echo " disable Remove iptable rules. NOTE: because default forward rule is accept, this behaves like \"both\"."
echo " status Show current gateway mode (e.g. inbound, outbound, etc)" echo " status Show current gateway mode (e.g. inbound, outbound, etc). Default if no command specified."
echo "" echo ""
exit $1 exit $1
} }
@ -160,8 +160,7 @@ main() {
echo ${mode} echo ${mode}
;; ;;
"" ) "" )
echo "Please specify a valid argument." echo ${mode}
_usage 0
;; ;;
* ) * )
echo "Warning: Gateway mode (${1}) is not supported - ignored" echo "Warning: Gateway mode (${1}) is not supported - ignored"