-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathcrawl-for-broken-links.sh
executable file
·56 lines (51 loc) · 1.32 KB
/
crawl-for-broken-links.sh
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
set -o xtrace
if [[ $# -eq 0 || $1 =~ -h|(--)?help ]]; then
echo "ERROR: need URL to check as first param. Extra params are passed to muffet" >&2
exit 1
else
SERVER="$1"
shift
fi
# ignores all http:// links because they're probably examples, not functioning links
# ignores https:// links matching EXCLUDE_PATTERN
EXCLUDE_PATTERN="(http://|https://("
while read -r; do
EXCLUDE_PATTERN+="${REPLY}|"
done<<EOF
www\.google\.com/search
www\.googletagmanager\.com
play\.google\.com
apps\.apple\.com
www\.reddit\.com/r/openziti
.*#(__)?docusaurus_skipToContent_fallback$
.*\.ziti
.*\.zitik8s
.*\.svc
.*\.internal
.*\.private
.*\.home
.*\.lan
twitter\.com/(OpenZiggy|OpenZiti)
x\.com/(OpenZiggy|OpenZiti)
landing.openziti.io/
fonts.gstatic.com/
github\.com/.*#
.*\.?example\.(com|net|org)
openziti.io(/comments)?/feed/
developer.chrome.com/origintrials/#/register_trial/.*
entra\.microsoft\.com
github\.com/openziti/ziti-tunnel-sdk-c%3E
EOF
# drop the trailing pipe
EXCLUDE_PATTERN="${EXCLUDE_PATTERN%|}))"
docker run --rm --network=host raviqqe/muffet "${SERVER}" \
--buffer-size=8192 \
--max-connections-per-host=${MUFFET_MAX_CONNECTIONS_PER_HOST:-1} \
--header=User-Agent:curl/7.54.0 \
--timeout=20 \
"--exclude=${EXCLUDE_PATTERN}" \
"${@}"