luci-app-frpc: add proxy_protocol_version option for proxy config (#4370)

This commit is contained in:
Kui Wu 2020-04-18 20:20:40 +08:00 committed by GitHub
parent b8f8afb7d0
commit b7e9fc662c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 4 deletions

View File

@ -9,8 +9,8 @@ include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI for FRPC
LUCI_DEPENDS:=+wget +frpc
LUCI_PKGARCH:=all
PKG_VERSION:=1.1
PKG_RELEASE:=2
PKG_VERSION:=1.2
PKG_RELEASE:=1
include $(TOPDIR)/feeds/luci/luci.mk

View File

@ -105,6 +105,15 @@ e:depends("type","http")
e = t:taboption("other",Value, "host_header_rewrite", translate("Host Header"), translate("The Host header will be rewritten to match the hostname portion of the forwarding address."))
e.default = "dev.yourdomain.com"
e:depends("enable_host_header_rewrite",1)
e = t:taboption("base",ListValue, "proxy_protocol_version", translate("Proxy-Protocol Version"), translate("Proxy Protocol to send user's real IP to local services."))
e.default = "disable"
e:value("disable",translate("Disable"))
e:value("v1",translate("V1"))
e:value("v2",translate("V2"))
e:depends("type","tcp")
e:depends("type","stcp")
e:depends("type","http")
e:depends("type","https")
e = t:taboption("base",Flag, "use_encryption", translate("Use Encryption"), translate("Encrypted the communication between frpc and frps, will effectively prevent the traffic intercepted."))
e.default = "1"
e.rmempty = false

View File

@ -30,7 +30,7 @@ conf_proxy_add() {
local cfg="$1"
local tmpconf="$2"
local enable type domain_type custom_domains remote_port local_ip local_port enable_http_auth enable_host_header_rewrite host_header_rewrite
local subdomain use_encryption use_compression http_user http_pwd remark locations
local subdomain proxy_protocol_version use_encryption use_compression http_user http_pwd remark locations
local enable_plugin plugin plugin_http_user plugin_http_passwd plugin_unix_path stcp_role stcp_secretkey stcp_servername
config_get_bool enable "$cfg" enable 1
@ -54,6 +54,7 @@ conf_proxy_add() {
config_get stcp_role "$cfg" stcp_role
config_get stcp_secretkey "$cfg" stcp_secretkey
config_get stcp_servername "$cfg" stcp_servername
config_get proxy_protocol_version "$cfg" proxy_protocol_version
[ -n "$remark" ] && [ -n "$type" ] || return 1
@ -92,7 +93,11 @@ conf_proxy_add() {
[ -n "$stcp_secretkey" ] && echo "sk=$stcp_secretkey" >>$tmpconf || return 1
}
[ -n "$proxy_protocol_version" ] && {
if [ "$proxy_protocol_version" != "disable" ]; then
echo "proxy_protocol_version=$proxy_protocol_version" >>$tmpconf
fi
}
frp_write_bool use_encryption $cfg 1
frp_write_bool use_compression $cfg 1