更新插件

This commit is contained in:
WindyMadman 2024-08-28 15:55:58 +08:00
parent f4c932f76a
commit 0576ad1827
10 changed files with 127 additions and 53 deletions

View File

@ -1,18 +1,18 @@
# #
# Copyright 2020 lwz322 <lwz322@qq.com> # Copyright 2020 lwz322 <lwz322@qq.com> WindyMadman <fengzi_re@qq.com>
# Licensed to the public under the MIT License. # Licensed to the public under the MIT License.
# #
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-frpserver PKG_NAME:=luci-app-frps
PKG_VERSION:=0.0.2 PKG_VERSION:=0.0.2
PKG_RELEASE:=4 PKG_RELEASE:=4
PKG_LICENSE:=MIT PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=lwz322 <lwz322@qq.com> PKG_MAINTAINER:=lwz322 <lwz322@qq.com> WindyMadman <fengzi_re@qq.com>
LUCI_TITLE:=LuCI support for Frp Server LUCI_TITLE:=LuCI support for Frp Server
LUCI_DEPENDS:=+wget +frps LUCI_DEPENDS:=+wget +frps

View File

@ -1,13 +1,20 @@
-- Copyright 2020 lwz322 <lwz322@qq.com> -- Copyright 2020 lwz322 <lwz322@qq.com> WindyMadman <fengzi_re@qq.com>
-- Licensed to the public under the MIT License. -- Licensed to the public under the MIT License.
module("luci.controller.frps", package.seeall) module("luci.controller.frps", package.seeall)
function index() function index()
# 4
# 1.访 admin/services/frps
# 2.target call, template, cbicall template html cbi openwrt
# 3.
# 4.
#
if not nixio.fs.access("/etc/config/frps") then if not nixio.fs.access("/etc/config/frps") then
return return
end end
#
entry({"admin", "services", "frps"}, alias("admin", "services", "frps", "common"), _("Frp Server"), 99).dependent = true entry({"admin", "services", "frps"}, alias("admin", "services", "frps", "common"), _("Frp Server"), 99).dependent = true
entry({"admin", "services", "frps", "common"}, cbi("frps/common"), _("Settings"), 1).leaf = true entry({"admin", "services", "frps", "common"}, cbi("frps/common"), _("Settings"), 1).leaf = true
entry({"admin", "services", "frps", "server"}, cbi("frps/server"), _("Server"), 2).leaf = true entry({"admin", "services", "frps", "server"}, cbi("frps/server"), _("Server"), 2).leaf = true
@ -17,8 +24,11 @@ end
function action_status() function action_status()
local e = {} local e = {}
#
e.running = luci.sys.call("pidof frps >/dev/null") == 0 e.running = luci.sys.call("pidof frps >/dev/null") == 0
#frps版本
e.bin_version = luci.sys.exec("frps -v") e.bin_version = luci.sys.exec("frps -v")
luci.http.prepare_content("application/json") luci.http.prepare_content("application/json")
#JSON格式数据
luci.http.write_json(e) luci.http.write_json(e)
end end

View File

