Simpler tor bridge removal by nickname
This commit is contained in:
parent
b322ea8436
commit
065394c83c
|
@ -797,28 +797,37 @@ function add_tor_bridge {
|
|||
}
|
||||
|
||||
function remove_tor_bridge {
|
||||
bridge_removed=
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
dialog --backtitle $"Freedombone Control Panel" \
|
||||
--title $"Remove obfs4 Tor bridge" \
|
||||
--form "\n" 7 60 1 \
|
||||
$"IP address:" 1 1 " . . . " 1 15 16 16 \
|
||||
2> $data
|
||||
dialog --title $"Remove obfs4 Tor bridge" \
|
||||
--backtitle $"Freedombone Control Panel" \
|
||||
--inputbox $"Enter the IP address, key or Nickname of the bridge" 8 65 2>$data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) return;;
|
||||
255) return;;
|
||||
0)
|
||||
response=$(<$data)
|
||||
if [ ${#response} -gt 2 ]; then
|
||||
if [[ "${response}" != *" "* ]]; then
|
||||
if [[ "${response}" == *"."* ]]; then
|
||||
if grep "Bridge ${response}" /etc/tor/torrc; then
|
||||
tor_remove_bridge "${response}"
|
||||
bridge_removed=1
|
||||
fi
|
||||
else
|
||||
if grep " $response" /etc/tor/torrc; then
|
||||
tor_remove_bridge "${response}"
|
||||
bridge_removed=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
bridge_ip_address=$(cat $data | sed -n 1p)
|
||||
if [[ "${bridge_ip_address}" == *" "* ]]; then
|
||||
return
|
||||
fi
|
||||
if [[ "${bridge_ip_address}" != *"."* ]]; then
|
||||
return
|
||||
fi
|
||||
tor_remove_bridge "${bridge_ip_address}"
|
||||
if [ $bridge_removed ]; then
|
||||
dialog --title $"Remove obfs4 Tor bridge" \
|
||||
--msgbox $"Bridge removed" 6 40
|
||||
fi
|
||||
}
|
||||
|
||||
function add_tor_bridge_relay {
|
||||
|
|
|
@ -447,7 +447,15 @@ function tor_remove_bridge {
|
|||
bridge_ip_address="$1"
|
||||
bridge_type='obfs4'
|
||||
|
||||
if [[ "$bridge_ip_address" == *"."* ]]; then
|
||||
bridge_str="Bridge $bridge_type ${bridge_ip_address}"
|
||||
else
|
||||
if grep " ${bridge_ip_address}" /etc/tor/torrc; then
|
||||
bridge_str=" ${bridge_ip_address}"
|
||||
else
|
||||
return
|
||||
fi
|
||||
fi
|
||||
if grep "${bridge_str}" /etc/tor/torrc; then
|
||||
sed -i "/${bridge_str}/d" /etc/tor/torrc
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue