Compare commits

...

2 Commits

2 changed files with 15 additions and 5 deletions

View File

@ -17,9 +17,7 @@ Trust stores generated by these scripts can be found at https://tildegit.org/ner
## Dependencies
Required: [OpenSSL](https://www.openssl.org/), [idn](https://www.gnu.org/software/libidn/), [Agunua](https://framagit.org/bortzmeyer/agunua).
Optional: [torsocks](https://packages.debian.org/buster/torsocks) (for .onion capsules and for double-checking certificates using a different network perspective).
[OpenSSL](https://www.openssl.org/), [idn](https://www.gnu.org/software/libidn/), [Agunua](https://framagit.org/bortzmeyer/agunua), [torsocks](https://packages.debian.org/buster/torsocks) (torsocks is used for .onion capsules and for double-checking certificates using a different network perspective).
To install them in Debian, run: `sudo apt install openssl idn torsocks` and `pip3 install agunua`.

View File

@ -69,14 +69,26 @@ finish() {
}
trap finish EXIT
# Check connection to host.
# $1: "" or "tor"
# $2: host[:port]
test_host() {
host="$2"
tor=""
if [ "$1" = "tor" ]; then
tor="--socks 127.0.0.1:9050"
fi
agunua $tor --no-tofu --accept-expired-certificate --ignore-missing-tls-close \
--maximum-time 20 "gemini://$host/" >/dev/null 2>&1
}
# Test if removed hosts are still online.
if [ -f hosts ]; then
echo "Testing removed hosts..."
for removed_host in $(diff hosts "$tempfile" | grep ^\< | cut -c 3-); do
printf "%s" "$removed_host"
# If direct connection fails, try to connect through Tor.
if agunua --no-tofu --maximum-time 20 "$removed_host" >/dev/null 2>&1 || \
agunua --socks 127.0.0.1:9050 --no-tofu --maximum-time 20 "$removed_host" >/dev/null 2>&1; then
if test_host "" "$removed_host" || test_host "tor" "$removed_host"; then
echo " - ONLINE"
# Add removed host back.
hosts="$hosts