@ -4,25 +4,32 @@
local m, s, o local m, s, o
m = Map("frps") m = Map("frps")
#
m.title = translate("Frps - Common Settings") m.title = translate("Frps - Common Settings")
m.description = translate("Frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.<br/><a href=\"https://github.com/fatedier/frp\" target=\"_blank\">Project GitHub URL</a>") m.description = translate("Frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.<br/><a href=\"https://github.com/fatedier/frp\" target=\"_blank\">Project GitHub URL</a>")
#frps服务器状态与版本
m:section(SimpleSection).template = "frps/frps_status" m:section(SimpleSection).template = "frps/frps_status"
#
s = m:section(NamedSection, "main", "frps") s = m:section(NamedSection, "main", "frps")
s.addremove = false s.addremove = false
s.anonymous = true s.anonymous = true
# Tab分页
s:tab("general", translate("General Options")) s:tab("general", translate("General Options"))
s:tab("advanced", translate("Advanced Options")) s:tab("advanced", translate("Advanced Options"))
s:tab("dashboard", translate("Dashboard Options")) s:tab("dashboard", translate("Dashboard Options"))
#
o = s:taboption("general", Flag, "enabled", translate("Enabled")) o = s:taboption("general", Flag, "enabled", translate("Enabled"))
#
o = s:taboption("general", Value, "client_file", translate("Client file")) o = s:taboption("general", Value, "client_file", translate("Client file"))
o.default = "/usr/bin/frps" o.default = "/usr/bin/frps"
o.rmempty = false o.rmempty = false
#
o = s:taboption("general", ListValue, "run_user", translate("Run daemon as user")) o = s:taboption("general", ListValue, "run_user", translate("Run daemon as user"))
o:value("", translate("root")) o:value("", translate("root"))
local user local user
@ -30,12 +37,15 @@ for user in luci.util.execi("cat /etc/passwd | cut -d':' -f1") do
o:value(user) o:value(user)
end end
#
o = s:taboption("general", Flag, "enable_logging", translate("Enable logging")) o = s:taboption("general", Flag, "enable_logging", translate("Enable logging"))
o = s:taboption("general", Value, "log_file", translate("Log file")) #
o = s:taboption("general", Value, "log_to", translate("Log file"))
o:depends("enable_logging", "1") o:depends("enable_logging", "1")
o.default = "/var/log/frps.log" o.default = "/var/log/frps.log"
#
o = s:taboption("general", ListValue, "log_level", translate("Log level")) o = s:taboption("general", ListValue, "log_level", translate("Log level"))
o:depends("enable_logging", "1") o:depends("enable_logging", "1")
o:value("trace", translate("Trace")) o:value("trace", translate("Trace"))
@ -45,49 +55,69 @@ o:value("warn", translate("Warning"))
o:value("error", translate("Error")) o:value("error", translate("Error"))
o.default = "Warn" o.default = "Warn"
o = s:taboption("general", ListValue, "log_max_days", translate("Log max days")) #
o = s:taboption("general", ListValue, "log_maxdays", translate("Log max days"))
o.description = translate("Maximum number of days to keep log files is 3 day.") o.description = translate("Maximum number of days to keep log files is 3 day.")
o:depends("enable_logging", "1") o:depends("enable_logging", "1")
o.datatype = "uinteger" o.datatype = "uinteger"
o:value("1", translate("1")) o:value("1", translate("1"))
o:value("2", translate("2")) o:value("2", translate("2"))
o:value("3", translate("3")) o:value("3", translate("3"))
o:value("4", translate("4"))
o:value("5", translate("5"))
o:value("6", translate("6"))
o:value("7", translate("7"))
o.default = "3" o.default = "3"
o.optional = false o.optional = false
o = s:taboption("general", Flag, "disable_log_color", translate("Disable log color")) #
o:depends("enable_logging", "1") o = s:taboption("general", Flag, "log_disable_print_color", translate("Disable log color"))
o.enabled = "true" o.enabled = "true"
o.disabled = "false" o.disabled = "false"
o = s:taboption("advanced", Value, "max_pool_count", translate("Max pool count")) #
o = s:taboption("advanced", Value, "transport_max_pool_count", translate("Max pool count"))
o.description = translate("pool_count in each proxy will change to max_pool_count if they exceed the maximum value") o.description = translate("pool_count in each proxy will change to max_pool_count if they exceed the maximum value")
o.datatype = "uinteger" o.datatype = "uinteger"
#
o = s:taboption("advanced", Value, "max_ports_per_client", translate("Max ports per-client")) o = s:taboption("advanced", Value, "max_ports_per_client", translate("Max ports per-client"))
o.description = translate("max ports can be used for each client, default value is 0 means no limit") o.description = translate("max ports can be used for each client, default value is 0 means no limit")
o.datatype = "uinteger" o.datatype = "uinteger"
o.defalut = '0' o.defalut = '0'
o.placeholder = '0' o.placeholder = '0'
o = s:taboption("advanced", Value, "subdomain_host", translate("Subdomain host")) #
o = s:taboption("advanced", Value, "sub_domain_host", translate("Subdomain host"))
o.description = translatef("if subdomain_host is not empty, you can set subdomain when type is http or https in frpc's configure file; when subdomain is test, the host used by routing is test.frps.com") o.description = translatef("if subdomain_host is not empty, you can set subdomain when type is http or https in frpc's configure file; when subdomain is test, the host used by routing is test.frps.com")
o.datatype = "host" o.datatype = "host"
o = s:taboption("dashboard", Value, "dashboard_addr", translate("Dashboard addr")) #WEB面板设置
o = s:taboption("dashboard", Value, "webserver_addr", translate("Dashboard addr"))
o.description = translatef("dashboard addr's default value is same with bind_addr") o.description = translatef("dashboard addr's default value is same with bind_addr")
o.default = "0.0.0.0" o.default = "0.0.0.0"
o.datatype = "host" o.datatype = "host"
o = s:taboption("dashboard", Value, "dashboard_port", translate("Dashboard port")) o = s:taboption("dashboard", Value, "webserver_port", translate("Dashboard port"))
o.description = translatef("dashboard is available only if dashboard_port is set") o.description = translatef("dashboard is available only if dashboard_port is set")
o.default = "7500" o.default = "7500"
o.datatype = "port" o.datatype = "port"
o = s:taboption("dashboard", Value, "dashboard_user", translate("Dashboard user")) o = s:taboption("dashboard", Value, "webserver_user", translate("Dashboard user"))
o.description = translatef("dashboard user and passwd for basic auth protect, if not set, both default value is admin") o.description = translatef("dashboard user and passwd for basic auth protect, if not set, both default value is admin")
o = s:taboption("dashboard", Value, "dashboard_pwd", translate("Dashboard password")) o = s:taboption("dashboard", Value, "webserver_password", translate("Dashboard password"))
o.password = true o.password = true
#
o = s:taboption("dashboard", Flag, "enable_prometheus", translate("asd654asd65"))
o.enabled = "true"
o.disabled = "false"
# Prometheus webServer
o = s:taboption("dashboard", Flag, "enable_prometheus", translate("sad65asd645a"))
o.enabled = "true"
o.disabled = "false"
o.defalut = o.disabled
return m return m

