This repository has been archived by the owner on Mar 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
start.bash
68 lines (56 loc) · 1.68 KB
/
start.bash
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
57
58
59
60
61
62
63
64
65
66
67
68
#! /bin/bash -e
# Piping Server version
VERSION=v1.12.9
# binary directory
BIN_DIR_PATH=$PWD/bin/$VERSION
BIN_PATH=$BIN_DIR_PATH/piping-server
# Make directory for bin
mkdir -p $BIN_DIR_PATH
# If bin is not found
if [ ! -f $BIN_PATH ]; then
(
# Go to the bin directory
cd $BIN_DIR_PATH
# Donwload
curl -L https://github.com/nwtgck/piping-server-pkg/releases/download/${VERSION}/piping-server-pkg-linuxstatic-x64.tar.gz | tar xzvf -
# Move
mv piping-server-pkg-linuxstatic-x64/piping-server $BIN_PATH
rm -r piping-server-pkg-linuxstatic-x64
)
fi
mkdir -p /home/runner/psuedo_root/var/log/tor/
mkdir -p /home/runner/psuedo_root/var/lib/tor/hidden_service/
chmod 700 /home/runner/psuedo_root/var/lib/tor/hidden_service/
if [[ -z "${HS_ED25519_SECRET_KEY_BASE64}" ]]; then
echo "WARN: \$HS_ED25519_SECRET_KEY_BASE64 is not defined"
echo "INFO: See 'Host persistency' section in README to persistent host"
else
# NOTE: public_key and hostname are automatically generated from the private key
echo "${HS_ED25519_SECRET_KEY_BASE64}" | base64 -d > /home/runner/psuedo_root/var/lib/tor/hidden_service/hs_ed25519_secret_key
unset HS_ED25519_SECRET_KEY_BASE64;
fi
trap 'kill $(jobs -p)' EXIT
# (
# while :
# do
# echo "Starting Piping Server..."
# kill $(lsof -t -i:8080 -sTCP:LISTEN) || true
# $BIN_PATH --http-port=8080
# sleep 1
# done
# ) &
# (
# while :
# do
# echo "Starting Tor..."
# tor -f torrc || true
# # (experiment) kill the server
# kill $(lsof -t -i:8080 -sTCP:LISTEN) || true
# sleep 1
# done
# ) &
# wait
# (experimental)
go run multi-forever.go \
"[\"$BIN_PATH\", \"--http-port=8080\"]" \
'["tor", "-f", "torrc"]'