Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update hit_proxy scipt to work with new config format. #1245

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions hit_proxy.bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,22 @@ set -ef -o pipefail

PROXY="${1:?please specify the proxy IP}"
TMPDIR="${TMP:-/tmp}/hit_lc_proxy/$PROXY"
OUTFILE="$TMPDIR/proxies.yaml"
OUTFILE="$TMPDIR/user.conf"

rm -rf "$TMPDIR"
mkdir -p "$TMPDIR"

echo "Generating config for ${PROXY} in ${OUTFILE}..."
$LANTERN_CLOUD/bin/lc route dump-config --legacy "$PROXY" > "$OUTFILE"
CONFIG=$($LANTERN_CLOUD/bin/lc route dump-config $PROXY)
OUTPUT="{\"proxy\":{\"proxies\":[${CONFIG}]}}"

# check if jq is installed and reformat the output
if command -v jq &> /dev/null
then
echo $OUTPUT | jq . > $OUTFILE
else
echo $OUTPUT > $OUTFILE
fi

make darwin ffigen
LANTERN_CONFIGDIR=$TMPDIR \
Expand Down
Loading