-
Notifications
You must be signed in to change notification settings - Fork 355
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
Showing
14 changed files
with
394 additions
and
103 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
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 @@ | ||
install_qtun(){ | ||
cd ${CUR_DIR} | ||
tar xf ${qtun_file}.tar.xz | ||
if [ ! -d ${QTUN_INSTALL_PATH} ]; then | ||
mkdir -p ${QTUN_INSTALL_PATH} | ||
fi | ||
mv qtun-server ${QTUN_BIN_PATH} | ||
if [ $? -eq 0 ]; then | ||
[ -f ${QTUN_BIN_PATH} ] && ln -fs ${QTUN_BIN_PATH} /usr/bin | ||
echo -e "${Info} qtun安装成功." | ||
else | ||
echo | ||
echo -e "${Error} qtun安装失败." | ||
echo | ||
install_cleanup | ||
exit 1 | ||
fi | ||
} |
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,69 @@ | ||
improt_package "utils" "gen_certificates.sh" | ||
|
||
|
||
print_domain_info(){ | ||
domainType=$1 | ||
|
||
echo | ||
echo -e "${Red} host = ${domain}${suffix} ${Green}(${domainType})${suffix}" | ||
echo | ||
} | ||
|
||
get_input_domain(){ | ||
while true | ||
do | ||
echo | ||
read -e -p "请输入一个域名(CDN 或 DNS-Only):" domain | ||
|
||
if [ -z "$domain" ]; then | ||
echo | ||
echo -e "${Error} 无默认参数,不能为空,请重新输入." | ||
echo | ||
continue | ||
fi | ||
|
||
if ! get_domain_ip ${domain}; then | ||
echo | ||
echo -e "${Error} 请输入一个正确有效的域名." | ||
echo | ||
continue | ||
fi | ||
|
||
if is_cdn_proxied ${domain_ip}; then | ||
print_domain_info "CDN" | ||
break | ||
elif is_dns_only ${domain_ip}; then | ||
print_domain_info "DNS-Only" | ||
break | ||
else | ||
echo | ||
echo -e "${Error} 请输入一个正确有效的域名." | ||
echo | ||
continue | ||
fi | ||
done | ||
} | ||
|
||
qtun_prot_reset(){ | ||
shadowsocksport=$1 | ||
|
||
if check_port_occupy ${shadowsocksport}; then | ||
echo -e "${Error} 检测到${shadowsocksport}端口被占用,请排查后重新运行." | ||
exit 1 | ||
fi | ||
|
||
echo | ||
echo -e "${Tip} Shadowsocks端口已被重置为${Green}${shadowsocksport}${suffix}" | ||
echo | ||
} | ||
|
||
install_prepare_libev_qtun(){ | ||
get_input_domain | ||
qtun_prot_reset 443 | ||
|
||
if [[ ${domainType} = DNS-Only ]]; then | ||
acme_get_certificate_by_force "${domain}" "RSA" | ||
elif [[ ${domainType} = CDN ]]; then | ||
acme_get_certificate_by_api_or_manual "${domain}" "RSA" | ||
fi | ||
} |
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
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
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,21 @@ | ||
# ss + qtun config | ||
ss_qtun_config(){ | ||
cat > ${SHADOWSOCKS_CONFIG}<<-EOF | ||
{ | ||
"server":${server_value}, | ||
"server_port":${shadowsocksport}, | ||
"password":"${shadowsockspwd}", | ||
"timeout":300, | ||
"user":"nobody", | ||
"method":"${shadowsockscipher}", | ||
"nameserver":"8.8.8.8", | ||
"mode":"tcp_only", | ||
"plugin":"qtun-server", | ||
"plugin_opts":"cert=${cerPath};key=${keyPath}" | ||
} | ||
EOF | ||
} | ||
|
||
config_ss_qtun(){ | ||
ss_qtun_config | ||
} |
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,12 @@ | ||
# ss + qtun link | ||
ss_qtun_link(){ | ||
local link_head="ss:https://" | ||
local cipher_pwd=$(get_str_base64_encode "${shadowsockscipher}:${shadowsockspwd}") | ||
local ip_port_plugin="@${domain}:${shadowsocksport}/?plugin=${plugin_client_name}" | ||
local plugin_opts=$(get_str_replace ";host=${domain}") | ||
ss_link="${link_head}${cipher_pwd}${ip_port_plugin}${plugin_opts}" | ||
} | ||
|
||
gen_ss_qtun_link(){ | ||
ss_qtun_link | ||
} |
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,26 @@ | ||
# ss + qtun show | ||
ss_qtun_show(){ | ||
echo >> ${HUMAN_CONFIG} | ||
echo -e " Shadowsocks的配置信息:" >> ${HUMAN_CONFIG} | ||
echo >> ${HUMAN_CONFIG} | ||
echo -e " 地址 : ${Red}${domain}${suffix}" >> ${HUMAN_CONFIG} | ||
echo -e " 端口 : ${Red}${shadowsocksport}${suffix}" >> ${HUMAN_CONFIG} | ||
echo -e " 密码 : ${Red}${shadowsockspwd}${suffix}" >> ${HUMAN_CONFIG} | ||
echo -e " 加密 : ${Red}${shadowsockscipher}${suffix}" >> ${HUMAN_CONFIG} | ||
echo -e " 插件程序 : ${Red}${plugin_client_name}${suffix}" >> ${HUMAN_CONFIG} | ||
echo -e " 插件选项 : ${Red}host=${domain}${suffix}" >> ${HUMAN_CONFIG} | ||
echo -e " 插件参数 : " >> ${HUMAN_CONFIG} | ||
echo >> ${HUMAN_CONFIG} | ||
echo -e " SS 链接 : ${Green}${ss_link}${suffix}" >> ${HUMAN_CONFIG} | ||
echo -e " SS二维码 : ./ss-plugins.sh scan < A link at the beginning of ss:https:// >" >> ${HUMAN_CONFIG} | ||
echo >> ${HUMAN_CONFIG} | ||
echo >> ${HUMAN_CONFIG} | ||
echo -e " ${Tip} SS链接${Red}不支持插件参数${suffix}导入,请手动填写。使用${Red}kcptun${suffix}插件时,该链接仅支持${Red}手机${suffix}导入." >> ${HUMAN_CONFIG} | ||
echo -e " 插件程序下载:https://github.com/shadowsocks/qtun/releases 下载 x86_64-pc-windows 版本" >> ${HUMAN_CONFIG} | ||
echo -e " 请解压将插件重命名为 ${plugin_client_name}.exe 并移动至 SS-Windows 客户端-安装目录的${Red}根目录${suffix}." >> ${HUMAN_CONFIG} | ||
echo >> ${HUMAN_CONFIG} | ||
} | ||
|
||
ss_qtun_visible(){ | ||
ss_qtun_show | ||
} |
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
Oops, something went wrong.