You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray/src/vmess-config.sh

111 lines
3.7 KiB

6 years ago
# config file
case $v2ray_transport in
1)
v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/tcp.json"
v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/tcp.json"
;;
2)
v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/http.json"
v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/http.json"
;;
3)
v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/ws.json"
v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/ws.json"
;;
4)
v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/ws.json"
v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/ws_tls.json"
;;
5)
v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/h2.json"
v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/h2.json"
;;
[6-9] | 10 | 11)
v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/kcp.json"
v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/kcp.json"
;;
1[2-7])
v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/quic.json"
v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/quic.json"
;;
18)
v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/dynamic/tcp.json"
v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/tcp.json"
;;
19)
v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/dynamic/http.json"
v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/http.json"
;;
20)
v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/dynamic/ws.json"
v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/ws.json"
;;
2[1-6])
v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/dynamic/kcp.json"
v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/kcp.json"
;;
*)
v2ray_server_config_file="/etc/v2ray/233boy/v2ray/config/server/dynamic/quic.json"
v2ray_client_config_file="/etc/v2ray/233boy/v2ray/config/client/quic.json"
;;
esac
# copy config file
cp -f $v2ray_server_config_file $v2ray_server_config
cp -f $v2ray_client_config_file $v2ray_client_config
# change port, uuid, alterId
6 years ago
sed -i "s/__VMPORT__/$v2ray_port/; s/__VMUSERID__/$v2ray_id/; s/__VMALTID__/$alterId/" $v2ray_server_config
6 years ago
# change dynamic port
if [[ $v2ray_transport -ge 18 ]]; then
local multi_port="${v2ray_dynamicPort_start}-${v2ray_dynamicPort_end}"
sed -i "s/10000-20000/$multi_port/" $v2ray_server_config
fi
# change domain and path, or header type
case $v2ray_transport in
5)
6 years ago
sed -i "s/__H2DOMAIN__/$domain/" $v2ray_server_config
6 years ago
if [[ $is_path ]]; then
6 years ago
sed -i "s/__H2PATH__/$path/" $v2ray_server_config
6 years ago
else
6 years ago
sed -i "s/__H2PATH__//" $v2ray_server_config
6 years ago
fi
;;
7 | 13 | 22 | 28)
sed -i "s/none/utp/" $v2ray_server_config
sed -i "s/none/utp/" $v2ray_client_config
;;
8 | 14 | 23 | 29)
sed -i "s/none/srtp/" $v2ray_server_config
sed -i "s/none/srtp/" $v2ray_client_config
;;
9 | 15 | 24 | 30)
sed -i "s/none/wechat-video/" $v2ray_server_config
sed -i "s/none/wechat-video/" $v2ray_client_config
;;
10 | 16 | 25 | 31)
sed -i "s/none/dtls/" $v2ray_server_config
sed -i "s/none/dtls/" $v2ray_client_config
;;
11 | 17 | 26 | 32)
sed -i "s/none/wireguard/" $v2ray_server_config
sed -i "s/none/wireguard/" $v2ray_client_config
;;
esac
6 years ago
__ change client config file
6 years ago
[[ -z $ip ]] && get_ip
6 years ago
sed -i "s/__VMADDR__/$ip/; s/__VMPORT__/$v2ray_port/; s/__VMUSERID__/$v2ray_id/; s/__VMALTID__/$alterId/" $v2ray_client_config
6 years ago
if [[ $v2ray_transport == [45] ]]; then
6 years ago
sed -i "s/__H2DOMAIN__/$domain/" $v2ray_client_config
6 years ago
if [[ $is_path ]]; then
6 years ago
sed -i "s/__H2PATH__/$path/" $v2ray_client_config
6 years ago
else
6 years ago
sed -i "s/__H2PATH__//" $v2ray_client_config
6 years ago
fi
fi
# zip -q -r -j --password "233blog.com" /etc/v2ray/233blog_v2ray.zip $v2ray_client_config