feat: Connection URI and QR-code
This commit is contained in:
parent
445edf6c0c
commit
1686631a2f
@ -1,5 +1,6 @@
|
|||||||
FROM alpine:3.17.0
|
FROM alpine:3.17.0
|
||||||
RUN apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing shadowsocks-libev curl
|
RUN apk add --no-cache curl libqrencode
|
||||||
|
RUN apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing shadowsocks-libev
|
||||||
RUN mkdir -pv /usr/share/shadowsocks-libev/plugins
|
RUN mkdir -pv /usr/share/shadowsocks-libev/plugins
|
||||||
RUN tag="$(curl -sSo /dev/null -w '%{redirect_url}' \
|
RUN tag="$(curl -sSo /dev/null -w '%{redirect_url}' \
|
||||||
https://github.com/shadowsocks/v2ray-plugin/releases/latest | \
|
https://github.com/shadowsocks/v2ray-plugin/releases/latest | \
|
||||||
@ -9,6 +10,7 @@ RUN tag="$(curl -sSo /dev/null -w '%{redirect_url}' \
|
|||||||
RUN chmod +x /usr/share/shadowsocks-libev/plugins/v2ray-plugin
|
RUN chmod +x /usr/share/shadowsocks-libev/plugins/v2ray-plugin
|
||||||
|
|
||||||
ENV SERVER_HOST="${SERVER_HOST:-0.0.0.0}"
|
ENV SERVER_HOST="${SERVER_HOST:-0.0.0.0}"
|
||||||
|
ENV SERVER_IP="${SERVER_IP:-0.0.0.0}"
|
||||||
ENV SERVER_PORT="${SERVER_PORT:-8388}"
|
ENV SERVER_PORT="${SERVER_PORT:-8388}"
|
||||||
ENV PASSWORD="${PASSWORD:-secure_password}"
|
ENV PASSWORD="${PASSWORD:-secure_password}"
|
||||||
ENV METHOD="${METHOD:-chacha20-ietf-poly1305}"
|
ENV METHOD="${METHOD:-chacha20-ietf-poly1305}"
|
||||||
|
17
README.md
17
README.md
@ -2,23 +2,30 @@
|
|||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
Tag is `<shadowsocks-libev_version>-<v2ray-plugin_version>`
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
docker build . -t ss-libev-v2ray:3.3.5-r1-1.3.2
|
docker build . -t nxhs/shadowsocks-libev-v2ray:latest -t nxhs/shadowsocks-libev-v2ray:3.3.5r1-1.3.2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Tag is `<shadowsocks-libev version>-<v2ray-plugin version>`.
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
docker run \
|
docker run \
|
||||||
--detach \
|
--detach \
|
||||||
--name ss-v2ray \
|
--name shadowsocks \
|
||||||
|
--env SERVER_IP=your_server_ip_address \
|
||||||
--env PASSWORD=secure_password \
|
--env PASSWORD=secure_password \
|
||||||
--publish 8388:8388 \
|
--publish 8388:8388 \
|
||||||
--publish 8388:8388/udp \
|
--publish 8388:8388/udp \
|
||||||
--restart always \
|
--restart always \
|
||||||
nxhs/ss-libev-v2ray:3.3.5-r1-1.3.2
|
nxhs/shadowsocks-libev-v2ray:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
To view client connection URI and QR-code run:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker logs shadowsocks
|
||||||
```
|
```
|
||||||
|
|
||||||
See [client.json](client.json) for client config example. Don't forget install v2ray-plugin on client too.
|
See [client.json](client.json) for client config example. Don't forget install v2ray-plugin on client too.
|
||||||
|
@ -7,13 +7,22 @@ if [ "$1" = "/usr/bin/ss-server" ]; then
|
|||||||
PASSWORD="$(cat "$PASSWORD_FILE")"
|
PASSWORD="$(cat "$PASSWORD_FILE")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "/var/run/secrets/$PASSWORD_SECRET" ]]; then
|
if [ -f "/var/run/secrets/$PASSWORD_SECRET" ]; then
|
||||||
PASSWORD=$(cat "/var/run/secrets/$PASSWORD_SECRET")
|
PASSWORD=$(cat "/var/run/secrets/$PASSWORD_SECRET")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ARGS="-s $SERVER_HOST -p $SERVER_PORT -k ${PASSWORD:-$(hostname)} \
|
ARGS="-s $SERVER_HOST -p $SERVER_PORT -k $PASSWORD \
|
||||||
-m $METHOD -t $TIMEOUT -u $DNS --fast-open --reuse-port --plugin $PLUGIN \
|
-m $METHOD -t $TIMEOUT -u $DNS --fast-open --reuse-port \
|
||||||
--plugin-opts $PLUGIN_OPTS $ARGS"
|
--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'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec $@ $ARGS
|
# shellcheck disable=SC2086
|
||||||
|
exec "$@" $ARGS
|
||||||
|
Reference in New Issue
Block a user