forked from dashpay/dash
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add tor entrypoint script for use in dashmate (dashpay#4182)
* feat: add entrypoint for tor features in dashmate * fix: use spaces consistently for indendation * fix: output blank line after info * fix: ensure script is executable * fix: keep linter happy
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
export LC_ALL=C | ||
set -e | ||
|
||
# Get Tor service IP if running | ||
if [[ "$1" == "dashd" ]]; then | ||
# Because dashd only accept torcontrol= host as an ip only, we resolve it here and add to config | ||
if [[ "$TOR_CONTROL_HOST" ]] && [[ "$TOR_CONTROL_PORT" ]] && [[ "$TOR_PROXY_PORT" ]]; then | ||
TOR_IP=$(getent hosts $TOR_CONTROL_HOST | cut -d ' ' -f 1) | ||
echo "proxy=$TOR_IP:$TOR_PROXY_PORT" >> "$HOME/.dashcore/dash.conf" | ||
echo "Added "proxy=$TOR_IP:$TOR_PROXY_PORT" to $HOME/.dashcore/dash.conf" | ||
echo "torcontrol=$TOR_IP:$TOR_CONTROL_PORT" >> "$HOME/.dashcore/dash.conf" | ||
echo "Added "torcontrol=$TOR_IP:$TOR_CONTROL_PORT" to $HOME/.dashcore/dash.conf" | ||
echo -e "\n" | ||
else | ||
echo "Tor control credentials not provided" | ||
fi | ||
fi | ||
|
||
exec "$@" |