forked from teddysun/shadowsocks_install
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
234 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Dockerfile for go-shadowsocks2 based alpine | ||
# Copyright (C) 2019 - 2020 Teddysun <[email protected]> | ||
# Reference URL: | ||
# https://github.com/shadowsocks/go-shadowsocks2 | ||
|
||
FROM --platform=${TARGETPLATFORM} alpine:latest | ||
LABEL maintainer="Teddysun <[email protected]>" | ||
|
||
ARG TARGETPLATFORM | ||
WORKDIR /root | ||
COPY go-shadowsocks2.sh /root/go-shadowsocks2.sh | ||
COPY v2ray-plugin.sh /root/v2ray-plugin.sh | ||
RUN set -ex \ | ||
&& apk add --no-cache tzdata \ | ||
&& chmod +x /root/go-shadowsocks2.sh /root/v2ray-plugin.sh \ | ||
&& /root/go-shadowsocks2.sh "${TARGETPLATFORM}" \ | ||
&& /root/v2ray-plugin.sh "${TARGETPLATFORM}" \ | ||
&& rm -fv /root/go-shadowsocks2.sh /root/v2ray-plugin.sh | ||
|
||
ENV TZ=Asia/Shanghai | ||
ENV SERVER_PORT=9000 | ||
ENV METHOD=AEAD_CHACHA20_POLY1305 | ||
ENV PASSWORD=teddysun.com | ||
ENV ARGS= | ||
CMD exec go-shadowsocks2 \ | ||
-s "ss://${METHOD}:${PASSWORD}@:${SERVER_PORT}" \ | ||
-verbose \ | ||
${ARGS} |
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,60 @@ | ||
## Go-shadowsocks2 Docker Image by Teddysun | ||
|
||
[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]. | ||
|
||
Docker images are built for quick deployment in various computing cloud providers. | ||
|
||
For more information on docker and containerization technologies, refer to [official document][3]. | ||
|
||
## Prepare the host | ||
|
||
If you need to install docker by yourself, follow the [official installation guide][4]. | ||
|
||
## Pull the image | ||
|
||
```bash | ||
$ docker pull teddysun/go-shadowsocks2 | ||
``` | ||
|
||
This pulls the latest release of go-shadowsocks2. | ||
|
||
It can be found at [Docker Hub][5]. | ||
|
||
## Start a container | ||
|
||
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]. | ||
|
||
**1.** There is an example to start a container with default environment variables: | ||
|
||
```bash | ||
$ docker run -d -p 9000:9000 -p 9000:9000/udp --name go-ss --restart=always teddysun/go-shadowsocks2 | ||
``` | ||
|
||
**2.** There is an example to start a container that listen on port `8989`, using `AEAD_AES_256_GCM` AEAD cipher with password `password00`: | ||
|
||
```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 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: | ||
|
||
```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 | ||
``` | ||
|
||
**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 |
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,44 @@ | ||
#!/bin/sh | ||
# | ||
# This is a Shell script for build multi-architectures go-shadowsocks2 binary file | ||
# | ||
# Supported architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x | ||
# | ||
# Copyright (C) 2020 Teddysun <[email protected]> | ||
# | ||
# Reference URL: | ||
# https://github.com/shadowsocks/go-shadowsocks2 | ||
|
||
cur_dir="$(pwd)" | ||
|
||
COMMANDS=( git go ) | ||
for CMD in "${COMMANDS[@]}"; do | ||
if [ ! "$(command -v "${CMD}")" ]; then | ||
echo "${CMD} is not installed, please install it and try again" && exit 1 | ||
fi | ||
done | ||
|
||
cd ${cur_dir} | ||
git clone https://github.com/shadowsocks/go-shadowsocks2.git | ||
cd go-shadowsocks2 || exit 2 | ||
go get -d -v | ||
|
||
LDFLAGS="-s -w" | ||
ARCHS=( 386 amd64 arm arm64 ppc64le s390x ) | ||
ARMS=( 6 7 ) | ||
|
||
for ARCH in ${ARCHS[@]}; do | ||
if [ "${ARCH}" = "arm" ]; then | ||
for V in ${ARMS[@]}; do | ||
echo "Building go-shadowsocks2_linux_${ARCH}${V}" | ||
env CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} GOARM=${V} go build -v -ldflags "${LDFLAGS}" -o ${cur_dir}/go-shadowsocks2_linux_${ARCH}${V} | ||
done | ||
else | ||
echo "Building go-shadowsocks2_linux_${ARCH}" | ||
env CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -v -ldflags "${LDFLAGS}" -o ${cur_dir}/go-shadowsocks2_linux_${ARCH} | ||
fi | ||
done | ||
|
||
chmod +x ${cur_dir}/go-shadowsocks2_linux_* | ||
# clean up | ||
cd ${cur_dir} && rm -fr go-shadowsocks2 |
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,50 @@ | ||
#!/bin/sh | ||
# | ||
# This is a Shell script for go-shadowsocks2 based alpine with Docker image | ||
# | ||
# Copyright (C) 2019 - 2020 Teddysun <[email protected]> | ||
# | ||
# Reference URL: | ||
# https://github.com/shadowsocks/go-shadowsocks2 | ||
|
||
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 binary file | ||
GO_SHADOWSOCKS2_FILE="go-shadowsocks2_linux_${ARCH}" | ||
echo "Downloading go-shadowsocks2 binary file: ${GO_SHADOWSOCKS2_FILE}" | ||
wget -O /usr/bin/go-shadowsocks2 https://dl.lamp.sh/files/${GO_SHADOWSOCKS2_FILE} > /dev/null 2>&1 | ||
if [ $? -ne 0 ]; then | ||
echo "Error: Failed to download go-shadowsocks2 binary file: ${GO_SHADOWSOCKS2_FILE}" && exit 1 | ||
fi | ||
chmod +x /usr/bin/go-shadowsocks2 | ||
echo "Download go-shadowsocks2 binary file: ${GO_SHADOWSOCKS2_FILE} completed" |
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,52 @@ | ||
#!/bin/sh | ||
# | ||
# This is a Shell script for go-shadowsocks2 supported SIP003 plugins based alpine with Docker image | ||
# | ||
# Copyright (C) 2019 - 2020 Teddysun <[email protected]> | ||
# | ||
# Reference URL: | ||
# https://github.com/shadowsocks/shadowsocks-libev | ||
# https://github.com/shadowsocks/simple-obfs | ||
# https://github.com/shadowsocks/v2ray-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 v2ray-plugin binary file | ||
V2RAY_PLUGIN_FILE="v2ray-plugin_linux_${ARCH}" | ||
echo "Downloading v2ray-plugin binary file: ${V2RAY_PLUGIN_FILE}" | ||
wget -O /usr/bin/v2ray-plugin https://dl.lamp.sh/files/${V2RAY_PLUGIN_FILE} > /dev/null 2>&1 | ||
if [ $? -ne 0 ]; then | ||
echo "Error: Failed to download v2ray-plugin binary file: ${V2RAY_PLUGIN_FILE}" && exit 1 | ||
fi | ||
chmod +x /usr/bin/v2ray-plugin | ||
echo "Download v2ray-plugin binary file: ${V2RAY_PLUGIN_FILE} completed" |