View File

@ -4,53 +4,64 @@
local m, s, o local m, s, o
m = Map("frps") m = Map("frps")
#
m.title = translate("Frps - Server Settings") m.title = translate("Frps - Server Settings")
m.description = translate("FRPS Server Settings") m.description = translate("FRPS Server Settings")
#
s = m:section(NamedSection, "main", "frps") s = m:section(NamedSection, "main", "frps")
s.anonymous = true s.anonymous = true
s.addremove = false s.addremove = false
#IP
o = s:taboption("dashboard", Value, "bind_addr", translate("Bind addr"))
o.description = translatef("asd65as4d6as6d5")
o.default = "0.0.0.0"
o.datatype = "host"
#
o = s:option(Value, "bind_port", translate("Bind port")) o = s:option(Value, "bind_port", translate("Bind port"))
o.datatype = "port" o.datatype = "port"
o.rmempty = false o.rmempty = false
o = s:option(Value, "token", translate("Token")) #
o = s:option(Value, "auth_token", translate("Token"))
o.password = true o.password = true
o = s:option(Flag, "tcp_mux", translate("TCP mux")) #tls登录服务器
o.enabled = "true" o = s:option(Flag, "tls_force", translate("Enforce frps only accept TLS connection"))
o.disabled = "false"
o.defalut = o.enabled
o.rmempty = false
o = s:option(Flag, "tls_only", translate("Enforce frps only accept TLS connection"))
o.description = translatef("Requirements: frpc v0.25.0+, frps v0.32.0+") o.description = translatef("Requirements: frpc v0.25.0+, frps v0.32.0+")
o.enabled = "true" o.enabled = "true"
o.disabled = "false" o.disabled = "false"
o.default = o.disabled o.default = o.disabled
o.rmempty = false o.rmempty = false
o = s:option(Value, "bind_udp_port", translate("UDP bind port")) #kcp协议绑定端口
o.description = translatef("Optional: udp port to help make udp hole to penetrate nat")
o.datatype = "port"
o = s:option(Value, "kcp_bind_port", translate("KCP bind port")) o = s:option(Value, "kcp_bind_port", translate("KCP bind port"))
o.description = translatef("Optional: udp port used for kcp protocol, it can be same with 'bind port'; if not set, kcp is disabled in frps") o.description = translatef("Optional: udp port used for kcp protocol, it can be same with 'bind port'; if not set, kcp is disabled in frps")
o.datatype = "port" o.datatype = "port"
#quic协议绑定端口
o = s:option(Value, "quic_bind_port", translate("Quic bind port")) o = s:option(Value, "quic_bind_port", translate("Quic bind port"))
o.description = translatef("Optional: udp port used for quic protocol, it can be same with 'bind port'; if not set, quic is disabled in frps") o.description = translatef("Optional: udp port used for quic protocol, it can be same with 'bind port'; if not set, quic is disabled in frps")
o.datatype = "port" o.datatype = "port"
#http绑定端口
o = s:option(Value, "vhost_http_port", translate("vhost http port")) o = s:option(Value, "vhost_http_port", translate("vhost http port"))
o.description = translatef("Optional: if you want to support virtual host, you must set the http port for listening") o.description = translatef("Optional: if you want to support virtual host, you must set the http port for listening")
o.datatype = "port" o.datatype = "port"
#https绑定端口
o = s:option(Value, "vhost_https_port", translate("vhost https port")) o = s:option(Value, "vhost_https_port", translate("vhost https port"))
o.description = translatef("Optional: Note: http port and https port can be same with bind_port") o.description = translatef("Optional: Note: http port and https port can be same with bind_port")
o.datatype = "port" o.datatype = "port"
#tcpmuxHTTP绑定端口
o = s:option(Value, "tcpmux_http_connect_port", translate("vhost https port"))
o.description = translatef("Optional: Note: http port and https port can be same with bind_port")
o.datatype = "port"
#
o = s:option(DynamicList, "extra_setting", translate("Extra Settings")) o = s:option(DynamicList, "extra_setting", translate("Extra Settings"))
o.description = translatef("List of extra settings will be added to config file. Format: option=value, eg. <code>detailed_errors_to_client=false</code>.(NO SPACE!)") o.description = translatef("List of extra settings will be added to config file. Format: option=value, eg. <code>detailed_errors_to_client=false</code>.(NO SPACE!)")
o.placeholder = "option=value" o.placeholder = "option=value"

