From ff7172c09a253e6b4ccd7b1b2c90cac76c1b2f49 Mon Sep 17 00:00:00 2001 From: BOYPT Date: Sat, 23 Feb 2019 18:30:16 +0800 Subject: [PATCH 1/8] add view traffic --- config/server/dynamic/http.json | 42 ++++++++++++++++++++++++++++++++ config/server/dynamic/kcp.json | 42 ++++++++++++++++++++++++++++++++ config/server/dynamic/quic.json | 42 ++++++++++++++++++++++++++++++++ config/server/dynamic/tcp.json | 42 ++++++++++++++++++++++++++++++++ config/server/dynamic/ws.json | 42 ++++++++++++++++++++++++++++++++ config/server/h2.json | 42 ++++++++++++++++++++++++++++++++ config/server/http.json | 42 ++++++++++++++++++++++++++++++++ config/server/include/socks.json | 1 + config/server/include/ss.json | 1 + config/server/kcp.json | 42 ++++++++++++++++++++++++++++++++ config/server/quic.json | 42 ++++++++++++++++++++++++++++++++ config/server/tcp.json | 42 ++++++++++++++++++++++++++++++++ config/server/ws.json | 42 ++++++++++++++++++++++++++++++++ src/v2ray-traffic.sh | 33 +++++++++++++++++++++++++ 14 files changed, 497 insertions(+) create mode 100644 src/v2ray-traffic.sh diff --git a/config/server/dynamic/http.json b/config/server/dynamic/http.json index 4661469..35cb038 100644 --- a/config/server/dynamic/http.json +++ b/config/server/dynamic/http.json @@ -1,4 +1,29 @@ { + "stats": {}, + "api": { + "tag": "api", + "services": [ + "HandlerService", + "LoggerService", + "StatsService" + ] + }, + "policy": { + "levels": { + "0": { + "statsUserUplink": true, + "statsUserDownlink": true + }, + "1": { + "statsUserUplink": true, + "statsUserDownlink": true + } + }, + "system": { + "statsInboundUplink": true, + "statsInboundDownlink": true + } + }, "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", @@ -6,6 +31,16 @@ }, "inbounds": [ { + "listen": "127.0.0.1", + "port": 10086, + "protocol": "dokodemo-door", + "settings": { + "address": "127.0.0.1" + }, + "tag": "api" + }, + { + "tag": "vmess-in", "port": 2333, "protocol": "vmess", "settings": { @@ -129,6 +164,13 @@ "routing": { "domainStrategy": "IPOnDemand", "rules": [ + { + "inboundTag": [ + "api" + ], + "outboundTag": "api", + "type": "field" + }, { "type": "field", "ip": [ diff --git a/config/server/dynamic/kcp.json b/config/server/dynamic/kcp.json index 48e3b8b..ddf9bd7 100644 --- a/config/server/dynamic/kcp.json +++ b/config/server/dynamic/kcp.json @@ -1,4 +1,29 @@ { + "stats": {}, + "api": { + "tag": "api", + "services": [ + "HandlerService", + "LoggerService", + "StatsService" + ] + }, + "policy": { + "levels": { + "0": { + "statsUserUplink": true, + "statsUserDownlink": true + }, + "1": { + "statsUserUplink": true, + "statsUserDownlink": true + } + }, + "system": { + "statsInboundUplink": true, + "statsInboundDownlink": true + } + }, "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", @@ -6,6 +31,16 @@ }, "inbounds": [ { + "listen": "127.0.0.1", + "port": 10086, + "protocol": "dokodemo-door", + "settings": { + "address": "127.0.0.1" + }, + "tag": "api" + }, + { + "tag": "vmess-in", "port": 2333, "protocol": "vmess", "settings": { @@ -101,6 +136,13 @@ "routing": { "domainStrategy": "IPOnDemand", "rules": [ + { + "inboundTag": [ + "api" + ], + "outboundTag": "api", + "type": "field" + }, { "type": "field", "ip": [ diff --git a/config/server/dynamic/quic.json b/config/server/dynamic/quic.json index 16911b4..b65a6c6 100644 --- a/config/server/dynamic/quic.json +++ b/config/server/dynamic/quic.json @@ -1,4 +1,29 @@ { + "stats": {}, + "api": { + "tag": "api", + "services": [ + "HandlerService", + "LoggerService", + "StatsService" + ] + }, + "policy": { + "levels": { + "0": { + "statsUserUplink": true, + "statsUserDownlink": true + }, + "1": { + "statsUserUplink": true, + "statsUserDownlink": true + } + }, + "system": { + "statsInboundUplink": true, + "statsInboundDownlink": true + } + }, "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", @@ -6,6 +31,16 @@ }, "inbounds": [ { + "listen": "127.0.0.1", + "port": 10086, + "protocol": "dokodemo-door", + "settings": { + "address": "127.0.0.1" + }, + "tag": "api" + }, + { + "tag": "vmess-in", "port": 2333, "protocol": "vmess", "settings": { @@ -105,6 +140,13 @@ "routing": { "domainStrategy": "IPOnDemand", "rules": [ + { + "inboundTag": [ + "api" + ], + "outboundTag": "api", + "type": "field" + }, { "type": "field", "ip": [ diff --git a/config/server/dynamic/tcp.json b/config/server/dynamic/tcp.json index 7c4d90b..7662492 100644 --- a/config/server/dynamic/tcp.json +++ b/config/server/dynamic/tcp.json @@ -1,4 +1,29 @@ { + "stats": {}, + "api": { + "tag": "api", + "services": [ + "HandlerService", + "LoggerService", + "StatsService" + ] + }, + "policy": { + "levels": { + "0": { + "statsUserUplink": true, + "statsUserDownlink": true + }, + "1": { + "statsUserUplink": true, + "statsUserDownlink": true + } + }, + "system": { + "statsInboundUplink": true, + "statsInboundDownlink": true + } + }, "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", @@ -6,6 +31,16 @@ }, "inbounds": [ { + "listen": "127.0.0.1", + "port": 10086, + "protocol": "dokodemo-door", + "settings": { + "address": "127.0.0.1" + }, + "tag": "api" + }, + { + "tag": "vmess-in", "port": 2333, "protocol": "vmess", "settings": { @@ -88,6 +123,13 @@ "routing": { "domainStrategy": "IPOnDemand", "rules": [ + { + "inboundTag": [ + "api" + ], + "outboundTag": "api", + "type": "field" + }, { "type": "field", "ip": [ diff --git a/config/server/dynamic/ws.json b/config/server/dynamic/ws.json index 51c889a..d57d632 100644 --- a/config/server/dynamic/ws.json +++ b/config/server/dynamic/ws.json @@ -1,4 +1,29 @@ { + "stats": {}, + "api": { + "tag": "api", + "services": [ + "HandlerService", + "LoggerService", + "StatsService" + ] + }, + "policy": { + "levels": { + "0": { + "statsUserUplink": true, + "statsUserDownlink": true + }, + "1": { + "statsUserUplink": true, + "statsUserDownlink": true + } + }, + "system": { + "statsInboundUplink": true, + "statsInboundDownlink": true + } + }, "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", @@ -6,6 +31,16 @@ }, "inbounds": [ { + "listen": "127.0.0.1", + "port": 10086, + "protocol": "dokodemo-door", + "settings": { + "address": "127.0.0.1" + }, + "tag": "api" + }, + { + "tag": "vmess-in", "port": 2333, "protocol": "vmess", "settings": { @@ -91,6 +126,13 @@ "routing": { "domainStrategy": "IPOnDemand", "rules": [ + { + "inboundTag": [ + "api" + ], + "outboundTag": "api", + "type": "field" + }, { "type": "field", "ip": [ diff --git a/config/server/h2.json b/config/server/h2.json index 6be2a38..e49b59f 100644 --- a/config/server/h2.json +++ b/config/server/h2.json @@ -1,4 +1,29 @@ { + "stats": {}, + "api": { + "tag": "api", + "services": [ + "HandlerService", + "LoggerService", + "StatsService" + ] + }, + "policy": { + "levels": { + "0": { + "statsUserUplink": true, + "statsUserDownlink": true + }, + "1": { + "statsUserUplink": true, + "statsUserDownlink": true + } + }, + "system": { + "statsInboundUplink": true, + "statsInboundDownlink": true + } + }, "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", @@ -6,6 +31,16 @@ }, "inbounds": [ { + "listen": "127.0.0.1", + "port": 10086, + "protocol": "dokodemo-door", + "settings": { + "address": "127.0.0.1" + }, + "tag": "api" + }, + { + "tag": "vmess-in", "port": 2333, "protocol": "vmess", "settings": { @@ -84,6 +119,13 @@ "routing": { "domainStrategy": "IPOnDemand", "rules": [ + { + "inboundTag": [ + "api" + ], + "outboundTag": "api", + "type": "field" + }, { "type": "field", "ip": [ diff --git a/config/server/http.json b/config/server/http.json index 77e1a8b..fe7dcd6 100644 --- a/config/server/http.json +++ b/config/server/http.json @@ -1,4 +1,29 @@ { + "stats": {}, + "api": { + "tag": "api", + "services": [ + "HandlerService", + "LoggerService", + "StatsService" + ] + }, + "policy": { + "levels": { + "0": { + "statsUserUplink": true, + "statsUserDownlink": true + }, + "1": { + "statsUserUplink": true, + "statsUserDownlink": true + } + }, + "system": { + "statsInboundUplink": true, + "statsInboundDownlink": true + } + }, "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", @@ -6,6 +31,16 @@ }, "inbounds": [ { + "listen": "127.0.0.1", + "port": 10086, + "protocol": "dokodemo-door", + "settings": { + "address": "127.0.0.1" + }, + "tag": "api" + }, + { + "tag": "vmess-in", "port": 2333, "protocol": "vmess", "settings": { @@ -102,6 +137,13 @@ "routing": { "domainStrategy": "IPOnDemand", "rules": [ + { + "inboundTag": [ + "api" + ], + "outboundTag": "api", + "type": "field" + }, { "type": "field", "ip": [ diff --git a/config/server/include/socks.json b/config/server/include/socks.json index 41aa472..070a074 100644 --- a/config/server/include/socks.json +++ b/config/server/include/socks.json @@ -1,4 +1,5 @@ { + "tag": "socks-in", "protocol": "socks", "port": 6666, "settings": { diff --git a/config/server/include/ss.json b/config/server/include/ss.json index 537ceb1..bdba112 100644 --- a/config/server/include/ss.json +++ b/config/server/include/ss.json @@ -1,4 +1,5 @@ { + "tag": "ss-in", "protocol": "shadowsocks", "port": 6666, "settings": { diff --git a/config/server/kcp.json b/config/server/kcp.json index bca8dad..bbdc8dd 100644 --- a/config/server/kcp.json +++ b/config/server/kcp.json @@ -1,4 +1,29 @@ { + "stats": {}, + "api": { + "tag": "api", + "services": [ + "HandlerService", + "LoggerService", + "StatsService" + ] + }, + "policy": { + "levels": { + "0": { + "statsUserUplink": true, + "statsUserDownlink": true + }, + "1": { + "statsUserUplink": true, + "statsUserDownlink": true + } + }, + "system": { + "statsInboundUplink": true, + "statsInboundDownlink": true + } + }, "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", @@ -6,6 +31,16 @@ }, "inbounds": [ { + "listen": "127.0.0.1", + "port": 10086, + "protocol": "dokodemo-door", + "settings": { + "address": "127.0.0.1" + }, + "tag": "api" + }, + { + "tag": "vmess-in", "port": 2333, "protocol": "vmess", "settings": { @@ -74,6 +109,13 @@ "routing": { "domainStrategy": "IPOnDemand", "rules": [ + { + "inboundTag": [ + "api" + ], + "outboundTag": "api", + "type": "field" + }, { "type": "field", "ip": [ diff --git a/config/server/quic.json b/config/server/quic.json index 2379fd1..b15be9a 100644 --- a/config/server/quic.json +++ b/config/server/quic.json @@ -1,4 +1,29 @@ { + "stats": {}, + "api": { + "tag": "api", + "services": [ + "HandlerService", + "LoggerService", + "StatsService" + ] + }, + "policy": { + "levels": { + "0": { + "statsUserUplink": true, + "statsUserDownlink": true + }, + "1": { + "statsUserUplink": true, + "statsUserDownlink": true + } + }, + "system": { + "statsInboundUplink": true, + "statsInboundDownlink": true + } + }, "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", @@ -6,6 +31,16 @@ }, "inbounds": [ { + "listen": "127.0.0.1", + "port": 10086, + "protocol": "dokodemo-door", + "settings": { + "address": "127.0.0.1" + }, + "tag": "api" + }, + { + "tag": "vmess-in", "port": 2333, "protocol": "vmess", "settings": { @@ -76,6 +111,13 @@ "routing": { "domainStrategy": "IPOnDemand", "rules": [ + { + "inboundTag": [ + "api" + ], + "outboundTag": "api", + "type": "field" + }, { "type": "field", "ip": [ diff --git a/config/server/tcp.json b/config/server/tcp.json index 01819bf..2b70122 100644 --- a/config/server/tcp.json +++ b/config/server/tcp.json @@ -1,4 +1,29 @@ { + "stats": {}, + "api": { + "tag": "api", + "services": [ + "HandlerService", + "LoggerService", + "StatsService" + ] + }, + "policy": { + "levels": { + "0": { + "statsUserUplink": true, + "statsUserDownlink": true + }, + "1": { + "statsUserUplink": true, + "statsUserDownlink": true + } + }, + "system": { + "statsInboundUplink": true, + "statsInboundDownlink": true + } + }, "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", @@ -6,6 +31,16 @@ }, "inbounds": [ { + "listen": "127.0.0.1", + "port": 10086, + "protocol": "dokodemo-door", + "settings": { + "address": "127.0.0.1" + }, + "tag": "api" + }, + { + "tag": "vmess-in", "port": 2333, "protocol": "vmess", "settings": { @@ -69,6 +104,13 @@ "routing": { "domainStrategy": "IPOnDemand", "rules": [ + { + "inboundTag": [ + "api" + ], + "outboundTag": "api", + "type": "field" + }, { "type": "field", "ip": [ diff --git a/config/server/ws.json b/config/server/ws.json index 4a45f22..2a5f302 100644 --- a/config/server/ws.json +++ b/config/server/ws.json @@ -1,4 +1,29 @@ { + "stats": {}, + "api": { + "tag": "api", + "services": [ + "HandlerService", + "LoggerService", + "StatsService" + ] + }, + "policy": { + "levels": { + "0": { + "statsUserUplink": true, + "statsUserDownlink": true + }, + "1": { + "statsUserUplink": true, + "statsUserDownlink": true + } + }, + "system": { + "statsInboundUplink": true, + "statsInboundDownlink": true + } + }, "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", @@ -6,6 +31,16 @@ }, "inbounds": [ { + "listen": "127.0.0.1", + "port": 10086, + "protocol": "dokodemo-door", + "settings": { + "address": "127.0.0.1" + }, + "tag": "api" + }, + { + "tag": "vmess-in", "port": 2333, "protocol": "vmess", "settings": { @@ -69,6 +104,13 @@ "routing": { "domainStrategy": "IPOnDemand", "rules": [ + { + "inboundTag": [ + "api" + ], + "outboundTag": "api", + "type": "field" + }, { "type": "field", "ip": [ diff --git a/src/v2ray-traffic.sh b/src/v2ray-traffic.sh new file mode 100644 index 0000000..46d303c --- /dev/null +++ b/src/v2ray-traffic.sh @@ -0,0 +1,33 @@ + +_V2CTL=/usr/bin/v2ray/v2ctl +_APISERVER=127.0.0.1:10086 + +v2_inbound() { + local inbound=$1 + local direct=$2 + $_V2CTL api --server=$_APISERVER StatsService.GetStats "name: \"inbound>>>${inbound}>>>traffic>>>${direct}\"" \ + | awk '{ + if (match($1, /name:/)){ f=1; gsub(/"$/, "", $2); split($2, p, ">>>"); print p[2]":"p[4] } + else if (match($1, /value:/)){ f=0; print $2} + else if (match($0, /^>$/) && f == 1) print "0" + else {} + }' \ + | sed '$!N;s/\n/ /; s/link//' \ + | numfmt --field=2 --suffix=B --to=iec \ + | sort \ + | column -t +} + +v2_query_all () { + $_V2CTL api --server=$_APISERVER StatsService.QueryStats '' \ + | awk '{ + if (match($1, /name:/)){ f=1; gsub(/"$/, "", $2); split($2, p, ">>>"); print p[2]":"p[4] } + else if (match($1, /value:/)){ f=0; print $2} + else if (match($0, /^>$/) && f == 1) print "0" + else {} + }' \ + | sed '$!N;s/\n/ /; s/link//' \ + | numfmt --field=2 --suffix=B --to=iec \ + | sort \ + | column -t +} From 71b5740454a3f16c1852b5c76d2ee6008dc4beaf Mon Sep 17 00:00:00 2001 From: BOYPT Date: Sat, 23 Feb 2019 18:41:08 +0800 Subject: [PATCH 2/8] add traffic cmd --- v2ray.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/v2ray.sh b/v2ray.sh index e9beb50..06704bc 100644 --- a/v2ray.sh +++ b/v2ray.sh @@ -143,6 +143,13 @@ create_vmess_URL_config() { EOF fi } +view_v2ray_traffic() { + _load v2ray-traffic.sh + echo + echo + v2_query_all + echo +} view_v2ray_config_info() { _load v2ray-info.sh @@ -2802,6 +2809,8 @@ _help() { ${green}v2ray update $none更新 V2Ray + ${green}v2ray traffic $none查看 V2Ray 流量 + ${green}v2ray update.sh $none更新 V2Ray 管理脚本 ${green}v2ray uninstall $none卸载 V2Ray @@ -2847,6 +2856,8 @@ menu() { echo echo -e "$yellow 11. $none其他" echo + echo -e "$yellow 11. $none查看 V2ray 流量统计" + echo echo -e "温馨提示...如果你不想执行选项...按$yellow Ctrl + C $none即可退出" echo read -p "$(echo -e "请选择菜单 [${magenta}1-9$none]:")" choose @@ -2900,6 +2911,10 @@ menu() { other break ;; + 12) + view_v2ray_traffic + break + ;; *) error ;; @@ -3030,6 +3045,9 @@ v | version) bbr) other ;; +traffic) + view_v2ray_traffic + ;; help | *) _help ;; From 9f749de89178b227359f875850598e9f8be6e772 Mon Sep 17 00:00:00 2001 From: BOYPT Date: Sat, 23 Feb 2019 18:43:48 +0800 Subject: [PATCH 3/8] fix menu --- v2ray.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2ray.sh b/v2ray.sh index 06704bc..c45d9e5 100644 --- a/v2ray.sh +++ b/v2ray.sh @@ -2856,7 +2856,7 @@ menu() { echo echo -e "$yellow 11. $none其他" echo - echo -e "$yellow 11. $none查看 V2ray 流量统计" + echo -e "$yellow 12. $none查看 V2ray 流量统计" echo echo -e "温馨提示...如果你不想执行选项...按$yellow Ctrl + C $none即可退出" echo From 3f2eea2b69cf7dd056e7320fdff33638200e8ebb Mon Sep 17 00:00:00 2001 From: BOYPT Date: Sat, 23 Feb 2019 19:07:38 +0800 Subject: [PATCH 4/8] use keyword for sed --- config/client/h2.json | 12 ++++++------ config/client/http.json | 8 ++++---- config/client/kcp.json | 8 ++++---- config/client/quic.json | 8 ++++---- config/client/tcp.json | 8 ++++---- config/client/ws.json | 8 ++++---- config/client/ws_tls.json | 8 ++++---- config/server/dynamic/http.json | 6 +++--- config/server/dynamic/kcp.json | 6 +++--- config/server/dynamic/quic.json | 6 +++--- config/server/dynamic/tcp.json | 6 +++--- config/server/dynamic/ws.json | 6 +++--- config/server/h2.json | 6 +++--- config/server/http.json | 6 +++--- config/server/kcp.json | 6 +++--- config/server/quic.json | 6 +++--- config/server/tcp.json | 6 +++--- config/server/ws.json | 6 +++--- src/vmess-config.sh | 17 ++++++++--------- 19 files changed, 71 insertions(+), 72 deletions(-) diff --git a/config/client/h2.json b/config/client/h2.json index 156944b..bdcf9d7 100644 --- a/config/client/h2.json +++ b/config/client/h2.json @@ -9,12 +9,12 @@ "settings": { "vnext": [ { - "address": "233blog.com", - "port": 2333, + "address": "##VMADDR##", + "port": ##VMPORT##, "users": [ { - "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", - "alterId": 233, + "id": "##VMUSERID##", + "alterId": ##VMALTID##, "security": "auto" } ] @@ -26,9 +26,9 @@ "security": "tls", "httpSettings": { "host": [ - "233blog.com" + "##H2DOMAIN##" ], - "path": "/233blog" + "path": "##H2PATH##" } }, "mux": { diff --git a/config/client/http.json b/config/client/http.json index 385d172..d1aaf4e 100644 --- a/config/client/http.json +++ b/config/client/http.json @@ -9,12 +9,12 @@ "settings": { "vnext": [ { - "address": "233blog.com", - "port": 2333, + "address": "##VMADDR##", + "port": ##VMPORT##, "users": [ { - "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", - "alterId": 233, + "id": "##VMUSERID##", + "alterId": ##VMALTID##, "security": "auto" } ] diff --git a/config/client/kcp.json b/config/client/kcp.json index 86fb479..a1279a6 100644 --- a/config/client/kcp.json +++ b/config/client/kcp.json @@ -9,12 +9,12 @@ "settings": { "vnext": [ { - "address": "233blog.com", - "port": 2333, + "address": "##VMADDR##", + "port": ##VMPORT##, "users": [ { - "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", - "alterId": 233, + "id": "##VMUSERID##", + "alterId": ##VMALTID##, "security": "auto" } ] diff --git a/config/client/quic.json b/config/client/quic.json index 2ffe55c..29c4fbc 100644 --- a/config/client/quic.json +++ b/config/client/quic.json @@ -9,12 +9,12 @@ "settings": { "vnext": [ { - "address": "233blog.com", - "port": 2333, + "address": "##VMADDR##", + "port": ##VMPORT##, "users": [ { - "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", - "alterId": 233, + "id": "##VMUSERID##", + "alterId": ##VMALTID##, "security": "auto" } ] diff --git a/config/client/tcp.json b/config/client/tcp.json index 9a8b35e..ef10735 100644 --- a/config/client/tcp.json +++ b/config/client/tcp.json @@ -9,12 +9,12 @@ "settings": { "vnext": [ { - "address": "233blog.com", - "port": 2333, + "address": "##VMADDR##", + "port": ##VMPORT##, "users": [ { - "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", - "alterId": 233, + "id": "##VMUSERID##", + "alterId": ##VMALTID##, "security": "auto" } ] diff --git a/config/client/ws.json b/config/client/ws.json index f122878..c13c970 100644 --- a/config/client/ws.json +++ b/config/client/ws.json @@ -9,12 +9,12 @@ "settings": { "vnext": [ { - "address": "233blog.com", - "port": 2333, + "address": "##VMADDR##", + "port": ##VMPORT##, "users": [ { - "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", - "alterId": 233, + "id": "##VMUSERID##", + "alterId": ##VMALTID##, "security": "auto" } ] diff --git a/config/client/ws_tls.json b/config/client/ws_tls.json index 9f47d62..f1a81aa 100644 --- a/config/client/ws_tls.json +++ b/config/client/ws_tls.json @@ -9,12 +9,12 @@ "settings": { "vnext": [ { - "address": "233blog.com", - "port": 2333, + "address": "##VMADDR##", + "port": ##VMPORT##, "users": [ { - "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", - "alterId": 233, + "id": "##VMUSERID##", + "alterId": ##VMALTID##, "security": "auto" } ] diff --git a/config/server/dynamic/http.json b/config/server/dynamic/http.json index 35cb038..a971719 100644 --- a/config/server/dynamic/http.json +++ b/config/server/dynamic/http.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": 2333, + "port": ##VMPORT##, "protocol": "vmess", "settings": { "clients": [ { - "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", + "id": "##VMUSERID##", "level": 1, - "alterId": 233 + "alterId": ##VMALTID## } ], "detour": { diff --git a/config/server/dynamic/kcp.json b/config/server/dynamic/kcp.json index ddf9bd7..f67cab2 100644 --- a/config/server/dynamic/kcp.json +++ b/config/server/dynamic/kcp.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": 2333, + "port": ##VMPORT##, "protocol": "vmess", "settings": { "clients": [ { - "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", + "id": "##VMUSERID##", "level": 1, - "alterId": 233 + "alterId": ##VMALTID## } ], "detour": { diff --git a/config/server/dynamic/quic.json b/config/server/dynamic/quic.json index b65a6c6..11a4e7d 100644 --- a/config/server/dynamic/quic.json +++ b/config/server/dynamic/quic.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": 2333, + "port": ##VMPORT##, "protocol": "vmess", "settings": { "clients": [ { - "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", + "id": "##VMUSERID##", "level": 1, - "alterId": 233 + "alterId": ##VMALTID## } ], "detour": { diff --git a/config/server/dynamic/tcp.json b/config/server/dynamic/tcp.json index 7662492..c28a249 100644 --- a/config/server/dynamic/tcp.json +++ b/config/server/dynamic/tcp.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": 2333, + "port": ##VMPORT##, "protocol": "vmess", "settings": { "clients": [ { - "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", + "id": "##VMUSERID##", "level": 1, - "alterId": 233 + "alterId": ##VMALTID## } ], "detour": { diff --git a/config/server/dynamic/ws.json b/config/server/dynamic/ws.json index d57d632..299110a 100644 --- a/config/server/dynamic/ws.json +++ b/config/server/dynamic/ws.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": 2333, + "port": ##VMPORT##, "protocol": "vmess", "settings": { "clients": [ { - "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", + "id": "##VMUSERID##", "level": 1, - "alterId": 233 + "alterId": ##VMALTID## } ], "detour": { diff --git a/config/server/h2.json b/config/server/h2.json index e49b59f..9920894 100644 --- a/config/server/h2.json +++ b/config/server/h2.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": 2333, + "port": ##VMPORT##, "protocol": "vmess", "settings": { "clients": [ { - "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", + "id": "##VMUSERID##", "level": 1, - "alterId": 233 + "alterId": ##VMALTID## } ] }, diff --git a/config/server/http.json b/config/server/http.json index fe7dcd6..9d90b20 100644 --- a/config/server/http.json +++ b/config/server/http.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": 2333, + "port": ##VMPORT##, "protocol": "vmess", "settings": { "clients": [ { - "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", + "id": "##VMUSERID##", "level": 1, - "alterId": 233 + "alterId": ##VMALTID## } ] }, diff --git a/config/server/kcp.json b/config/server/kcp.json index bbdc8dd..07a55fe 100644 --- a/config/server/kcp.json +++ b/config/server/kcp.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": 2333, + "port": ##VMPORT##, "protocol": "vmess", "settings": { "clients": [ { - "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", + "id": "##VMUSERID##", "level": 1, - "alterId": 233 + "alterId": ##VMALTID## } ] }, diff --git a/config/server/quic.json b/config/server/quic.json index b15be9a..022ccfa 100644 --- a/config/server/quic.json +++ b/config/server/quic.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": 2333, + "port": ##VMPORT##, "protocol": "vmess", "settings": { "clients": [ { - "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", + "id": "##VMUSERID##", "level": 1, - "alterId": 233 + "alterId": ##VMALTID## } ] }, diff --git a/config/server/tcp.json b/config/server/tcp.json index 2b70122..dc76dc6 100644 --- a/config/server/tcp.json +++ b/config/server/tcp.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": 2333, + "port": ##VMPORT##, "protocol": "vmess", "settings": { "clients": [ { - "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", + "id": "##VMUSERID##", "level": 1, - "alterId": 233 + "alterId": ##VMALTID## } ] }, diff --git a/config/server/ws.json b/config/server/ws.json index 2a5f302..2d3ee11 100644 --- a/config/server/ws.json +++ b/config/server/ws.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": 2333, + "port": ##VMPORT##, "protocol": "vmess", "settings": { "clients": [ { - "id": "e55c8d17-2cf3-b21a-bcf1-eeacb011ed79", + "id": "##VMUSERID##", "level": 1, - "alterId": 233 + "alterId": ##VMALTID## } ] }, diff --git a/src/vmess-config.sh b/src/vmess-config.sh index a1e81cd..7143780 100644 --- a/src/vmess-config.sh +++ b/src/vmess-config.sh @@ -55,7 +55,7 @@ cp -f $v2ray_server_config_file $v2ray_server_config cp -f $v2ray_client_config_file $v2ray_client_config # change port, uuid, alterId -sed -i "9s/2333/$v2ray_port/; 14s/$old_id/$v2ray_id/; 16s/233/$alterId/" $v2ray_server_config +sed -i "s/##VMPORT##/$v2ray_port/; s/##VMUSERID##/$v2ray_id/; s/##VMALTID##/$alterId/" $v2ray_server_config # change dynamic port if [[ $v2ray_transport -ge 18 ]]; then @@ -66,11 +66,11 @@ fi # change domain and path, or header type case $v2ray_transport in 5) - sed -i "24s/233blog.com/$domain/" $v2ray_server_config + sed -i "s/##H2DOMAIN##/$domain/" $v2ray_server_config if [[ $is_path ]]; then - sed -i "26s/233blog/$path/" $v2ray_server_config + sed -i "s/##H2PATH##/$path/" $v2ray_server_config else - sed -i "26s/233blog//" $v2ray_server_config + sed -i "s/##H2PATH##//" $v2ray_server_config fi ;; 7 | 13 | 22 | 28) @@ -97,15 +97,14 @@ esac ## change client config file [[ -z $ip ]] && get_ip +sed -i "s/##VMADDR##/$ip/; s/##VMPORT##/$v2ray_port/; s/##VMUSERID##/$v2ray_id/; s/##VMALTID##/$alterId/" $v2ray_client_config if [[ $v2ray_transport == [45] ]]; then - sed -i "s/233blog.com/$domain/; 13s/2333/443/; 16s/$old_id/$v2ray_id/; 17s/233/$alterId/" $v2ray_client_config + sed -i "s/##H2DOMAIN##/$domain/" $v2ray_client_config if [[ $is_path ]]; then - sed -i "31s/233blog/$path/" $v2ray_client_config + sed -i "s/##H2PATH##/$path/" $v2ray_client_config else - sed -i "31s/233blog//" $v2ray_client_config + sed -i "s/##H2PATH##//" $v2ray_client_config fi -else - sed -i "s/233blog.com/$ip/; 13s/2333/$v2ray_port/; 16s/$old_id/$v2ray_id/; 17s/233/$alterId/" $v2ray_client_config fi # zip -q -r -j --password "233blog.com" /etc/v2ray/233blog_v2ray.zip $v2ray_client_config From 1a2d8009aaf65b7c1d1441d1ee3ff515e8094e91 Mon Sep 17 00:00:00 2001 From: BOYPT Date: Sat, 23 Feb 2019 19:50:28 +0800 Subject: [PATCH 5/8] replace # with _ --- config/client/h2.json | 12 ++++++------ config/client/http.json | 8 ++++---- config/client/kcp.json | 8 ++++---- config/client/quic.json | 8 ++++---- config/client/tcp.json | 8 ++++---- config/client/ws.json | 8 ++++---- config/client/ws_tls.json | 8 ++++---- config/server/dynamic/http.json | 6 +++--- config/server/dynamic/kcp.json | 6 +++--- config/server/dynamic/quic.json | 6 +++--- config/server/dynamic/tcp.json | 6 +++--- config/server/dynamic/ws.json | 6 +++--- config/server/h2.json | 6 +++--- config/server/http.json | 6 +++--- config/server/kcp.json | 6 +++--- config/server/quic.json | 6 +++--- config/server/tcp.json | 6 +++--- config/server/ws.json | 6 +++--- src/download-ssray.sh | 2 +- src/ssray.conf | 6 +++--- src/vmess-config.sh | 18 +++++++++--------- 21 files changed, 76 insertions(+), 76 deletions(-) diff --git a/config/client/h2.json b/config/client/h2.json index bdcf9d7..0e8bc45 100644 --- a/config/client/h2.json +++ b/config/client/h2.json @@ -9,12 +9,12 @@ "settings": { "vnext": [ { - "address": "##VMADDR##", - "port": ##VMPORT##, + "address": "__VMADDR__", + "port": __VMPORT__, "users": [ { - "id": "##VMUSERID##", - "alterId": ##VMALTID##, + "id": "__VMUSERID__", + "alterId": __VMALTID__, "security": "auto" } ] @@ -26,9 +26,9 @@ "security": "tls", "httpSettings": { "host": [ - "##H2DOMAIN##" + "__H2DOMAIN__" ], - "path": "##H2PATH##" + "path": "__H2PATH__" } }, "mux": { diff --git a/config/client/http.json b/config/client/http.json index d1aaf4e..a88b520 100644 --- a/config/client/http.json +++ b/config/client/http.json @@ -9,12 +9,12 @@ "settings": { "vnext": [ { - "address": "##VMADDR##", - "port": ##VMPORT##, + "address": "__VMADDR__", + "port": __VMPORT__, "users": [ { - "id": "##VMUSERID##", - "alterId": ##VMALTID##, + "id": "__VMUSERID__", + "alterId": __VMALTID__, "security": "auto" } ] diff --git a/config/client/kcp.json b/config/client/kcp.json index a1279a6..ddc0b87 100644 --- a/config/client/kcp.json +++ b/config/client/kcp.json @@ -9,12 +9,12 @@ "settings": { "vnext": [ { - "address": "##VMADDR##", - "port": ##VMPORT##, + "address": "__VMADDR__", + "port": __VMPORT__, "users": [ { - "id": "##VMUSERID##", - "alterId": ##VMALTID##, + "id": "__VMUSERID__", + "alterId": __VMALTID__, "security": "auto" } ] diff --git a/config/client/quic.json b/config/client/quic.json index 29c4fbc..ab58c7d 100644 --- a/config/client/quic.json +++ b/config/client/quic.json @@ -9,12 +9,12 @@ "settings": { "vnext": [ { - "address": "##VMADDR##", - "port": ##VMPORT##, + "address": "__VMADDR__", + "port": __VMPORT__, "users": [ { - "id": "##VMUSERID##", - "alterId": ##VMALTID##, + "id": "__VMUSERID__", + "alterId": __VMALTID__, "security": "auto" } ] diff --git a/config/client/tcp.json b/config/client/tcp.json index ef10735..103c692 100644 --- a/config/client/tcp.json +++ b/config/client/tcp.json @@ -9,12 +9,12 @@ "settings": { "vnext": [ { - "address": "##VMADDR##", - "port": ##VMPORT##, + "address": "__VMADDR__", + "port": __VMPORT__, "users": [ { - "id": "##VMUSERID##", - "alterId": ##VMALTID##, + "id": "__VMUSERID__", + "alterId": __VMALTID__, "security": "auto" } ] diff --git a/config/client/ws.json b/config/client/ws.json index c13c970..fafda6b 100644 --- a/config/client/ws.json +++ b/config/client/ws.json @@ -9,12 +9,12 @@ "settings": { "vnext": [ { - "address": "##VMADDR##", - "port": ##VMPORT##, + "address": "__VMADDR__", + "port": __VMPORT__, "users": [ { - "id": "##VMUSERID##", - "alterId": ##VMALTID##, + "id": "__VMUSERID__", + "alterId": __VMALTID__, "security": "auto" } ] diff --git a/config/client/ws_tls.json b/config/client/ws_tls.json index f1a81aa..4359df2 100644 --- a/config/client/ws_tls.json +++ b/config/client/ws_tls.json @@ -9,12 +9,12 @@ "settings": { "vnext": [ { - "address": "##VMADDR##", - "port": ##VMPORT##, + "address": "__VMADDR__", + "port": __VMPORT__, "users": [ { - "id": "##VMUSERID##", - "alterId": ##VMALTID##, + "id": "__VMUSERID__", + "alterId": __VMALTID__, "security": "auto" } ] diff --git a/config/server/dynamic/http.json b/config/server/dynamic/http.json index a971719..0965531 100644 --- a/config/server/dynamic/http.json +++ b/config/server/dynamic/http.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": ##VMPORT##, + "port": __VMPORT__, "protocol": "vmess", "settings": { "clients": [ { - "id": "##VMUSERID##", + "id": "__VMUSERID__", "level": 1, - "alterId": ##VMALTID## + "alterId": __VMALTID__ } ], "detour": { diff --git a/config/server/dynamic/kcp.json b/config/server/dynamic/kcp.json index f67cab2..f2533c9 100644 --- a/config/server/dynamic/kcp.json +++ b/config/server/dynamic/kcp.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": ##VMPORT##, + "port": __VMPORT__, "protocol": "vmess", "settings": { "clients": [ { - "id": "##VMUSERID##", + "id": "__VMUSERID__", "level": 1, - "alterId": ##VMALTID## + "alterId": __VMALTID__ } ], "detour": { diff --git a/config/server/dynamic/quic.json b/config/server/dynamic/quic.json index 11a4e7d..0f854ca 100644 --- a/config/server/dynamic/quic.json +++ b/config/server/dynamic/quic.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": ##VMPORT##, + "port": __VMPORT__, "protocol": "vmess", "settings": { "clients": [ { - "id": "##VMUSERID##", + "id": "__VMUSERID__", "level": 1, - "alterId": ##VMALTID## + "alterId": __VMALTID__ } ], "detour": { diff --git a/config/server/dynamic/tcp.json b/config/server/dynamic/tcp.json index c28a249..fa6c603 100644 --- a/config/server/dynamic/tcp.json +++ b/config/server/dynamic/tcp.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": ##VMPORT##, + "port": __VMPORT__, "protocol": "vmess", "settings": { "clients": [ { - "id": "##VMUSERID##", + "id": "__VMUSERID__", "level": 1, - "alterId": ##VMALTID## + "alterId": __VMALTID__ } ], "detour": { diff --git a/config/server/dynamic/ws.json b/config/server/dynamic/ws.json index 299110a..805ec2e 100644 --- a/config/server/dynamic/ws.json +++ b/config/server/dynamic/ws.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": ##VMPORT##, + "port": __VMPORT__, "protocol": "vmess", "settings": { "clients": [ { - "id": "##VMUSERID##", + "id": "__VMUSERID__", "level": 1, - "alterId": ##VMALTID## + "alterId": __VMALTID__ } ], "detour": { diff --git a/config/server/h2.json b/config/server/h2.json index 9920894..4ef95d0 100644 --- a/config/server/h2.json +++ b/config/server/h2.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": ##VMPORT##, + "port": __VMPORT__, "protocol": "vmess", "settings": { "clients": [ { - "id": "##VMUSERID##", + "id": "__VMUSERID__", "level": 1, - "alterId": ##VMALTID## + "alterId": __VMALTID__ } ] }, diff --git a/config/server/http.json b/config/server/http.json index 9d90b20..c1009b3 100644 --- a/config/server/http.json +++ b/config/server/http.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": ##VMPORT##, + "port": __VMPORT__, "protocol": "vmess", "settings": { "clients": [ { - "id": "##VMUSERID##", + "id": "__VMUSERID__", "level": 1, - "alterId": ##VMALTID## + "alterId": __VMALTID__ } ] }, diff --git a/config/server/kcp.json b/config/server/kcp.json index 07a55fe..6478c3d 100644 --- a/config/server/kcp.json +++ b/config/server/kcp.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": ##VMPORT##, + "port": __VMPORT__, "protocol": "vmess", "settings": { "clients": [ { - "id": "##VMUSERID##", + "id": "__VMUSERID__", "level": 1, - "alterId": ##VMALTID## + "alterId": __VMALTID__ } ] }, diff --git a/config/server/quic.json b/config/server/quic.json index 022ccfa..9e0e44c 100644 --- a/config/server/quic.json +++ b/config/server/quic.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": ##VMPORT##, + "port": __VMPORT__, "protocol": "vmess", "settings": { "clients": [ { - "id": "##VMUSERID##", + "id": "__VMUSERID__", "level": 1, - "alterId": ##VMALTID## + "alterId": __VMALTID__ } ] }, diff --git a/config/server/tcp.json b/config/server/tcp.json index dc76dc6..c297a0a 100644 --- a/config/server/tcp.json +++ b/config/server/tcp.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": ##VMPORT##, + "port": __VMPORT__, "protocol": "vmess", "settings": { "clients": [ { - "id": "##VMUSERID##", + "id": "__VMUSERID__", "level": 1, - "alterId": ##VMALTID## + "alterId": __VMALTID__ } ] }, diff --git a/config/server/ws.json b/config/server/ws.json index 2d3ee11..e19e5dd 100644 --- a/config/server/ws.json +++ b/config/server/ws.json @@ -41,14 +41,14 @@ }, { "tag": "vmess-in", - "port": ##VMPORT##, + "port": __VMPORT__, "protocol": "vmess", "settings": { "clients": [ { - "id": "##VMUSERID##", + "id": "__VMUSERID__", "level": 1, - "alterId": ##VMALTID## + "alterId": __VMALTID__ } ] }, diff --git a/src/download-ssray.sh b/src/download-ssray.sh index 69685c4..5c12e52 100644 --- a/src/download-ssray.sh +++ b/src/download-ssray.sh @@ -37,7 +37,7 @@ _install_ssray_service() { if [[ $systemd ]]; then install -m644 /etc/v2ray/233boy/v2ray/src/ssray.service "/lib/systemd/system/" install -m644 /etc/v2ray/233boy/v2ray/src/ssray.conf /etc/v2ray/ - sed -i "s/##REMOTEPORT##/${ssrayport}/; s/##LOCALPORT##/${ssport}/; s/##OPTION##/${ssrayopt}/;" /etc/v2ray/ssray.conf + sed -i "s/__REMOTEPORT__/${ssrayport}/; s/__LOCALPORT__/${ssport}/; s/__OPTION__/${ssrayopt}/;" /etc/v2ray/ssray.conf systemctl enable ssray else $red 暂时不资瓷...$none diff --git a/src/ssray.conf b/src/ssray.conf index 8cb522e..89e7426 100644 --- a/src/ssray.conf +++ b/src/ssray.conf @@ -1,5 +1,5 @@ SS_REMOTE_HOST=0.0.0.0 -SS_REMOTE_PORT=##REMOTEPORT## +SS_REMOTE_PORT=__REMOTEPORT__ SS_LOCAL_HOST=127.0.0.1 -SS_LOCAL_PORT=##LOCALPORT## -SS_PLUGIN_OPTIONS="##OPTION##" +SS_LOCAL_PORT=__LOCALPORT__ +SS_PLUGIN_OPTIONS="__OPTION__" diff --git a/src/vmess-config.sh b/src/vmess-config.sh index 7143780..366b3e7 100644 --- a/src/vmess-config.sh +++ b/src/vmess-config.sh @@ -55,7 +55,7 @@ cp -f $v2ray_server_config_file $v2ray_server_config cp -f $v2ray_client_config_file $v2ray_client_config # change port, uuid, alterId -sed -i "s/##VMPORT##/$v2ray_port/; s/##VMUSERID##/$v2ray_id/; s/##VMALTID##/$alterId/" $v2ray_server_config +sed -i "s/__VMPORT__/$v2ray_port/; s/__VMUSERID__/$v2ray_id/; s/__VMALTID__/$alterId/" $v2ray_server_config # change dynamic port if [[ $v2ray_transport -ge 18 ]]; then @@ -66,11 +66,11 @@ fi # change domain and path, or header type case $v2ray_transport in 5) - sed -i "s/##H2DOMAIN##/$domain/" $v2ray_server_config + sed -i "s/__H2DOMAIN__/$domain/" $v2ray_server_config if [[ $is_path ]]; then - sed -i "s/##H2PATH##/$path/" $v2ray_server_config + sed -i "s/__H2PATH__/$path/" $v2ray_server_config else - sed -i "s/##H2PATH##//" $v2ray_server_config + sed -i "s/__H2PATH__//" $v2ray_server_config fi ;; 7 | 13 | 22 | 28) @@ -95,15 +95,15 @@ case $v2ray_transport in ;; esac -## change client config file +__ change client config file [[ -z $ip ]] && get_ip -sed -i "s/##VMADDR##/$ip/; s/##VMPORT##/$v2ray_port/; s/##VMUSERID##/$v2ray_id/; s/##VMALTID##/$alterId/" $v2ray_client_config +sed -i "s/__VMADDR__/$ip/; s/__VMPORT__/$v2ray_port/; s/__VMUSERID__/$v2ray_id/; s/__VMALTID__/$alterId/" $v2ray_client_config if [[ $v2ray_transport == [45] ]]; then - sed -i "s/##H2DOMAIN##/$domain/" $v2ray_client_config + sed -i "s/__H2DOMAIN__/$domain/" $v2ray_client_config if [[ $is_path ]]; then - sed -i "s/##H2PATH##/$path/" $v2ray_client_config + sed -i "s/__H2PATH__/$path/" $v2ray_client_config else - sed -i "s/##H2PATH##//" $v2ray_client_config + sed -i "s/__H2PATH__//" $v2ray_client_config fi fi From 7f6d90ce785f8631779f02e8c68ffd56e9949401 Mon Sep 17 00:00:00 2001 From: BOYPT Date: Sat, 23 Feb 2019 19:58:38 +0800 Subject: [PATCH 6/8] fix: comment line --- src/vmess-config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vmess-config.sh b/src/vmess-config.sh index 366b3e7..e72faac 100644 --- a/src/vmess-config.sh +++ b/src/vmess-config.sh @@ -95,7 +95,7 @@ case $v2ray_transport in ;; esac -__ change client config file +# change client config file [[ -z $ip ]] && get_ip sed -i "s/__VMADDR__/$ip/; s/__VMPORT__/$v2ray_port/; s/__VMUSERID__/$v2ray_id/; s/__VMALTID__/$alterId/" $v2ray_client_config if [[ $v2ray_transport == [45] ]]; then From 81a3c76a2afe60dff779f4636712e0b39d30f7de Mon Sep 17 00:00:00 2001 From: BOYPT Date: Sat, 23 Feb 2019 21:25:04 +0800 Subject: [PATCH 7/8] ssray variable save / remove / upgrade --- src/download-ssray.sh | 9 +++- src/ss-info.sh | 8 ++- v2ray.sh | 118 +++++++++++++++++++++++++++++++++++------- 3 files changed, 114 insertions(+), 21 deletions(-) diff --git a/src/download-ssray.sh b/src/download-ssray.sh index 5c12e52..70d6523 100644 --- a/src/download-ssray.sh +++ b/src/download-ssray.sh @@ -54,7 +54,7 @@ _update_ssray_version() { _download_ssray_file do_service restart ssray echo - echo -e " $green 更新成功啦...当前 V2Ray 版本: ${cyan}$ssray_latest_ver$none" + echo -e " $green 更新成功啦...当前 V2Ray plugin 版本: ${cyan}$ssray_latest_ver$none" echo echo -e " $yellow 温馨提示: 为了避免出现莫名其妙的问题...V2Ray 客户端的版本最好和服务器的版本保持一致$none" echo @@ -65,3 +65,10 @@ _update_ssray_version() { fi } +_uninstall_ssray() { + if [[ $systemd ]]; then + systemctl disable ssray + rm -f "/lib/systemd/system/ssray.service" /etc/v2ray/ssray.conf + fi + rm -f /usr/local/bin/v2ray-plugin +} \ No newline at end of file diff --git a/src/ss-info.sh b/src/ss-info.sh index b4f2747..6f8b469 100644 --- a/src/ss-info.sh +++ b/src/ss-info.sh @@ -22,7 +22,13 @@ if [[ $shadowsocks ]]; then echo -e "$yellow SS 链接 = ${cyan}$ss$none" echo if [[ $ssray ]]; then - echo -e "$yellow SS + V2ray - Plugin 链接 = ${cyan}$ssplugin$none" + echo -e "$yellow SS + V2ray - Plugin 地址 = ${cyan}${ssray_domain}$none" + echo + echo -e "$yellow SS + V2ray - Plugin 端口 = ${cyan}${ssrayport}$none" + echo + echo -e "$yellow SS + V2ray - Plugin 参数 = ${cyan}${clientopt}$none" + echo + echo -e "$yellow SS + V2ray - Plugin 链接 = ${cyan}${ssplugin}$none" echo fi echo -e "提示: 输入$cyan v2ray ssqr $none可生成 Shadowsocks 二维码链接" diff --git a/v2ray.sh b/v2ray.sh index c45d9e5..7d2ab8c 100644 --- a/v2ray.sh +++ b/v2ray.sh @@ -33,6 +33,7 @@ if [[ -f /usr/bin/yum ]]; then fi backup="/etc/v2ray/233blog_v2ray_backup.conf" +ssraybackup="/etc/v2ray/233blog_ssray_backup.conf" if [[ -f /usr/bin/v2ray/v2ray && -f /etc/v2ray/config.json ]] && [[ -f $backup && -d /etc/v2ray/233boy/v2ray ]]; then @@ -57,6 +58,8 @@ if [[ $path_status ]]; then is_path=true fi +[[ -f $ssraybackup ]] && source $ssraybackup + uuid=$(cat /proc/sys/kernel/random/uuid) old_id="e55c8d17-2cf3-b21a-bcf1-eeacb011ed79" v2ray_server_config="/etc/v2ray/config.json" @@ -89,6 +92,12 @@ else caddy_run_status="$red未在运行$none" fi +ssray_transports=( + "HTTP (Websocket)" + "HTTPS (Websocket TLS)" + "QUIC (udp)" +) + _load transport.sh ciphers=( aes-128-cfb @@ -627,8 +636,6 @@ ssray_config() { echo -e " $red大佬...你没有配置 Shadowsocks - V2ray - Plugin $none...不过现在想要配置的话也是可以的 ^_^" echo echo - echo -e " $yellow 唉唉 现在不管有没有配置过都要重新配置的,脚本还没完善好这部分,想改就接着重新配置吧~$none..." - echo while :; do echo -e "是否配置 ${yellow}Shadowsocks - V2ray Plugin ${none} [${magenta}Y/N$none]" @@ -645,6 +652,7 @@ ssray_config() { echo ssray=true ssray_port_config + ssray_proto_config break elif [[ "$install_ssray" == [Nn] ]]; then break @@ -653,6 +661,11 @@ ssray_config() { fi done + + _download_ssray_file + ssray_apply_config + ssray_save_config + _load ss-info.sh } ssray_port_config() { @@ -673,9 +686,6 @@ ssray_port_config() { error ;; [1-9] | [1-9][0-9] | [1-9][0-9][0-9] | [1-9][0-9][0-9][0-9] | [1-5][0-9][0-9][0-9][0-9] | 6[0-4][0-9][0-9][0-9] | 65[0-4][0-9][0-9] | 655[0-3][0-5]) - if [[ $v2ray_transport == [45] ]]; then - local tls=ture - fi if [[ $tls && $ssrayport == "80" ]] || [[ $tls && $ssrayport == "443" ]]; then echo echo -e "由于你已选择了 "$green"WebSocket + TLS $none或$green HTTP/2"$none" 传输协议." @@ -707,17 +717,10 @@ ssray_port_config() { esac done - - ssray_proto_config } ssray_proto_config() { - ssray_transports=( - "HTTP (Websocket)" - "HTTPS (Websocket TLS)" - "QUIC (udp)" - ) echo while :; do echo -e "请选择 "$yellow"V2Ray-Plugin"$none" 传输协议 [${magenta}1-${#transport[*]}$none]" @@ -788,6 +791,10 @@ ssray_proto_config() { echo -e "$yellow 噫!好像已经有证书了! 皮皮虾咋们走! $none" else echo -e "$yellow 开始安装acme.sh $none" + if ! command -v socat; then + echo -e "$red 需要安装socat $none" + exit 1 + fi curl https://get.acme.sh | bash echo -e "$yellow 开始申请 $ssray_domain 的证书,如果有正在使用80端口的程序先让它们退下~... $none" @@ -807,19 +814,87 @@ ssray_proto_config() { } change_ssray_config() { + + _load download-ssray.sh + if [[ $ssray ]]; then - echo + + + while :; do + echo + echo -e "$yellow 1. $none修改 Shadowsocks - V2ray插件 端口" + echo + echo -e "$yellow 2. $none修改 Shadowsocks - V2ray插件 协议" + echo + echo -e "$yellow 3. $none升级 Shadowsocks - V2ray插件" + echo + echo -e "$yellow 4. $none关闭 Shadowsocks - V2ray" + echo + read -p "$(echo -e "请选择 [${magenta}1-3$none]:")" _opt + if [[ -z $_opt ]]; then + error + else + case $_opt in + 1) + local oldssrayport=$ssrayport + ssray_port_config + ssray_save_config + ssray_apply_config + del_port $oldssrayport + open_port $ssrayport + _load ss-info.sh + break + ;; + 2) + ssray_proto_config + ssray_save_config + ssray_apply_config + _load ss-info.sh + break + ;; + 3) + _update_ssray_version + ssray_save_config + break + ;; + 4) + del_port $ssrayport + _uninstall_ssray + ssray= + install_ssray=n + rm -f $ssraybackup + break + ;; + *) + error + ;; + esac + fi + + done + else ssray_config - _load download-ssray.sh - _download_ssray_file - _install_ssray_service - open_port $ssrayport - do_service restart ssray - _load ss-info.sh fi } +ssray_save_config() { + cat > $ssraybackup << EOF +install_ssray=${install_ssray} +ssray_ver="$ssray_latest_ver" +ssray=${ssray} +ssray_transport=${ssray_transport} +ssrayport=${ssrayport} +ssray_domain="${ssray_domain}" +ssrayopt="${ssrayopt}" +EOF +} + +ssray_apply_config() { + _install_ssray_service + open_port $ssrayport + do_service restart ssray +} change_v2ray_config() { local _menu=( @@ -2616,6 +2691,11 @@ update() { update_v2ray() { _load download-v2ray.sh _update_v2ray_version + + if [[ $ssray ]]; then + _update_ssray_version + ssray_save_config + fi } update_v2ray.sh() { if [[ $_test ]]; then From fa593b0b1cc4279aad841c0fbd467a5a35971569 Mon Sep 17 00:00:00 2001 From: BOYPT Date: Sat, 23 Feb 2019 21:29:07 +0800 Subject: [PATCH 8/8] ssray upgrade fix --- v2ray.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/v2ray.sh b/v2ray.sh index 7d2ab8c..03d275a 100644 --- a/v2ray.sh +++ b/v2ray.sh @@ -2693,6 +2693,7 @@ update_v2ray() { _update_v2ray_version if [[ $ssray ]]; then + _load download-ssray.sh _update_ssray_version ssray_save_config fi