Skip to content

Commit

Permalink
Added web server support for xray-plugin gRPC mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
loyess committed Apr 11, 2024
1 parent b2df1a9 commit 214e121
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
24 changes: 20 additions & 4 deletions prepare/xray_plugin_prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,28 @@ quic_mode_logic(){
}

grpc_mode_logic(){
isDisableMux="disable"
get_cdn_or_dnsonly_type_domain
get_input_inbound_port 443
firewallNeedOpenPort="${INBOUND_PORT}"
shadowsocksport="${firewallNeedOpenPort}"
get_input_grpc_path
improt_package "webServer" "prepare.sh"
is_enable_web_server
if [ "${isEnableWeb}" = "disable" ]; then
get_input_inbound_port 443
firewallNeedOpenPort="${INBOUND_PORT}"
shadowsocksport="${firewallNeedOpenPort}"
elif [ "${isEnableWeb}" = "enable" ]; then
reset_if_ss_port_is_443
get_input_inbound_port 443 "TO_COMPARE_PORTS"
firewallNeedOpenPort="${INBOUND_PORT}"
web_server_menu
if [ "${web_flag}" = "1" ]; then
choose_caddy_version_menu
elif [ "${web_flag}" = "2" ]; then
choose_nginx_version_menu
fi
get_input_mirror_site
fi
kill_process_if_port_occupy "${firewallNeedOpenPort}"
is_disable_mux_logic
if [ "${domainType}" = "DNS-Only" ]; then
acme_get_certificate_by_force "${domain}"
elif [ "${domainType}" = "CDN" ]; then
Expand Down
6 changes: 5 additions & 1 deletion templates/config/xray_plugin_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ config_ss_xray_plugin(){
serverTcpAndUdp="tcp_only"
serverPluginOpts="server;tls;mode=quic;host=${domain};cert=${cerPath};key=${keyPath}"
elif [ "${libev_xray_plugin}" = "4" ]; then
serverPluginOpts="server;tls;mode=grpc;host=${domain};cert=${cerPath};key=${keyPath}"
if [ "${isEnableWeb}" = "disable" ]; then
serverPluginOpts="server;tls;mode=grpc;host=${domain};serviceName=${grpcSN};cert=${cerPath};key=${keyPath}"
elif [ "${isEnableWeb}" = "enable" ]; then
serverPluginOpts="server;mode=grpc;serviceName=${grpcSN}"
fi
fi
ss_plugin_server_config
if [ "${isDisableMux}" = "disable" ]; then
Expand Down
2 changes: 1 addition & 1 deletion templates/sslinks/xray_plugin_link.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gen_ss_xray_plugin_link(){
elif [ "${libev_xray_plugin}" = "3" ]; then
clientPluginOpts="tls;mode=quic;host=${domain}${clientMux}"
elif [ "${libev_xray_plugin}" = "4" ]; then
clientPluginOpts="tls;mode=grpc;host=${domain}${clientMux}"
clientPluginOpts="tls;mode=grpc;host=${domain};serviceName=${grpcSN}${clientMux}"
fi
ss_plugins_client_links
}

0 comments on commit 214e121

Please sign in to comment.