View File

@ -0,0 +1,30 @@
config frps 'main'
option enabled '0'
option bind_addr '0.0.0.0'
option bind_port '7000'
option auth_token 'as65d46as5d4'
option tls_force '0'
option kcp_bind_port '7001'
option quic_bind_port '7002'
option vhost_http_port '7003'
option vhost_https_port '7004'
option tcpmux_http_connect_port '7005'
option transport_max_pool_count '5'
option max_ports_per_client '0'
option enable_prometheus 'true'
option webserver_addr '0.0.0.0'
option webserver_port '7500'
option webserver_user 'admin'
option webserver_password 'admin'
option sub_domain_host ''
option enable_logging '1'
option log_to '/var/log/frps.log'
option log_level 'info'
option log_maxdays '3'
option log_disable_print_color 'true'
option server 'frps'
option client_file '/usr/bin/frps'

View File

@ -54,29 +54,30 @@ append_setting() {
frps_scetion_validate() { frps_scetion_validate() {
uci_validate_section "$NAME" "frps" "$1" \ uci_validate_section "$NAME" "frps" "$1" \
'enabled:bool:0' \ 'enabled:bool:0' \
'client_file:file:/usr/bin/frps' \
'run_user:string' \ 'run_user:string' \
'enable_logging:bool:0' \ 'bind_addr:host' \
'log_file:string:/var/log/frps.log' \
'log_level:or("trace", "debug", "info", "warn", "error"):warn' \
'log_max_days:uinteger:3' \
'disable_log_color:or("true", "false")' \
'max_pool_count:uinteger' \
'max_ports_per_client:uinteger:0' \
'subdomain_host:host' \
'dashboard_addr:host' \
'dashboard_port:port' \
'dashboard_user:string' \
'dashboard_pwd:string' \
'bind_port:port' \ 'bind_port:port' \
'token:string' \ 'auth_token:string' \
'tcp_mux:or("true", "false"):true' \ 'tls_force:or("true", "false"):false' \
'tls_only:or("true", "false"):false' \
'bind_udp_port:port' \
'kcp_bind_port:port' \ 'kcp_bind_port:port' \
'quic_bind_port:port' \ 'quic_bind_port:port' \
'vhost_http_port:port' \ 'vhost_http_port:port' \
'vhost_https_port:port' 'vhost_https_port:port' \
'tcpmux_http_connect_port:port' \
'transport_max_pool_count:uinteger' \
'max_ports_per_client:uinteger:0' \
'enable_prometheus:or("true", "false"):true' \
'webserver_addr:host' \
'webserver_port:port' \
'webserver_user:string' \
'webserver_password:string' \
'sub_domain_host:host' \
'enable_logging:bool:0' \
'log_to:string:/var/log/frps.log' \
'log_level:or("trace", "debug", "info", "warn", "error"):warn' \
'log_maxdays:uinteger:3' \
'log_disable_print_color:or("true", "false")' \
'client_file:file:/usr/bin/frps'
} }
client_file_validate() { client_file_validate() {

View File

@ -1,8 +0,0 @@
config frps 'main'
option enabled '0'
option server 'frps'
option dashboard_addr '0.0.0.0'
option client_file '/usr/bin/frps'
option bind_port '7000'
option dashboard_port '7500'
option tcp_mux 'true'