Skip to content

Commit

Permalink
Added xray-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
teddysun committed Feb 21, 2021
1 parent bc51f88 commit 40827cd
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 14 deletions.
10 changes: 7 additions & 3 deletions docker/go-shadowsocks2/Dockerfile.architecture
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Dockerfile for go-shadowsocks2 based alpine
# Copyright (C) 2019 - 2020 Teddysun <[email protected]>
# Copyright (C) 2019 - 2021 Teddysun <[email protected]>
# Reference URL:
# https://github.com/shadowsocks/go-shadowsocks2
# https://github.com/teddysun/v2ray-plugin
# https://github.com/teddysun/xray-plugin

FROM --platform=${TARGETPLATFORM} alpine:latest
LABEL maintainer="Teddysun <[email protected]>"
Expand All @@ -10,12 +12,14 @@ ARG TARGETPLATFORM
WORKDIR /root
COPY go-shadowsocks2.sh /root/go-shadowsocks2.sh
COPY v2ray-plugin.sh /root/v2ray-plugin.sh
COPY xray-plugin.sh /root/xray-plugin.sh
RUN set -ex \
&& apk add --no-cache tzdata \
&& chmod +x /root/go-shadowsocks2.sh /root/v2ray-plugin.sh \
&& chmod +x /root/go-shadowsocks2.sh /root/v2ray-plugin.sh /root/xray-plugin.sh \
&& /root/go-shadowsocks2.sh "${TARGETPLATFORM}" \
&& /root/v2ray-plugin.sh "${TARGETPLATFORM}" \
&& rm -fv /root/go-shadowsocks2.sh /root/v2ray-plugin.sh
&& /root/xray-plugin.sh "${TARGETPLATFORM}" \
&& rm -fv /root/go-shadowsocks2.sh /root/v2ray-plugin.sh /root/xray-plugin.sh

ENV TZ=Asia/Shanghai
ENV SERVER_PORT=9000
Expand Down
28 changes: 20 additions & 8 deletions docker/go-shadowsocks2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[go-shadowsocks2][1] is a fresh implementation of Shadowsocks in Go which can help you get through firewalls.

Based on alpine with latest version [go-shadowsocks2][1] and [v2ray-plugin][6].
Based on alpine with latest version [go-shadowsocks2][1] and [v2ray-plugin][6] + [xray-plugin][7].

Docker images are built for quick deployment in various computing cloud providers.

Expand All @@ -26,10 +26,14 @@ It can be found at [Docker Hub][5].

You **must set environment variable** at first.

- `SERVER_PORT`: Server listening on port, defaults to `9000`;
- `METHOD`: Encryption method to use, available ciphers: `AEAD_AES_128_GCM`, `AEAD_AES_256_GCM`, `AEAD_CHACHA20_POLY1305`, defaults to `AEAD_CHACHA20_POLY1305`;
- `PASSWORD`: Your own password, defaults to `teddysun.com`;
- `ARGS`: Additional arguments, for example: `-plugin v2ray-plugin -plugin-opts "server"`. For more `v2ray-plugin` configrations please visit v2ray-plugin [usage][7].
- `SERVER_PORT`: Server listening on port, default `9000`;
- `METHOD`: Encryption method to use, available ciphers: `AEAD_AES_128_GCM`, `AEAD_AES_256_GCM`, `AEAD_CHACHA20_POLY1305`, default `AEAD_CHACHA20_POLY1305`;
- `PASSWORD`: Your own password, default `teddysun.com`;
- `ARGS`: Additional arguments, for example: `-plugin v2ray-plugin -plugin-opts "server"` or `-plugin xray-plugin -plugin-opts "server"`.

For more `v2ray-plugin` configrations please visit v2ray-plugin [usage][8].

For more `xray-plugin` configrations please visit xray-plugin [usage][9].

**1.** There is an example to start a container with default environment variables:

Expand All @@ -43,18 +47,26 @@ $ docker run -d -p 9000:9000 -p 9000:9000/udp --name go-ss --restart=always tedd
$ docker run -d -p 8989:8989 -p 8989:8989/udp --name go-ss --restart=always -e SERVER_PORT=8989 -e METHOD=AEAD_AES_256_GCM -e PASSWORD=password00 teddysun/go-shadowsocks2
```

**3.** There is an example to start a container that listen on port `8989`, using `AEAD_AES_256_GCM` AEAD cipher with password `password00` and supported SIP003 plugins:
**3.** There is an example to start a container that listen on port `8989`, using `AEAD_AES_256_GCM` AEAD cipher with password `password00` and supported SIP003 plugins `v2ray-plugin` over websocket (HTTP):

```bash
$ docker run -d -p 8989:8989 -p 8989:8989/udp --name go-ss --restart=always -e SERVER_PORT=8989 -e METHOD=AEAD_AES_256_GCM -e PASSWORD=password00 -e ARGS="-plugin v2ray-plugin -plugin-opts "server"" teddysun/go-shadowsocks2
```

**4.** There is an example to start a container that listen on port `8989`, using `AEAD_AES_256_GCM` AEAD cipher with password `password00` and supported SIP003 plugins `xray-plugin` over websocket (HTTP):

```bash
$ docker run -d -p 8989:8989 -p 8989:8989/udp --name go-ss --restart=always -e SERVER_PORT=8989 -e METHOD=AEAD_AES_256_GCM -e PASSWORD=password00 -e ARGS="-plugin xray-plugin -plugin-opts "server"" teddysun/go-shadowsocks2
```

**Warning**: The port number must be opened in firewall.

[1]: https://github.com/shadowsocks/go-shadowsocks2
[2]: https://shadowsocks.org/en/index.html
[3]: https://docs.docker.com/
[4]: https://docs.docker.com/install/
[5]: https://hub.docker.com/r/teddysun/go-shadowsocks2/
[6]: https://github.com/shadowsocks/v2ray-plugin
[7]: https://github.com/shadowsocks/v2ray-plugin#usage
[6]: https://github.com/teddysun/v2ray-plugin
[7]: https://github.com/teddysun/xray-plugin
[8]: https://github.com/teddysun/v2ray-plugin#usage
[9]: https://github.com/teddysun/xray-plugin#usage
5 changes: 2 additions & 3 deletions docker/go-shadowsocks2/v2ray-plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
#
# This is a Shell script for go-shadowsocks2 supported SIP003 plugins based alpine with Docker image
#
# Copyright (C) 2019 - 2020 Teddysun <[email protected]>
# Copyright (C) 2019 - 2021 Teddysun <[email protected]>
#
# Reference URL:
# https://github.com/shadowsocks/shadowsocks-libev
# https://github.com/shadowsocks/simple-obfs
# https://github.com/shadowsocks/v2ray-plugin
# https://github.com/teddysun/v2ray-plugin

PLATFORM=$1
if [ -z "$PLATFORM" ]; then
Expand Down
50 changes: 50 additions & 0 deletions docker/go-shadowsocks2/xray-plugin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/sh
#
# This is a Shell script for go-shadowsocks2 supported SIP003 plugins based alpine with Docker image
#
# Copyright (C) 2019 - 2021 Teddysun <[email protected]>
#
# Reference URL:
# https://github.com/teddysun/xray-plugin

PLATFORM=$1
if [ -z "$PLATFORM" ]; then
ARCH="amd64"
else
case "$PLATFORM" in
linux/386)
ARCH="386"
;;
linux/amd64)
ARCH="amd64"
;;
linux/arm/v6)
ARCH="arm6"
;;
linux/arm/v7)
ARCH="arm7"
;;
linux/arm64|linux/arm64/v8)
ARCH="arm64"
;;
linux/ppc64le)
ARCH="ppc64le"
;;
linux/s390x)
ARCH="s390x"
;;
*)
ARCH=""
;;
esac
fi
[ -z "${ARCH}" ] && echo "Error: Not supported OS Architecture" && exit 1
# Download xray-plugin binary file
XRAY_PLUGIN_FILE="xray-plugin_linux_${ARCH}"
echo "Downloading xray-plugin binary file: ${XRAY_PLUGIN_FILE}"
wget -O /usr/bin/xray-plugin https://dl.lamp.sh/files/${XRAY_PLUGIN_FILE} > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Error: Failed to download xray-plugin binary file: ${XRAY_PLUGIN_FILE}" && exit 1
fi
chmod +x /usr/bin/xray-plugin
echo "Download xray-plugin binary file: ${XRAY_PLUGIN_FILE} completed"

0 comments on commit 40827cd

Please sign in to comment.