Skip to content

Commit

Permalink
Merge pull request Snawoot#3 from Snawoot/auto_v2path
Browse files Browse the repository at this point in the history
Autogenerate v2path
  • Loading branch information
Snawoot authored May 6, 2021
2 parents ef65aee + ef7b40f commit 089586f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN set -ex\
&& apt autoremove -y \
&& apt clean -y \
&& chmod +x /entrypoint.sh \
&& mkdir -p /etc/shadowsocks-libev /v2raybin \
&& mkdir -p /etc/shadowsocks-libev /v2raybin /wwwroot \
&& wget -O- "https://github.com/shadowsocks/v2ray-plugin/releases/download/${V2RAY_VERSION}/v2ray-plugin-linux-amd64-${V2RAY_VERSION}.tar.gz" | \
tar zx -C /v2raybin \
&& install /v2raybin/v2ray-plugin_linux_amd64 /usr/bin/v2ray-plugin \
Expand Down
8 changes: 4 additions & 4 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"keywords": ["V2ray", "Shadowsocks", "V2Ray-plugin"],
"env": {
"ENCRYPT": {
"description": "Encryption method, due to https blessing, choose the simplest one, default: chacha20-ietf-poly1305, others are(aes-256-cfb,chacha20-ietf-poly1305,salsa20,chacha20-ietf etc.)",
"description": "Shadowsocks encryption method.",
"value": "chacha20-ietf-poly1305"
},
"PASSWORD": {
Expand All @@ -13,12 +13,12 @@
},

"V2_Path": {
"description": "Path path, default /s233, you can also replace s233 with uuid for safety, / cannot be less. If anti-generation is turned on, do not repeat with anti-generation uri",
"value": "/s233"
"description": "V2Ray handler path. Auto-generated with some secret value.",
"generator": "secret"
},

"AppName": {
"description": "Please enter the App Name filled in at the top to generate the configuration and QR code. If you don’t want to generate it, enter no",
"description": "App Name filled in at the top to generate the configuration and QR code. If you don’t want to generate it, enter no",
"value": "no"
},

Expand Down
2 changes: 1 addition & 1 deletion conf/nginx_ss.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ server {
location ${QR_Path} {
root /wwwroot;
}
location = ${V2_Path} {
location = /${V2_Path} {
if (\$http_upgrade != "websocket") { # WebSocket return this when negotiation fails 404
return 404;
}
Expand Down
2 changes: 1 addition & 1 deletion conf/shadowsocks-libev_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ cat <<EOF
"reuse_port":true,
"no_delay":true,
"plugin": "v2ray-plugin",
"plugin_opts":"server;path=${V2_Path}"
"plugin_opts":"server;path=/${V2_Path}"
}
EOF
4 changes: 2 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if [[ -z "${ENCRYPT}" ]]; then
fi

if [[ -z "${V2_Path}" ]]; then
export V2_Path="/s233"
export V2_Path="s233"
fi
echo ${V2_Path}

Expand All @@ -32,7 +32,7 @@ if [ "$AppName" = "no" ]; then
echo "Do not generate QR-code"
else
[ ! -d /wwwroot/${QR_Path} ] && mkdir /wwwroot/${QR_Path}
plugin=$(echo -n "v2ray;path=${V2_Path};host=${AppName}.herokuapp.com;tls" | sed -e 's/\//%2F/g' -e 's/=/%3D/g' -e 's/;/%3B/g')
plugin=$(echo -n "v2ray;path=/${V2_Path};host=${AppName}.herokuapp.com;tls" | sed -e 's/\//%2F/g' -e 's/=/%3D/g' -e 's/;/%3B/g')
ss="ss://$(echo -n ${ENCRYPT}:${PASSWORD} | base64 -w 0)@${AppName}.herokuapp.com:443?plugin=${plugin}"
echo "${ss}" | tr -d '\n' > /wwwroot/${QR_Path}/index.html
echo -n "${ss}" | qrencode -s 6 -o /wwwroot/${QR_Path}/vpn.png
Expand Down

0 comments on commit 089586f

Please sign in to comment.