luci-app-frpc: Support TLS Connection and Admin Web (#6945)

This commit is contained in:
Eason 2021-06-07 23:14:22 +08:00 committed by GitHub
parent 38862e7f50
commit d871216a7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 3 deletions

View File

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

View File

@ -42,6 +42,9 @@ e.rmempty=false
e=t:taboption("other",Flag, "tcp_mux", translate("TCP Stream Multiplexing"), translate("Default is Ture. This feature in frps.ini and frpc.ini must be same.")) e=t:taboption("other",Flag, "tcp_mux", translate("TCP Stream Multiplexing"), translate("Default is Ture. This feature in frps.ini and frpc.ini must be same."))
e.default = "1" e.default = "1"
e.rmempty=false e.rmempty=false
e=t:taboption("other",Flag, "tls_enable", translate("Use TLS Connection"), translate("if tls_enable is true, frpc will connect frps by tls."))
e.default = "0"
e.rmempty=false
e=t:taboption("other",ListValue, "protocol", translate("Protocol Type"),translate("Frp support kcp protocol since v0.12.0")) e=t:taboption("other",ListValue, "protocol", translate("Protocol Type"),translate("Frp support kcp protocol since v0.12.0"))
e.default = "tcp" e.default = "tcp"
e:value("tcp",translate("TCP Protocol")) e:value("tcp",translate("TCP Protocol"))
@ -78,6 +81,26 @@ e.datatype = "uinteger"
e.default = "3" e.default = "3"
e.rmempty=false e.rmempty=false
e.optional=false e.optional=false
e=t:taboption("other",Flag, "admin_enable", translate("Enable Web API"), translate("set admin address for control frpc's action by http api such as reload."))
e.default = "0"
e.rmempty=false
e=t:taboption("other",Value, "admin_port", translate("Admin Web Port"))
e.datatype = "port"
e.default=7400
e.rmempty=false
e:depends("admin_enable",1)
e=t:taboption("other",Value, "admin_user", translate("Admin Web UserName"))
e.optional=false
e.default = "admin"
e.rmempty=false
e:depends("admin_enable",1)
e=t:taboption("other",Value, "admin_pwd", translate("Admin Web PassWord"))
e.optional=false
e.default = "admin"
e.password=true
e.rmempty=false
e:depends("admin_enable",1)
e=t:taboption("log",TextValue,"log") e=t:taboption("log",TextValue,"log")
e.rows=26 e.rows=26
e.wrap="off" e.wrap="off"

View File

@ -68,6 +68,12 @@ msgstr "第一次登录失败就退出程序,否则将持续尝试登陆 Frp
msgid "Default is Ture. This feature in frps.ini and frpc.ini must be same." msgid "Default is Ture. This feature in frps.ini and frpc.ini must be same."
msgstr "该功能默认启用,该配置项在服务端和客户端必须保持一致。" msgstr "该功能默认启用,该配置项在服务端和客户端必须保持一致。"
msgid "Use TLS Connection"
msgstr "TLS连接"
msgid "if tls_enable is true, frpc will connect frps by tls."
msgstr "使用TLS协议与服务器连接(若连接服务器异常可以尝试开启)"
msgid "Protocol Type" msgid "Protocol Type"
msgstr "协议类型" msgstr "协议类型"
@ -128,6 +134,21 @@ msgstr "错误"
msgid "Log Keepd Max Days" msgid "Log Keepd Max Days"
msgstr "日志记录天数" msgstr "日志记录天数"
msgid "Enable Web API"
msgstr "开启网页管理"
msgid "set admin address for control frpc's action by http api such as reload."
msgstr "可通过http查看客户端状态以及通过API控制"
msgid "Admin Web Port"
msgstr "管理员端口号"
msgid "Admin Web UserName"
msgstr "管理员用户名"
msgid "Admin Web PassWord"
msgstr "管理员密码"
msgid "Services List" msgid "Services List"
msgstr "服务列表" msgstr "服务列表"

View File

@ -171,8 +171,8 @@ boot() {
start() { start() {
config_load "frp" config_load "frp"
local enabled server_addr server_port time privilege_token user tcp_mux enable_cpool local enabled server_addr server_port time privilege_token user tcp_mux enable_cpool tls_enable
local pool_count log_level log_max_days login_fail_exit http_proxy protocol local pool_count log_level log_max_days login_fail_exit http_proxy protocol admin_port admin_user admin_pwd
config_get_bool enabled common enabled 1 config_get_bool enabled common enabled 1
@ -189,6 +189,10 @@ start() {
config_get http_proxy common http_proxy config_get http_proxy common http_proxy
config_get protocol common protocol config_get protocol common protocol
config_get time common time config_get time common time
config_get admin_port common admin_port
config_get admin_user common admin_user
config_get admin_pwd common admin_pwd
mkdir -p /var/etc/frp mkdir -p /var/etc/frp
[ ! -f "$LOGFILE" ] && touch $LOGFILE [ ! -f "$LOGFILE" ] && touch $LOGFILE
@ -209,9 +213,14 @@ start() {
echo "log_file=$LOGFILE" >>$tmpconf echo "log_file=$LOGFILE" >>$tmpconf
[ -n "$http_proxy" ] && echo "http_proxy=$http_proxy" >>$tmpconf [ -n "$http_proxy" ] && echo "http_proxy=$http_proxy" >>$tmpconf
[ -n "$pool_count" ] && echo "pool_count=$pool_count" >>$tmpconf [ -n "$pool_count" ] && echo "pool_count=$pool_count" >>$tmpconf
[ -n "$admin_port" ] && echo "admin_addr=0.0.0.0" >>$tmpconf && echo "admin_port=$admin_port" >>$tmpconf
[ -n "$admin_user" ] && echo "admin_user=$admin_user" >>$tmpconf
[ -n "$admin_pwd" ] && echo "admin_pwd=$admin_pwd" >>$tmpconf
config_load "frp" config_load "frp"
frp_write_bool tcp_mux common 1 frp_write_bool tcp_mux common 1
frp_write_bool tls_enable common 0
frp_write_bool login_fail_exit common 1 frp_write_bool login_fail_exit common 1
config_foreach conf_proxy_add proxy "$tmpconf" config_foreach conf_proxy_add proxy "$tmpconf"