forked from lunixbochs/pingbin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·35 lines (29 loc) · 1.25 KB
/
run.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
#! /bin/bash
ipaddr="${1:-0.0.0.0}"
httpport="${2:-80}"
iface="${3:-eth0}"
httphost="${4:-pingb.in}"
build_args=(
# --build-arg "IPADDR=${ipaddr}"
# --build-arg "HTTPPORT=${httpport}"
# --build-arg "IFACE=${iface}"
# --build-arg "HTTPHOST=${httphost}"
)
docker build --tag pingbin \
"${build_args[@]}" \
. || exit 1
filter="$(sed -ne 's/.*"(\(.* or .*\)) %s.*/\1/p' capture.go)"
echo "Listening on tcp port ${ipaddr}:${httpport}, as well as to \"${filter}\" on ${iface}, advertised as ${httphost}..."
# To receive UDP port 53 requests on resolving HEX.ns.HTTPHOST, add an NS
# record to the DNS server that is authoritative for HTTPHOST:
# ns NS gluens.HTTPHOST.
# gluens A IPV4HTTPHOST
# gluens AAAA IPV6HTTPHOST
# To proxy from an Apache 2.4.47+ HTTP/TLS virtual host such as HTTPHOST:
# # No need in mod_proxy_wstunnel since 2.4.47.
# # https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#wsupgrade
# # a2enmod proxy proxy_http
# ProxyPassMatch "^/(|[0-9a-f]{28}|socket.io/.*|p/[0-9a-f]{28})$" "http://HTTPHOST/$1" upgrade=websocket
docker run -it --read-only --rm --network=host \
--mount type=bind,readonly,src=/var/lib/letsencrypt,dst=/var/lib/letsencrypt \
pingbin "${ipaddr}:${httpport}" "${iface}" "${httphost}"