forked from V7hinc/ssr_server_client
-
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
v7hinc
committed
Oct 9, 2020
0 parents
commit 7a75535
Showing
65 changed files
with
9,444 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,45 @@ | ||
# Dockerfile for ShadowsocksR based alpine | ||
# Reference URL: https://github.com/shadowsocksrr/shadowsocksr shadowsocksr-3.2.2 | ||
# repositories URL: https://github.com/V7hinc/ssr_server_client | ||
|
||
FROM python:3.7-alpine | ||
MAINTAINER V7hinc | ||
|
||
ENV INSTALL_PATH=/usr/local/shadowsocksr | ||
ENV ssr_config_path=$INSTALL_PATH/conf | ||
ENV autostart_shell=/autostart.sh | ||
|
||
# 安装必要插件 | ||
RUN set -ex;\ | ||
apk add --no-cache jq; | ||
|
||
COPY conf/ssr_client_config_sample.json $ssr_config_path/ssr_client_config.json | ||
COPY conf/ssr_server_config_sample.json $ssr_config_path/ssr_server_config.json | ||
COPY shadowsocks $INSTALL_PATH/shadowsocks | ||
|
||
|
||
# 编写开机启动脚本 | ||
RUN set -x;\ | ||
echo "#!/bin/sh" >> $autostart_shell;\ | ||
# 开机选择开启server模式还是client模式 | ||
echo "ssr_client() {" >> $autostart_shell;\ | ||
echo "python $INSTALL_PATH/shadowsocks/local.py -d start -c $ssr_config_path/ssr_client_config.json --pid-file=$INSTALL_PATH/ssr.pid --log-file=$INSTALL_PATH/ssr.log" >> $autostart_shell;\ | ||
echo "}" >> $autostart_shell;\ | ||
echo "ssr_server() {" >> $autostart_shell;\ | ||
echo "python $INSTALL_PATH/shadowsocks/server.py -c $ssr_config_path/ssr_server_config.json" >> $autostart_shell;\ | ||
echo "}" >> $autostart_shell;\ | ||
echo "case \$1 in" >> $autostart_shell;\ | ||
echo "client) ssr_client ;;" >> $autostart_shell;\ | ||
echo "server) ssr_server ;;" >> $autostart_shell;\ | ||
echo "esac" >> $autostart_shell;\ | ||
# 保持前台 | ||
echo "/bin/sh;" >> $autostart_shell;\ | ||
chmod 755 $autostart_shell; | ||
|
||
WORKDIR $ssr_config_path | ||
VOLUME $ssr_config_path | ||
|
||
EXPOSE 1080 | ||
|
||
ENTRYPOINT ["/autostart.sh"] | ||
CMD ["server"] |
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,57 @@ | ||
# ssr_server_client | ||
|
||
> shadowsocks源码来源于https://github.com/shadowsocksrr/shadowsocksr shadowsocksr-3.2.2 | ||
使用步骤 | ||
1. 拉取代码 | ||
```shell script | ||
git clone https://github.com/V7hinc/ssr_server_client.git | ||
``` | ||
2.想要使用服务端(server)功能 | ||
> 修改[conf/ssr_server_config_sample.json](conf/ssr_server_config_sample.json)配置文件 | ||
``` | ||
"port_password":{ | ||
"9999":"xxx", | ||
"8989":"xxx", | ||
"8080":"xxx" | ||
}, | ||
# 键值对是 端口:密码 | ||
# 想开放多个端口就写多条 | ||
# 其他关于加密混淆方式的修改可以自行了解修改 | ||
``` | ||
3.想要使用客户端(client)功能 | ||
> 修改[conf/ssr_client_config_sample.json](conf/ssr_client_config_sample.json)配置文件 | ||
``` | ||
{ | ||
"server": "你的ssr服务器ip", # 填写你的ssr服务器ip | ||
"server_ipv6": "::", | ||
"local_address": "0.0.0.0", | ||
"local_port": 1080, # 本地使用的端口,可不修改 | ||
"server_port": 8989, # 填写ssr服务端开放的端口 | ||
"password": "xxx", # 填写ssr服务端开放的端口对应的密码 | ||
# 需设置与ssr服务端相匹配的配置 | ||
# 加密方式需与服务端相匹配,否则将不能用 | ||
# 其他关于加密混淆方式的修改可以自行了解修改 | ||
``` | ||
4. 构建docker镜像 | ||
```shell script | ||
docker build -t V7hinc/ssr_server_client . | ||
# docker仓库https://hub.docker.com/r/v7hinc/ssr_server_client | ||
``` | ||
4. 启动server端 | ||
```shell script | ||
# 这里映射的端口需跟配置文件配置的端口相对应 | ||
docker run -p 9999:9999 -p 8989:8989 -p 8080:8080 --name ssr_server --restart=always -v /usr/local/shadowsocksr/conf -dit v7hinc/ssr_server_client server | ||
``` | ||
|
||
5. 启动client端 | ||
```shell script | ||
# 这里映射的端口需跟配置文件配置的端口相对应 | ||
docker run -p 1080:1080 --name ssr_client --restart=always -v /usr/local/shadowsocksr/conf -dit v7hinc/ssr_server_client client | ||
``` | ||
|
||
6. 客户端测试 | ||
```shell script | ||
curl ifconfig.me --socks 127.0.0.1:1080 | ||
# 如成功将显示服务端出口ip | ||
``` |
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,25 @@ | ||
{ | ||
"server": "你的ssr服务器ip", | ||
"server_ipv6": "::", | ||
"local_address": "0.0.0.0", | ||
"local_port": 1080, | ||
"server_port": 8989, | ||
"password": "xxx", | ||
|
||
|
||
|
||
"method": "aes-256-cfb", | ||
"protocol": "auth_sha1_v4", | ||
"protocol_param": "5", | ||
"obfs": "http_simple", | ||
"obfs_param": "", | ||
"speed_limit_per_con": 0, | ||
"speed_limit_per_user": 0, | ||
"additional_ports": {}, | ||
"timeout": 120, | ||
"udp_timeout": 60, | ||
"dns_ipv6": false, | ||
"connect_verbose_info": 0, | ||
"redirect": "", | ||
"fast_open": false | ||
} |
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,25 @@ | ||
{ | ||
"server": "0.0.0.0", | ||
"server_ipv6": "::", | ||
"local_address": "127.0.0.1", | ||
"local_port": 1080, | ||
"port_password": { | ||
"9999": "xxx", | ||
"8989": "xxx", | ||
"8080": "xxx" | ||
}, | ||
"method": "aes-256-cfb", | ||
"protocol": "auth_sha1_v4", | ||
"protocol_param": "5", | ||
"obfs": "http_simple", | ||
"obfs_param": "", | ||
"speed_limit_per_con": 0, | ||
"speed_limit_per_user": 0, | ||
"additional_ports": {}, | ||
"timeout": 120, | ||
"udp_timeout": 60, | ||
"dns_ipv6": false, | ||
"connect_verbose_info": 0, | ||
"redirect": "", | ||
"fast_open": false | ||
} |
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,18 @@ | ||
#!/usr/bin/python | ||
# | ||
# Copyright 2012-2015 clowwindy | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
from __future__ import absolute_import, division, print_function, \ | ||
with_statement |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.