LC_ALL=C
export TZ LC_ALL
-for p in sort sleep cat awk tee date fping find head
+for p in sort sleep cat awk tee date fping find head clear
do
type "${p}" >/dev/null || { printf 'FATAL: Required program "%s" not installed.\n' "${p}" >&2; exit 1; }
done
printf '\n\n' >&2
}
+_h() {
+ local l
+ l=$(( 60 - ${#1} ))
+ clear
+ printf '=== [ %s ] %'"${l}"'s \n\n' "${1}" "===" >&2
+}
+
+
fpo="/tmp/fping_${$}.out"
sto="${fpo}.stats"
cfgo="./sqm_lagthrottle.conf.$(date +%s)"
set -u
-echo "Welcome to the interactive sqm_lagthrottle configuration wizard." >&2
+_h "sqm_lagthrottle configuration wizard - WELCOME"
echo "" >&2
printf 'This script will prompt you for a number of settings\n(recommending sensible defaults where thought possible)\nrequired for proper operation of sqm_lagthrottle.\n\nPlease take a few minutes to follow its instructions\nto make the most out of dynamically adjusting your\nbandwidth shaper.\n'
_goon
_goon
+_h "set SQM device (downstream)"
ifb_dev=$(find /sys/devices/virtual/net/ -name ifb\* -print | head -n 1)
if [ -e /sys/devices/virtual/net/ifb* ]
then
stats_rx="${ifb_dev}"/statistics/tx_bytes
iface_rx="${ifb_dev%%*/}"
+_goon
+_h "set bandwidth limits"
printf 'Please key in the positive integer LOWER bound (=minimum) bandwidth in Kbps\nfor your downstream Internet connection that you want to shape to: ' >&2
read bw_down_min
echo "" >&2
read bw_down_max
echo "" >&2
-if ! [ ${bw_down_min} -lt ${bw_down_max} ]
+if ! [ ${bw_down_min}0 -lt ${bw_down_max}0 ]
then
printf 'FATAL: Maximum shaping bandwith must be greater than minimum.\n'
exit 1
fi
+_goon
+_h "configure sqm_lagthrottle behavior"
printf 'sqm_lagthrottle can be configured to prioritize bandwith over latency,\nor vice versa.\n\nIf you would prefer to keep configured target bandwidth high even in\nthe face of worsening latency/bufferbloat, please key in "bandwith" below.\n\nAll other inputs will lead to a preference for lower latency.\n\n\t'
read bw_or_lat_bias
if [ x${bw_or_lat_bias} = xbandwidth ]
relaxed_or_eager="eager"
fi
printf 'Effective choice: [%s]\n\n' "${relaxed_or_eager}"
-echo "" >&2
-echo "" >&2
+_goon
+
+_h "automatic ping peer selection"
-printf 'Now, we will ping potential ICMP ECHO peers for a few minutes,\nrecord stats, and determine the top four peer choices.\n\nPlease keep your Internet-directed traffic at a minimum while this is happening!\n' >&2
+printf 'Now, we will ping potential ICMP ECHO peers for a few minutes,\nrecord stats, and determine the top four peer choices.\n\nPlease keep your Internet-directed traffic AT A MINIMUM while\nthis task is active!\n' >&2
_goon
printf 'Performing pings, please be patient...' >&2