This repository has been archived on 2024-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
shadowsocks-libev-v2ray/entrypoint.sh

29 lines
828 B
Bash
Raw Normal View History

2022-12-15 03:14:16 +03:00
#!/bin/sh
set -o errexit
if [ "$1" = "/usr/bin/ss-server" ]; then
if [ -f "$PASSWORD_FILE" ]; then
PASSWORD="$(cat "$PASSWORD_FILE")"
fi
2022-12-27 13:37:43 +03:00
if [ -f "/var/run/secrets/$PASSWORD_SECRET" ]; then
2022-12-15 03:14:16 +03:00
PASSWORD=$(cat "/var/run/secrets/$PASSWORD_SECRET")
fi
2022-12-27 13:37:43 +03:00
ARGS="-s $SERVER_HOST -p $SERVER_PORT -k $PASSWORD \
-m $METHOD -t $TIMEOUT -u $DNS --fast-open --reuse-port \
--plugin $PLUGIN --plugin-opts $PLUGIN_OPTS $ARGS"
conn_uri="$(printf 'ss://%s@%s:%s?plugin=%s#%s' \
"$(printf '%s:%s' "$METHOD" "$PASSWORD" | base64 -w 0 | tr -d =)" \
"$SERVER_IP" "$SERVER_PORT" "${PLUGIN##*/}" "$(hostname -f)")"
printf '\nCONNECTION URI:\n\n%s\n\n' "$conn_uri"
echo "$conn_uri" | qrencode -t ANSIUTF8
printf '\n\n'
2022-12-15 03:14:16 +03:00
fi
2022-12-27 13:37:43 +03:00
# shellcheck disable=SC2086
exec "$@" $ARGS