1 Commits
v4.02 ... v4.01

Author SHA1 Message Date
233boy
dddb970724 add socks 2023-05-16 18:25:05 +08:00
3 changed files with 11 additions and 20 deletions

View File

@@ -321,8 +321,10 @@ ask() {
create() { create() {
case $1 in case $1 in
server) server)
is_tls=none
get new get new
is_sniffing='sniffing:{enabled:true,destOverride:["http","tls"]}'
is_listen_127='"listen": "127.0.0.1"'
is_tls=none
# file name # file name
if [[ $host ]]; then if [[ $host ]]; then
@@ -333,19 +335,10 @@ create() {
is_json_file=$is_conf_dir/$is_config_name is_json_file=$is_conf_dir/$is_config_name
# get json # get json
[[ $is_change || ! $json_str ]] && get protocol $2 [[ $is_change || ! $json_str ]] && get protocol $2
case $net in is_new_json=$(jq '{inbounds:[{tag:'\"$is_config_name\"',port:'"$port"',protocol:'\"$is_protocol\"','"$json_str"','"$is_sniffing"'}]}' <<<{})
ws | h2 | grpc | http)
is_listen='"listen": "127.0.0.1"'
;;
*)
is_listen='"listen": "0.0.0.0"'
;;
esac
is_sniffing='sniffing:{enabled:true,destOverride:["http","tls"]}'
is_new_json=$(jq '{inbounds:[{tag:'\"$is_config_name\"',port:'"$port"','"$is_listen"',protocol:'\"$is_protocol\"','"$json_str"','"$is_sniffing"'}]}' <<<{})
if [[ $is_dynamic_port ]]; then if [[ $is_dynamic_port ]]; then
[[ ! $is_dynamic_port_range ]] && get dynamic-port [[ ! $is_dynamic_port_range ]] && get dynamic-port
is_new_dynamic_port_json=$(jq '{inbounds:[{tag:'\"$is_config_name-link.json\"',port:'\"$is_dynamic_port_range\"','"$is_listen"',protocol:"vmess",'"$is_stream"','"$is_sniffing"',allocate:{strategy:"random"}}]}' <<<{}) is_new_dynamic_port_json=$(jq '{inbounds:[{tag:'\"$is_config_name-link.json\"',port:'\"$is_dynamic_port_range\"',protocol:"vmess",'"$is_stream"','"$is_sniffing"',allocate:{strategy:"random"}}]}' <<<{})
fi fi
[[ $is_test_json ]] && return # tmp test [[ $is_test_json ]] && return # tmp test
# only show json, dont save to file. # only show json, dont save to file.
@@ -1249,7 +1242,7 @@ get() {
*http*) *http*)
is_protocol=http is_protocol=http
net=http net=http
json_str='settings:{"timeout": 233}' json_str=''"$is_listen_127"''
;; ;;
*socks*) *socks*)
is_protocol=socks is_protocol=socks
@@ -1287,20 +1280,20 @@ get() {
net=ws net=ws
[[ ! $path ]] && path="/$uuid" [[ ! $path ]] && path="/$uuid"
is_stream='streamSettings:{network:"ws",security:'\"$is_tls\"',wsSettings:{path:'\"$path\"',headers:{Host:'\"$host\"'}}}' is_stream='streamSettings:{network:"ws",security:'\"$is_tls\"',wsSettings:{path:'\"$path\"',headers:{Host:'\"$host\"'}}}'
json_str=''"$is_server_id_json"','"$is_stream"'' json_str=''"$is_listen_127"','"$is_server_id_json"','"$is_stream"''
;; ;;
*grpc* | *gun) *grpc* | *gun)
net=grpc net=grpc
[[ ! $path ]] && path="$uuid" [[ ! $path ]] && path="$uuid"
[[ $path ]] && path=$(sed 's#/##g' <<<$path) [[ $path ]] && path=$(sed 's#/##g' <<<$path)
is_stream='streamSettings:{network:"grpc",grpc_host:'\"$host\"',security:'\"$is_tls\"',grpcSettings:{serviceName:'\"$path\"'}}' is_stream='streamSettings:{network:"grpc",grpc_host:'\"$host\"',security:'\"$is_tls\"',grpcSettings:{serviceName:'\"$path\"'}}'
json_str=''"$is_server_id_json"','"$is_stream"'' json_str=''"$is_listen_127"','"$is_server_id_json"','"$is_stream"''
;; ;;
*h2* | *http*) *h2* | *http*)
net=h2 net=h2
[[ ! $path ]] && path="/$uuid" [[ ! $path ]] && path="/$uuid"
is_stream='streamSettings:{network:"h2",security:'\"$is_tls\"',httpSettings:{path:'\"$path\"',host:['\"$host\"']}}' is_stream='streamSettings:{network:"h2",security:'\"$is_tls\"',httpSettings:{path:'\"$path\"',host:['\"$host\"']}}'
json_str=''"$is_server_id_json"','"$is_stream"'' json_str=''"$is_listen_127"','"$is_server_id_json"','"$is_stream"''
;; ;;
*reality*) *reality*)
net=reality net=reality
@@ -1450,7 +1443,7 @@ info() {
ss) ss)
is_can_change=(0 1 4 6) is_can_change=(0 1 4 6)
is_info_show=(0 1 2 10 11) is_info_show=(0 1 2 10 11)
is_url="ss://$(base64 -w 0 <<<"${ss_method}:${ss_password}")@${is_addr}:${port}#233boy-ss-${is_addr}" is_url="ss://$(base64 -w 0 <<<"${ss_method}:${ss_password}")@${ip}:${port}#233boy-ss-${ip}"
is_info_str=($is_protocol $is_addr $port $ss_password $ss_method) is_info_str=($is_protocol $is_addr $port $ss_password $ss_method)
;; ;;
ws | h2 | grpc) ws | h2 | grpc)
@@ -1493,7 +1486,6 @@ info() {
is_can_change=(0 1 15 4) is_can_change=(0 1 15 4)
is_info_show=(0 1 2 19 10) is_info_show=(0 1 2 19 10)
is_info_str=($is_protocol $is_addr $port $is_socks_user $is_socks_pass) is_info_str=($is_protocol $is_addr $port $is_socks_user $is_socks_pass)
is_url="socks://$(base64 -w 0 <<<"${is_socks_user}:${is_socks_pass}")@${is_addr}:${port}#233boy-socks-${is_addr}"
;; ;;
http) http)
is_can_change=(0 1) is_can_change=(0 1)

View File

@@ -43,7 +43,6 @@ download() {
link="https://github.com/${is_sh_repo}/releases/download/${latest_ver}/code.zip" link="https://github.com/${is_sh_repo}/releases/download/${latest_ver}/code.zip"
download_file download_file
unzip -qo $tmpfile -d $is_sh_dir unzip -qo $tmpfile -d $is_sh_dir
chmod +x $is_sh_bin
;; ;;
caddy) caddy)
name="Caddy" name="Caddy"

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
args=$@ args=$@
is_sh_ver=v4.02 is_sh_ver=v4.01
. /etc/v2ray/sh/src/init.sh . /etc/v2ray/sh/src/init.sh