blob: acadcb7677d05ccc499d49044c4287a9c20c77a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/usr/bin/env bash
set -xeuo pipefail
# Hostname must be syncd in `tests/chutney/integration-e2e-shadow`.
TEST_DOMAIN=example.com
if [ -n "${RUNNING_IN_SHADOW:-}" ]; then
# Resolving DNS through tor in shadow is currently broken:
# <https://github.com/shadow/shadow/issues/323>.
#
# We can still do the "curl" test (using --socks5 instead of
# --socks5-hostname to resolve locally).
#
# TODO: Fix or work around this. e.g. run a local `unbound` resolver inside
# the simulation.
curl http://"$TEST_DOMAIN" -vs --socks5 127.0.0.1:9150 -o /dev/null
else
curl http://"$TEST_DOMAIN" -vs --socks5-hostname 127.0.0.1:9150 -o /dev/null
DIRECT_LOOKUP="$(dig +short $TEST_DOMAIN A)"
TOR_LOOKUP="$(dig @127.0.0.1 -p 35353 +short $TEST_DOMAIN A)"
[ "$DIRECT_LOOKUP" == "$TOR_LOOKUP" ]
fi
## This test only work on a chutney network with IPv6 support such as ipv6-exit-min,
## sadly such a network can't run in CI because there is no IPv6 in docker (nor in shadow).
#[ "$(dig @127.0.0.1 -p 35353 +short example.com AAAA)" == "2606:2800:220:1:248:1893:25c8:1946" ]
|