diff --git a/cups/Makefile b/cups/Makefile index 98f1807e..24e89205 100644 --- a/cups/Makefile +++ b/cups/Makefile @@ -9,8 +9,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cups -PKG_VERSION:=2.4.17 -PKG_RELEASE:=2 +PKG_VERSION:=2.4.18 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-source.tar.gz PKG_SOURCE_URL:=https://github.com/OpenPrinting/cups/releases/download/v$(PKG_VERSION) PKG_MD5SUM:=skip diff --git a/luci-app-frpc/Makefile b/luci-app-frpc/Makefile deleted file mode 100644 index c69ea6bd..00000000 --- a/luci-app-frpc/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright (C) 2008-2014 The LuCI Team -# -# This is free software, licensed under the Apache License, Version 2.0 . -# - -include $(TOPDIR)/rules.mk - -LUCI_TITLE:=LuCI for FRPC -LUCI_DEPENDS:=+wget +frpc -LUCI_PKGARCH:=all - -PKG_NAME:=luci-app-frpc -PKG_VERSION:=1.4 -PKG_RELEASE:=1 - -include $(TOPDIR)/feeds/luci/luci.mk - -# call BuildPackage - OpenWrt buildroot signature diff --git a/luci-app-frpc/luasrc/controller/frp.lua b/luci-app-frpc/luasrc/controller/frp.lua deleted file mode 100644 index 59ee2ddf..00000000 --- a/luci-app-frpc/luasrc/controller/frp.lua +++ /dev/null @@ -1,18 +0,0 @@ -module("luci.controller.frp", package.seeall) - -function index() - if not nixio.fs.access("/etc/config/frp") then - return - end - - entry({"admin", "services", "frp"}, cbi("frp/basic"), _("Frp Setting"), 100).dependent = true - entry({"admin", "services", "frp", "config"}, cbi("frp/config")).leaf = true - entry({"admin", "services", "frp", "status"}, call("act_status")).leaf = true -end - -function act_status() - local e = {} - e.running = luci.sys.call("pidof frpc > /dev/null") == 0 - luci.http.prepare_content("application/json") - luci.http.write_json(e) -end diff --git a/luci-app-frpc/luasrc/model/cbi/frp/basic.lua b/luci-app-frpc/luasrc/model/cbi/frp/basic.lua deleted file mode 100644 index f2f57e8d..00000000 --- a/luci-app-frpc/luasrc/model/cbi/frp/basic.lua +++ /dev/null @@ -1,261 +0,0 @@ -local o = require "luci.dispatcher" -local e = require ("luci.model.ipkg") -local s = require "nixio.fs" -local e = luci.model.uci.cursor() -local i = "frp" -local a, t, e -local n = {} - -a = Map("frp") -a.title = translate("Frp Setting") -a.description = translate("Frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.") - -a:section(SimpleSection).template = "frp/frp_status" - -t = a:section(NamedSection, "common", "frp") -t.anonymous = true -t.addremove = false - -t:tab("base", translate("Basic Settings")) -t:tab("other", translate("Other Settings")) -t:tab("log", translate("Client Log")) - -e = t:taboption("base", Flag, "enabled", translate("Enabled")) -e.rmempty = false - -e = t:taboption("base", Value, "server_addr", translate("Server")) -e.optional = false -e.rmempty = false - -e = t:taboption("base", Value, "server_port", translate("Port")) -e.datatype = "port" -e.optional = false -e.rmempty = false - -e = t:taboption("base", Value, "token", translate("Token")) -e.description = translate("Time duration between server of frpc and frps mustn't exceed 15 minutes.") -e.optional = false -e.password = true -e.rmempty = false - -e = t:taboption("base", Value, "user", translate("User")) -e.description = translate("Commonly used to distinguish you with other clients.") -e.optional = true -e.default = "" -e.rmempty = false - -e = t:taboption("base", Value, "vhost_http_port", translate("Vhost HTTP Port")) -e.datatype = "port" -e.rmempty = false - -e = t:taboption("base", Value, "vhost_https_port", translate("Vhost HTTPS Port")) -e.datatype = "port" -e.rmempty = false - -e = t:taboption("base", Value, "time", translate("Service registration interval")) -e.description = translate("0 means disable this feature, unit: min") -e.datatype = "range(0,59)" -e.default = 30 -e.rmempty = false - -e = t:taboption("other", Flag, "login_fail_exit", translate("Exit program when first login failed")) -e.description = translate("decide if exit program when first login failed, otherwise continuous relogin to frps.") -e.default = "1" -e.rmempty = false - -e = t:taboption("other", Flag, "tcp_mux", translate("TCP Stream Multiplexing")) -e.description = translate("Default is Ture. This feature in frps.ini and frpc.ini must be same.") -e.default = "1" -e.rmempty = false - -e = t:taboption("other", Flag, "tls_enable", translate("Use TLS Connection")) -e.description = translate("if tls_enable is true, frpc will connect frps by tls.") -e.default = "0" -e.rmempty = false - -e = t:taboption("other", Flag, "enable_custom_certificate", translate("Custom TLS Protocol Encryption")) -e.description = translate("Frp supports traffic encryption between frpc and frps through the TLS protocol, and supports client or server unidirectional and bidirectional authentication.") -e.default = "0" -e.rmempty = false -e:depends("tls_enable", 1) - -e = t:taboption("other", Value, "tls_cert_file", translate("Client Certificate File")) -e.description = translate("Frps one-way verifies the identity of frpc.") -e.placeholder = "/var/etc/frp/client.crt" -e.optional = false -e:depends("enable_custom_certificate", 1) - -e = t:taboption("other", Value, "tls_key_file", translate("Client Key File")) -e.description = translate("Frps one-way verifies the identity of frpc.") -e.placeholder = "/var/etc/frp/client.key" -e.optional = false -e:depends("enable_custom_certificate", 1) - -e = t:taboption("other", Value, "tls_trusted_ca_file", translate("CA Certificate File")) -e.description = translate("Frpc one-way verifies the identity of frps.") -e.placeholder = "/var/etc/frp/ca.crt" -e.optional = false -e:depends("enable_custom_certificate", 1) - -e = t:taboption("other", ListValue, "protocol", translate("Protocol Type")) -e.description = translate("Frp support kcp protocol since v0.12.0") -e.default = "tcp" -e:value("tcp", translate("TCP Protocol")) -e:value("kcp", translate("KCP Protocol")) - -e = t:taboption("other", Flag, "enable_http_proxy", translate("Connect frps by HTTP PROXY")) -e.description = translate("frpc can connect frps using HTTP PROXY") -e.default = "0" -e.rmempty = false -e:depends("protocol", "tcp") - -e = t:taboption("other", Value, "http_proxy", translate("HTTP PROXY")) -e.placeholder = "http://user:pwd@192.168.1.128:8080" -e:depends("enable_http_proxy", 1) -e.optional = false - -e = t:taboption("other", Flag, "enable_cpool", translate("Enable Connection Pool")) -e.description = translate("This feature is fit for a large number of short connections.") -e.rmempty = false - -e = t:taboption("other", Value, "pool_count", translate("Connection Pool")) -e.description = translate("Connections will be established in advance.") -e.datatype = "uinteger" -e.default = "1" -e:depends("enable_cpool", 1) -e.optional = false - -e = t:taboption("other", ListValue, "log_level", translate("Log Level")) -e.default = "warn" -e:value("trace", translate("Trace")) -e:value("debug", translate("Debug")) -e:value("info", translate("Info")) -e:value("warn", translate("Warning")) -e:value("error", translate("Error")) - -e = t:taboption("other", Value, "log_max_days", translate("Log Keepd Max Days")) -e.datatype = "uinteger" -e.default = "3" -e.rmempty = false -e.optional = false - -e = t:taboption("other", Flag, "admin_enable", translate("Enable Web API")) -e.description = 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:depends("admin_enable", 1) - -e = t:taboption("other", Value, "admin_user", translate("Admin Web UserName")) -e.optional = false -e.default = "admin" -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:depends("admin_enable", 1) - -e = t:taboption("log", TextValue, "log") -e.rows = 26 -e.wrap = "off" -e.readonly = true -e.cfgvalue = function(t,t) -return s.readfile("/var/etc/frp/frpc.log")or"" -end -e.write = function(e,e,e) -end - -t = a:section(TypedSection, "proxy", translate("Services List")) -t.anonymous = true -t.addremove = true -t.template = "cbi/tblsection" -t.extedit = o.build_url("admin", "services", "frp", "config", "%s") - -function t.create(e,t) -new = TypedSection.create(e,t) -luci.http.redirect(e.extedit:format(new)) -end - -function t.remove(e,t) -e.map.proceed = true -e.map:del(t) -luci.http.redirect(o.build_url("admin","services","frp")) -end - -local o = "" -e = t:option(DummyValue, "remark", translate("Service Remark Name")) -e.width = "10%" - -e = t:option(DummyValue, "type", translate("Frp Protocol Type")) -e.width = "10%" - -e = t:option(DummyValue, "custom_domains", translate("Domain/Subdomain")) -e.width = "20%" - -e.cfgvalue = function(t,n) -local t = a.uci:get(i,n,"domain_type")or"" -local m = a.uci:get(i,n,"type")or"" -if t=="custom_domains" then -local b = a.uci:get(i,n,"custom_domains")or"" return b end -if t=="subdomain" then -local b = a.uci:get(i,n,"subdomain")or"" return b end -if t=="both_dtype" then -local b = a.uci:get(i,n,"custom_domains")or"" -local c = a.uci:get(i,n,"subdomain")or"" -b="%s/%s"%{b,c} return b end -if m=="tcp" or m=="udp" then -local b = a.uci:get(i,"common","server_addr")or"" return b end -end - -e = t:option(DummyValue, "remote_port", translate("Remote Port")) -e.width = "10%" -e.cfgvalue = function(t,b) -local t = a.uci:get(i,b,"type")or"" -if t==""or b==""then return""end -if t=="http" then -local b = a.uci:get(i,"common","vhost_http_port")or"" return b end -if t=="https" then -local b = a.uci:get(i,"common","vhost_https_port")or"" return b end -if t=="tcp" or t=="udp" then -local b = a.uci:get(i,b,"remote_port")or"" return b end -end - -e = t:option(DummyValue, "local_ip", translate("Local Host Address")) -e.width = "15%" - -e = t:option(DummyValue, "local_port", translate("Local Host Port")) -e.width = "10%" - -e = t:option(DummyValue, "use_encryption", translate("Use Encryption")) -e.width = "15%" - -e.cfgvalue = function(t,n) -local t = a.uci:get(i,n,"use_encryption")or"" -local b -if t==""or b==""then return""end -if t=="1" then b="ON" -else b="OFF" end -return b -end - -e = t:option(DummyValue, "use_compression", translate("Use Compression")) -e.width = "15%" -e.cfgvalue = function(t,n) -local t = a.uci:get(i,n,"use_compression")or"" -local b -if t==""or b==""then return""end -if t=="1" then b="ON" -else b="OFF" end -return b -end - -e = t:option(Flag, "enable", translate("Enable State")) -e.width = "10%" -e.rmempty = false - -return a diff --git a/luci-app-frpc/luasrc/model/cbi/frp/config.lua b/luci-app-frpc/luasrc/model/cbi/frp/config.lua deleted file mode 100644 index 9dafbd51..00000000 --- a/luci-app-frpc/luasrc/model/cbi/frp/config.lua +++ /dev/null @@ -1,222 +0,0 @@ -local n = "frp" -local i = require "luci.dispatcher" -local o = require "luci.model.network".init() -local m = require "nixio.fs" -local a, t, e - -arg[1] = arg[1]or"" - -a = Map("frp") -a.title = translate("Frp Domain Config") -a.redirect = i.build_url("admin", "services", "frp") - -t = a:section(NamedSection, arg[1], "frp") -t.title = translate("Config Frp Protocol") -t.addremove = false -t.dynamic = false - -t:tab("base", translate("Basic Settings")) -t:tab("other", translate("Other Settings")) - -e = t:taboption("base", ListValue, "enable", translate("Enable State")) -e.default = "1" -e.rmempty = false -e:value("1", translate("Enable")) -e:value("0", translate("Disable")) - -e = t:taboption("base", ListValue, "type", translate("Frp Protocol Type")) -e:value("http", translate("HTTP")) -e:value("https", translate("HTTPS")) -e:value("tcp", translate("TCP")) -e:value("udp", translate("UDP")) -e:value("stcp", translate("STCP")) -e:value("xtcp", translate("XTCP")) - -e = t:taboption("base", ListValue, "domain_type", translate("Domain Type")) -e.default = "custom_domains" -e:value("custom_domains", translate("Custom Domains")) -e:value("subdomain", translate("SubDomain")) -e:value("both_dtype", translate("Both the above two Domain types")) -e:depends("type", "http") -e:depends("type", "https") - -e = t:taboption("base", Value, "custom_domains", translate("Custom Domains")) -e.description = translate("If SubDomain is used, Custom Domains couldn't be subdomain or wildcard domain of the maindomain(subdomain_host).") -e:depends("domain_type", "custom_domains") -e:depends("domain_type", "both_dtype") - -e = t:taboption("base", Value, "subdomain", translate("SubDomain")) -e.description = translate("subdomain_host must be configured in server: frps in advance.") -e:depends("domain_type", "subdomain") -e:depends("domain_type", "both_dtype") - -e = t:taboption("base", ListValue, "stcp_role", translate("STCP Role")) -e.default = "server" -e:value("server", translate("STCP Server")) -e:value("visitor", translate("STCP Vistor")) -e:depends("type", "stcp") - -e = t:taboption("base", ListValue, "xtcp_role", translate("XTCP Role")) -e.default = "server" -e:value("server", translate("XTCP Server")) -e:value("visitor", translate("XTCP Vistor")) -e:depends("type", "xtcp") - -e = t:taboption("base", Value, "remote_port", translate("Remote Port")) -e.datatype = "port" -e:depends("type", "tcp") -e:depends("type", "udp") - -e = t:taboption("other", Flag, "enable_plugin", translate("Use Plugin")) -e.description = translate("If plugin is defined, local_ip and local_port is useless, plugin will handle connections got from frps.") -e.default = "0" -e:depends("type", "tcp") - -e = t:taboption("base", Value, "local_ip", translate("Local Host Address")) -luci.sys.net.ipv4_hints(function(x,d) -e:value(x,"%s (%s)"%{x,d}) -end) -luci.sys.net.ipv6_hints(function(x,d) -e:value(x,"%s (%s)"%{x,d}) -end) -e:depends("type", "udp") -e:depends("type", "http") -e:depends("type", "https") -e:depends("enable_plugin", 0) - -e = t:taboption("base", Value, "local_port", translate("Local Host Port")) -e.datatype = "port" -e:depends("type", "udp") -e:depends("type", "http") -e:depends("type", "https") -e:depends("enable_plugin", 0) - -e = t:taboption("base", Value, "stcp_secretkey", translate("STCP Screct Key")) -e.default = "abcdefg" -e:depends("type", "stcp") - -e = t:taboption("base", Value, "stcp_servername", translate("STCP Server Name")) -e.description = translate("STCP Server Name is Service Remark Name of STCP Server") -e.default = "secret_tcp" -e:depends("stcp_role", "visitor") - -e = t:taboption("base", Value, "xtcp_secretkey", translate("XTCP Screct Key")) -e.default = "abcdefg" -e:depends("type", "xtcp") - -e = t:taboption("base", Value, "xtcp_servername", translate("XTCP Server Name")) -e.description = translate("XTCP Server Name is Service Remark Name of XTCP Server") -e.default = "p2p_tcp" -e:depends("xtcp_role", "visitor") - -e = t:taboption("other", Flag, "enable_locations", translate("Enable URL routing")) -e.description = translate("Frp support forward http requests to different backward web services by url routing.") -e:depends("type", "http") - -e = t:taboption("other", Value, "locations", translate("URL routing")) -e.description = translate("Http requests with url prefix /news will be forwarded to this service.") -e.default = "locations=/" -e:depends("enable_locations", 1) - -e = t:taboption("other", ListValue, "plugin", translate("Choose Plugin")) -e:value("http_proxy", translate("http_proxy")) -e:value("socks5", translate("socks5")) -e:value("unix_domain_socket", translate("unix_domain_socket")) -e:depends("enable_plugin", 1) - -e = t:taboption("other", Flag, "enable_plugin_httpuserpw", translate("Proxy Authentication")) -e.description = translate("Other PCs could access the Internet through frpc's network by using http_proxy plugin.") -e.default = "0" -e:depends("plugin", "http_proxy") - -e = t:taboption("other", Value, "plugin_http_user", translate("HTTP Proxy UserName")) -e.default = "abc" -e:depends("enable_plugin_httpuserpw", 1) - -e = t:taboption("other", Value, "plugin_http_passwd", translate("HTTP Proxy Password")) -e.default = "abc" -e:depends("enable_plugin_httpuserpw", 1) - -e = t:taboption("other", Value, "plugin_unix_path", translate("Plugin Unix Sock Path")) -e.default = "/var/run/docker.sock" -e:depends("plugin", "unix_domain_socket") - -e = t:taboption("other", Flag, "enable_http_auth", translate("Password protecting your web service")) -e.description = translate("Http username and password are safety certification for http protocol.") -e.default = "0" -e:depends("type", "http") - -e = t:taboption("other", Value, "http_user", translate("HTTP UserName")) -e.default = "frp" -e:depends("enable_http_auth", 1) - -e = t:taboption("other", Value, "http_pwd", translate("HTTP PassWord")) -e.default = "frp" -e:depends("enable_http_auth", 1) - -e = t:taboption("other", Flag, "enable_host_header_rewrite", translate("Rewriting the Host Header")) -e.description = translate("Frp can rewrite http requests with a modified Host header.") -e.default = "0" -e:depends("type", "http") - -e = t:taboption("other", Value, "host_header_rewrite", translate("Host Header")) -e.description = 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("other", Flag, "enable_https_plugin", translate("Use Plugin")) -e.default = "0" -e:depends("type", "https") - -e = t:taboption("other", ListValue, "https_plugin", translate("Choose Plugin")) -e.description = translate("If plugin is defined, local_ip and local_port is useless, plugin will handle connections got from frps.") -e:value("https2http", translate("https2http")) -e:depends("enable_https_plugin", 1) - -e = t:taboption("other", Value, "plugin_local_addr", translate("Plugin_Local_Addr")) -e.default = "127.0.0.1:80" -e:depends("https_plugin", "https2http") - -e = t:taboption("other", Value, "plugin_crt_path", translate("plugin_crt_path")) -e.default = "./server.crt" -e:depends("https_plugin", "https2http") - -e = t:taboption("other", Value, "plugin_key_path", translate("plugin_key_path")) -e.default = "./server.key" -e:depends("https_plugin", "https2http") - -e = t:taboption("other", Value, "plugin_host_header_rewrite", translate("plugin_host_header_rewrite")) -e.default = "127.0.0.1" -e:depends("https_plugin", "https2http") - -e = t:taboption("other", Value, "plugin_header_X_From_Where", translate("plugin_header_X-From-Where")) -e.default = "frp" -e:depends("https_plugin", "https2http") - -e = t:taboption("base", ListValue, "proxy_protocol_version", translate("Proxy-Protocol Version")) -e.description = 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", "xtcp") -e:depends("type", "http") -e:depends("type", "https") - -e = t:taboption("base", Flag, "use_encryption", translate("Use Encryption")) -e.description = translate("Encrypted the communication between frpc and frps, will effectively prevent the traffic intercepted (If Custom TLS Protocol Encryption is enabled, except that the protocol of xtcp is configured as kcp, you can no longer set Use Encryption to repeat encryption).") -e.default = "1" -e.rmempty = false - -e = t:taboption("base", Flag, "use_compression", translate("Use Compression")) -e.description = translate("The contents will be compressed to speed up the traffic forwarding speed, but this will consume some additional cpu resources.") -e.default = "1" -e.rmempty = false - -e = t:taboption("base", Value, "remark", translate("Service Remark Name")) -e.description = translate("Please ensure the remark name is unique.") -e.rmempty = false - -return a diff --git a/luci-app-frpc/luasrc/view/frp/frp_status.htm b/luci-app-frpc/luasrc/view/frp/frp_status.htm deleted file mode 100644 index c1c38a4f..00000000 --- a/luci-app-frpc/luasrc/view/frp/frp_status.htm +++ /dev/null @@ -1,22 +0,0 @@ - - -
-

- <%:Collecting data...%> -

-
diff --git a/luci-app-frpc/po/zh-cn/frp.po b/luci-app-frpc/po/zh-cn/frp.po deleted file mode 100644 index bad6ce7b..00000000 --- a/luci-app-frpc/po/zh-cn/frp.po +++ /dev/null @@ -1,323 +0,0 @@ -msgid "" -msgstr "Content-Type: text/plain; charset=UTF-8" - -msgid "Frp Setting" -msgstr "Frp 内网穿透" - -msgid "NOT RUNNING" -msgstr "未运行" - -msgid "RUNNING" -msgstr "运行中" - -msgid "Frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet." -msgstr "Frp 是一个可用于内网穿透的高性能的反向代理应用。" - -msgid "Basic Settings" -msgstr "基本设置" - -msgid "Other Settings" -msgstr "其他设置" - -msgid "Client Log" -msgstr "日志" - -msgid "Enabled" -msgstr "启用" - -msgid "Server" -msgstr "服务器" - -msgid "Port" -msgstr "端口" - -msgid "Token" -msgstr "令牌" - -msgid "User" -msgstr "用户名" - -msgid "Commonly used to distinguish you with other clients." -msgstr "通常用于区分你与其他客户端" - -msgid "Time duration between server of frpc and frps mustn't exceed 15 minutes." -msgstr "frpc服务器与frps之间的时间间隔不得超过15分钟" - -msgid "Vhost HTTP Port" -msgstr "HTTP 穿透服务端口" - -msgid "Vhost HTTPS Port" -msgstr "HTTPS 穿透服务端口" - -msgid "Exit program when first login failed" -msgstr "初始登录失败即退出程序" - -msgid "TCP Stream Multiplexing" -msgstr "TCP 端口复用" - -msgid "decide if exit program when first login failed, otherwise continuous relogin to frps." -msgstr "第一次登录失败就退出程序,否则将持续尝试登陆 Frp 服务器。" - -msgid "Default is Ture. This feature in frps.ini and frpc.ini must be same." -msgstr "该功能默认启用,该配置项在服务端和客户端必须保持一致。" - -msgid "Use TLS Connection" -msgstr "TLS 连接" - -msgid "if tls_enable is true, frpc will connect frps by tls." -msgstr "使用 TLS 协议与服务器连接(若连接服务器异常可以尝试开启)" - -msgid "Custom TLS Protocol Encryption" -msgstr "自定义TLS协议加密" - -msgid "Frp supports traffic encryption between frpc and frps through the TLS protocol, and supports client or server unidirectional and bidirectional authentication." -msgstr "frp 支持 frpc 和 frps 之间的流量通过 TLS 协议加密,并且支持客户端或服务端单向验证,双向验证等功能。" - -msgid "Frps one-way verifies the identity of frpc." -msgstr "frps 单向验证 frpc 身份。" - -msgid "Client Certificate File" -msgstr "TLS 客户端证书文件路径" - -msgid "Client Key File" -msgstr "TLS 客户端密钥文件路径" - -msgid "Frpc one-way verifies the identity of frps." -msgstr "frpc 单向验证 frps 身份。" - -msgid "CA Certificate File" -msgstr "TLS CA 证书路径" - -msgid "Protocol Type" -msgstr "协议类型" - -msgid "Frp support kcp protocol since v0.12.0" -msgstr "从 v0.12.0 版本开始,底层通信协议支持选择 kcp 协议加速。" - -msgid "TCP Protocol" -msgstr "TCP 协议" - -msgid "KCP Protocol" -msgstr "KCP 协议" - -msgid "Connect frps by HTTP PROXY" -msgstr "通过代理连接 frps" - -msgid "frpc can connect frps using HTTP PROXY" -msgstr "frpc 支持通过 HTTP PROXY 和 frps 进行通信" - -msgid "HTTP PROXY" -msgstr "HTTP 代理" - -msgid "Enable Connection Pool" -msgstr "启用连接池功能" - -msgid "This feature is fit for a large number of short connections." -msgstr "适合有大量短连接请求时开启" - -msgid "Connection Pool" -msgstr "指定预创建连接的数量" - -msgid "Connections will be established in advance." -msgstr "frpc 会预先和服务端建立起指定数量的连接。" - -msgid "Service registration interval" -msgstr "服务注册间隔" - -msgid "0 means disable this feature, unit: min" -msgstr "0表示禁用定时注册功能,单位:分钟" - -msgid "Log Level" -msgstr "日志记录等级" - -msgid "Trace" -msgstr "追踪" - -msgid "Debug" -msgstr "调试" - -msgid "Info" -msgstr "信息" - -msgid "Warning" -msgstr "警告" - -msgid "Error" -msgstr "错误" - -msgid "Log Keepd Max Days" -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" -msgstr "服务列表" - -msgid "Service Remark Name" -msgstr "服务备注名" - -msgid "Domain/Subdomain" -msgstr "域名/子域名" - -msgid "Remote Port" -msgstr "远程主机端口" - -msgid "Local Host Address" -msgstr "内网主机地址" - -msgid "Local Host Port" -msgstr "内网主机端口" - -msgid "Use Encryption" -msgstr "开启数据加密" - -msgid "Use Compression" -msgstr "使用压缩" - -msgid "Enable State" -msgstr "开启状态" - -msgid "Frp Domain Config" -msgstr "Frp 域名配置" - -msgid "Config Frp Protocol" -msgstr "配置 Frp 协议参数" - -msgid "Disable" -msgstr "关闭" - -msgid "Frp Protocol Type" -msgstr "Frp 协议类型" - -msgid "Domain Type" -msgstr "域名类型" - -msgid "Custom Domains" -msgstr "自定义域名" - -msgid "SubDomain" -msgstr "子域名" - -msgid "Both the above two Domain types" -msgstr "同时使用2种域名" - -msgid "If SubDomain is used, Custom Domains couldn't be subdomain or wildcard domain of the maindomain(subdomain_host)." -msgstr "如果服务端配置了主域名(subdomain_host),则自定义域名不能是属于主域名(subdomain_host) 的子域名或者泛域名。" - -msgid "subdomain_host must be configured in server: frps in advance." -msgstr "使用子域名时,必须预先在服务端配置主域名(subdomain_host)参数。" - -msgid "STCP Role" -msgstr "STCP 服务类型" - -msgid "XTCP Role" -msgstr "XTCP 服务类型" - -msgid "Use Plugin" -msgstr "使用插件" - -msgid "If plugin is defined, local_ip and local_port is useless, plugin will handle connections got from frps." -msgstr "使用插件使用插件模式时,本地 IP 地址和端口无需配置,插件将会处理来自服务端的链接请求。" - -msgid "STCP Screct Key" -msgstr "STCP 密钥" - -msgid "STCP Server Name" -msgstr "STCP 服务名称" - -msgid "XTCP Screct Key" -msgstr "XTCP 密钥" - -msgid "XTCP Server Name" -msgstr "XTCP 服务名称" - -msgid "Enable URL routing" -msgstr "启用 URL 路由" - -msgid "Frp support forward http requests to different backward web services by url routing." -msgstr "Frp 支持通过url路由将http请求转发到不同的反向web服务。" - -msgid "Choose Plugin" -msgstr "选择插件" - -msgid "Proxy Authentication" -msgstr "代理认证" - -msgid "Other PCs could access the Internet through frpc's network by using http_proxy plugin." -msgstr "http proxy 插件,可以使其他机器通过 frpc 的网络访问互联网;开启身份验证之后需要用户名、密码才能连接到 HTTP 代理。" - -msgid "HTTP Proxy UserName" -msgstr "HTTP 代理用户名" - -msgid "HTTP Proxy Password" -msgstr "HTTP 代理密码" - -msgid "Plugin Unix Sock Path" -msgstr "Unix Sock 插件路径" - -msgid "Password protecting your web service" -msgstr "密码保护您的web服务" - -msgid "HTTP UserName" -msgstr "HTTP 用户名" - -msgid "HTTP PassWord" -msgstr "HTTP 密码" - -msgid "Rewriting the Host Header" -msgstr "修改 Host Header" - -msgid "Frp can rewrite http requests with a modified Host header." -msgstr "Frp可以用修改后的主机头重写http请求。" - -msgid "Proxy-Protocol Version" -msgstr "Proxy-Protocol 版本" - -msgid "Encrypted the communication between frpc and frps, will effectively prevent the traffic intercepted (If Custom TLS Protocol Encryption is enabled, except that the protocol of xtcp is configured as kcp, you can no longer set Use Encryption to repeat encryption)." -msgstr "将 frpc 与 frps 之间的通信内容加密传输,将会有效防止流量被拦截(启用自定义TLS协议加密后除 xtcp 的 protocol 配置为 kcp 外,可不再设置此项重复加密)。" - -msgid "The contents will be compressed to speed up the traffic forwarding speed, but this will consume some additional cpu resources." -msgstr "对传输内容进行压缩,加快流量转发速度,但是会额外消耗一些 cpu 资源。" - -msgid "Http username and password are safety certification for http protocol." -msgstr "Http用户名和密码是Http协议的安全认证。" - -msgid "Proxy Protocol to send user's real IP to local services." -msgstr "将用户的真实IP发送到本地服务的代理协议。" - -msgid "STCP Server Name is Service Remark Name of STCP Server" -msgstr "STCP服务器别名" - -msgid "XTCP Server Name is Service Remark Name of XTCP Server" -msgstr "XTCP服务器别名" - -msgid "Please ensure the remark name is unique." -msgstr "确保备注名唯一" - -msgid "Plugin_Local_Addr" -msgstr "插件本地地址(格式 IP:Port)" - -msgid "plugin_crt_path" -msgstr "插件证书路径" - -msgid "plugin_key_path" -msgstr "插件私钥路径" - -msgid "plugin_host_header_rewrite" -msgstr "插件 Host Header 重写" - -msgid "plugin_header_X-From-Where" -msgstr "插件X-From-Where请求头" diff --git a/luci-app-frpc/po/zh_Hans b/luci-app-frpc/po/zh_Hans deleted file mode 120000 index 41451e4a..00000000 --- a/luci-app-frpc/po/zh_Hans +++ /dev/null @@ -1 +0,0 @@ -zh-cn \ No newline at end of file diff --git a/luci-app-frpc/root/etc/config/frp b/luci-app-frpc/root/etc/config/frp deleted file mode 100644 index 8b1f67bb..00000000 --- a/luci-app-frpc/root/etc/config/frp +++ /dev/null @@ -1,17 +0,0 @@ - -config frp 'common' - option log_max_days '3' - option login_fail_exit '0' - option enable_cpool '0' - option time '40' - option tcp_mux '1' - option enabled '0' - option vhost_http_port '80' - option vhost_https_port '443' - option server_addr 'yourdomain.com' - option server_port '7000' - option token '1234567' - option log_level 'info' - option enable_http_proxy '0' - option protocol 'tcp' - option user '' diff --git a/luci-app-frpc/root/etc/init.d/frp b/luci-app-frpc/root/etc/init.d/frp deleted file mode 100755 index 57887785..00000000 --- a/luci-app-frpc/root/etc/init.d/frp +++ /dev/null @@ -1,268 +0,0 @@ -#!/bin/sh /etc/rc.common -#Author: monokoo -#Thanks to FW867's help - -START=99 -SERVICE_WRITE_PID=1 -SERVICE_DAEMONIZE=1 - -LOGFILE="/var/etc/frp/frpc.log" - -echo_date(){ - local log=$1 - echo $(date +%Y/%m/%d\ %X): "$log" >> $LOGFILE -} - -Reduce_Log(){ - local log=$1 - [ ! -f "$log" ] && return - local sc=200 - [ -n "$2" ] && sc=$2 - local count=$(grep -c "" $log) - if [ $count -gt $sc ];then - let count=count-$sc - sed -i "1,$count d" $log - fi -} - -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 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 xtcp_role xtcp_secretkey xtcp_servername - local enable_https_plugin https_plugin plugin_local_addr plugin_crt_path plugin_key_path plugin_host_header_rewrite plugin_header_X_From_Where - - config_get_bool enable "$cfg" enable 1 - [ "$enable" -gt 0 ] || return 1 - - config_get type "$cfg" type - config_get custom_domains "$cfg" custom_domains - config_get subdomain "$cfg" subdomain - config_get remote_port "$cfg" remote_port - config_get local_ip "$cfg" local_ip - config_get local_port "$cfg" local_port - config_get locations "$cfg" locations - config_get host_header_rewrite "$cfg" host_header_rewrite - config_get http_user "$cfg" http_user - config_get http_pwd "$cfg" http_pwd - config_get remark "$cfg" remark - config_get plugin "$cfg" plugin - config_get plugin_http_user "$cfg" plugin_http_user - config_get plugin_http_passwd "$cfg" plugin_http_passwd - config_get plugin_unix_path "$cfg" plugin_unix_path - config_get stcp_role "$cfg" stcp_role - config_get stcp_secretkey "$cfg" stcp_secretkey - config_get stcp_servername "$cfg" stcp_servername - config_get xtcp_role "$cfg" xtcp_role - config_get xtcp_secretkey "$cfg" xtcp_secretkey - config_get xtcp_servername "$cfg" xtcp_servername - config_get proxy_protocol_version "$cfg" proxy_protocol_version - config_get https_plugin "$cfg" https_plugin - config_get plugin_local_addr "$cfg" plugin_local_addr - config_get plugin_crt_path "$cfg" plugin_crt_path - config_get plugin_key_path "$cfg" plugin_key_path - config_get plugin_host_header_rewrite "$cfg" plugin_host_header_rewrite - config_get plugin_header_X_From_Where "$cfg" plugin_header_X_From_Where - - - [ -n "$remark" ] && [ -n "$type" ] || return 1 - - echo "" >>$tmpconf - echo "[$remark]" >>$tmpconf - echo "type=$type" >>$tmpconf - [ -n "$custom_domains" ] && echo "custom_domains=$custom_domains" >>$tmpconf - [ -n "$subdomain" ] && echo "subdomain=$subdomain" >>$tmpconf - [ -n "$remote_port" ] && echo "remote_port=$remote_port" >>$tmpconf - [ -z "$stcp_role" ] && [ -z "$xtcp_role" ] && [ -n "$local_ip" ] && echo "local_ip=$local_ip" >>$tmpconf - [ -z "$stcp_role" ] && [ -z "$xtcp_role" ] && [ -n "$local_port" ] && echo "local_port=$local_port" >>$tmpconf - [ -n "$locations" ] && echo "locations=$locations" >>$tmpconf - [ -n "$http_user" -a -n "$http_pwd" ] && { - echo "http_user=$http_user" >>$tmpconf - echo "http_pwd=$http_pwd" >>$tmpconf - } - [ -n "$host_header_rewrite" ] && echo "host_header_rewrite=$host_header_rewrite" >>$tmpconf - [ -n "$plugin" ] && echo "plugin=$plugin" >>$tmpconf - [ -n "$plugin_http_user" -a -n "$plugin_http_passwd" ] && { - echo "plugin_http_user=$plugin_http_user" >>$tmpconf - echo "plugin_http_passwd=$plugin_http_passwd" >>$tmpconf - } - [ -n "$plugin_unix_path" ] && echo "plugin_unix_path=$plugin_unix_path" >>$tmpconf - - [ -n "$stcp_role" ] && { - if [ "$stcp_role" == "visitor" ]; then - echo "role=$stcp_role" >>$tmpconf - [ -n "$local_ip" ] && echo "bind_addr=$local_ip" >>$tmpconf - [ -n "$local_port" ] && echo "bind_port=$local_port" >>$tmpconf - [ -n "$stcp_servername" ] && echo "server_name=$stcp_servername" >>$tmpconf || return 1 - else - [ -n "$local_ip" ] && echo "local_ip=$local_ip" >>$tmpconf - [ -n "$local_port" ] && echo "local_port=$local_port" >>$tmpconf - fi - [ -n "$stcp_secretkey" ] && echo "sk=$stcp_secretkey" >>$tmpconf || return 1 - } - - [ -n "$xtcp_role" ] && { - if [ "$xtcp_role" == "visitor" ]; then - echo "role=$xtcp_role" >>$tmpconf - [ -n "$local_ip" ] && echo "bind_addr=$local_ip" >>$tmpconf - [ -n "$local_port" ] && echo "bind_port=$local_port" >>$tmpconf - [ -n "$xtcp_servername" ] && echo "server_name=$xtcp_servername" >>$tmpconf || return 1 - else - [ -n "$local_ip" ] && echo "local_ip=$local_ip" >>$tmpconf - [ -n "$local_port" ] && echo "local_port=$local_port" >>$tmpconf - fi - [ -n "$xtcp_secretkey" ] && echo "sk=$xtcp_secretkey" >>$tmpconf || return 1 - } - - [ -n "$proxy_protocol_version" ] && { - if [ "$proxy_protocol_version" != "disable" ]; then - echo "proxy_protocol_version=$proxy_protocol_version" >>$tmpconf - fi - } - - [ -n "$https_plugin" ] && echo "plugin=$https_plugin" >>$tmpconf - [ -n "$plugin_local_addr" ] && echo "plugin_local_addr=$plugin_local_addr" >>$tmpconf - [ -n "$plugin_crt_path" -a -n "$plugin_key_path" ] && { - echo "plugin_crt_path=$plugin_crt_path" >>$tmpconf - echo "plugin_key_path=$plugin_key_path" >>$tmpconf - } - [ -n "$plugin_host_header_rewrite" ] && echo "plugin_host_header_rewrite=$plugin_host_header_rewrite" >>$tmpconf - [ -n "$plugin_header_X_From_Where" ] && echo "plugin_header_X_From_Where=$plugin_header_X_From_Where" >>$tmpconf - - frp_write_bool use_encryption $cfg 1 - frp_write_bool use_compression $cfg 1 - -} - -frp_write_bool() { - local opt="$1" - local config="$2" - local def="$3" - local val - - config_get_bool val $config "$opt" "$def" - if [ "$val" -eq 0 ]; then - echo "${opt}=false" >> $tmpconf - else - echo "${opt}=true" >> $tmpconf - fi -} - -frp_add_cru(){ -time=$1 -if [ ! -f "/etc/crontabs/root" ] || [ -z "$(cat /etc/crontabs/root | grep frp)" ]; then - sed -i '/frp/d' /etc/crontabs/root >/dev/null 2>&1 - echo "*/$time * * * * /etc/init.d/frp restart" >> /etc/crontabs/root -fi - -} - -frp_del_cru(){ -if [ ! -f "/etc/crontabs/root" ] || [ -n "$(cat /etc/crontabs/root | grep frp)" ]; then - sed -i '/frp/d' /etc/crontabs/root >/dev/null 2>&1 -fi -} - -download_binary(){ - echo_date "开始下载frpc二进制文件..." - /usr/bin/wget --no-check-certificate --timeout=10 --tries=1 -o $LOGFILE https://github.com/fatedier/frp/releases/download/v0.13.0/frp_0.13.0_linux_arm.tar.gz -O /tmp/frp_0.13.0_linux_arm.tar.gz - [ ! -s "/tmp/frp_0.13.0_linux_arm.tar.gz" ] && /usr/bin/wget -q --no-check-certificate --timeout=10 --tries=1 https://any.mokoo.xyz/app/frp_0.13.0_linux_arm.tar.gz -O /tmp/frp_0.13.0_linux_arm.tar.gz - [ -f "/tmp/frp_0.13.0_linux_arm.tar.gz" ] && tar -xf /tmp/frp_0.13.0_linux_arm.tar.gz -C /tmp && \ - mv /tmp/frp_0.13.0_linux_arm/frpc /usr/bin/frpc - rm -rf /tmp/frp_0.13.0_linux_arm* - if [ -f "/usr/bin/frpc" ]; then - chmod +x /usr/bin/frpc && echo_date "成功下载frpc二进制文件" - else - echo_date "下载frpc二进制文件失败,请重试!" - fi -} - -boot() { - sleep 10s - start -} - -start() { - - config_load "frp" - 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 admin_port admin_user admin_pwd - local tls_cert_file tls_key_file tls_trusted_ca_file - - config_get_bool enabled common enabled 1 - - [ "$enabled" -gt 0 ] || return 1 - - config_get server_addr common server_addr - config_get server_port common server_port - config_get token common token - config_get user common user - config_get enable_cpool common enable_cpool - config_get pool_count common pool_count - config_get log_level common log_level - config_get log_max_days common log_max_days - config_get http_proxy common http_proxy - config_get protocol common protocol - 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 - config_get tls_cert_file common tls_cert_file - config_get tls_key_file common tls_key_file - config_get tls_trusted_ca_file common tls_trusted_ca_file - - - mkdir -p /var/etc/frp - [ ! -f "$LOGFILE" ] && touch $LOGFILE - - [ ! -f "/usr/bin/frpc" ] && download_binary - [ ! -f "/usr/bin/frpc" ] && logger -t Frp 'Download frpc failed, please retry.' && exit 0 - - local tmpconf="/var/etc/frp/frpc.conf" - - echo "[common]" >$tmpconf - echo "server_addr=${server_addr}" >>$tmpconf - echo "server_port=${server_port}" >>$tmpconf - echo "token=${token}" >>$tmpconf - [ -n "$user" ] && echo "user=$user" >>$tmpconf - echo "log_level=${log_level}" >>$tmpconf - echo "log_max_days=${log_max_days}" >>$tmpconf - echo "protocol=${protocol}" >>$tmpconf - echo "log_file=$LOGFILE" >>$tmpconf - [ -n "$http_proxy" ] && echo "http_proxy=$http_proxy" >>$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 - [[ -n "$tls_cert_file" && -n "$tls_key_file" ]] && echo "tls_cert_file=$tls_cert_file" >>$tmpconf && echo "tls_key_file=$tls_key_file" >>$tmpconf - [ -n "$tls_trusted_ca_file" ] && echo "tls_trusted_ca_file=$tls_trusted_ca_file" >>$tmpconf - - - config_load "frp" - frp_write_bool tcp_mux common 1 - frp_write_bool tls_enable common 0 - frp_write_bool login_fail_exit common 1 - config_foreach conf_proxy_add proxy "$tmpconf" - - [ "$(cat "$tmpconf" | grep -c "type=")" -gt 0 ] || (echo_date "frp服务启动失败,请首先添加服务列表!" && exit 0) - logger -t FRPC 'Starting frp service' - SERVICE_DAEMONIZE=1 \ - service_start /usr/bin/frpc -c $tmpconf - - [ "$time" -gt 0 ] && frp_add_cru $time - [ -z "$(pgrep /usr/bin/frpc)" ] && echo_date "frp服务启动失败,请检查服务端 “TCP多路复用(tcp_mux)”设置,确保与客户端完全一致!" - - return 0 -} - -stop() { - frp_del_cru - if [ -n "`pidof frpc`" ]; then - logger -t FRPC 'Shutting down frp service' - service_stop /usr/bin/frpc - Reduce_Log $LOGFILE - fi - return 0 -} diff --git a/luci-app-frpc/root/etc/uci-defaults/luci-frp b/luci-app-frpc/root/etc/uci-defaults/luci-frp deleted file mode 100644 index 03d80411..00000000 --- a/luci-app-frpc/root/etc/uci-defaults/luci-frp +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -[ ! -f "/usr/share/ucitrack/luci-app-frp.json" ] && { - cat > /usr/share/ucitrack/luci-app-frp.json << EEOF -{ - "config": "frp", - "init": "frp" -} -EEOF -} - -uci -q batch <<-EOF >/dev/null - delete ucitrack.@frp[-1] - add ucitrack frp - set ucitrack.@frp[-1].init=frp - commit ucitrack -EOF - -rm -f /tmp/luci-indexcache -exit 0 diff --git a/luci-app-frpc/root/usr/share/rpcd/acl.d/luci-app-frpc.json b/luci-app-frpc/root/usr/share/rpcd/acl.d/luci-app-frpc.json deleted file mode 100644 index 8ff0cfdf..00000000 --- a/luci-app-frpc/root/usr/share/rpcd/acl.d/luci-app-frpc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "luci-app-frpc": { - "description": "Grant UCI access for luci-app-frpc", - "read": { - "uci": [ "frp" ] - }, - "write": { - "uci": [ "frp" ] - } - } -} diff --git a/luci-app-frpc/root/usr/share/ucitrack/luci-app-frpc.json b/luci-app-frpc/root/usr/share/ucitrack/luci-app-frpc.json deleted file mode 100644 index 77993a0e..00000000 --- a/luci-app-frpc/root/usr/share/ucitrack/luci-app-frpc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "config": "frp", - "init": "frp" -} diff --git a/luci-app-frps/Makefile b/luci-app-frps/Makefile deleted file mode 100644 index 99ff9973..00000000 --- a/luci-app-frps/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright 2020 lwz322 -# Licensed to the public under the MIT License. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=luci-app-frps -PKG_VERSION:=0.0.2 -PKG_RELEASE:=1 - -PKG_LICENSE:=MIT -PKG_LICENSE_FILES:=LICENSE - -PKG_MAINTAINER:=lwz322 - -LUCI_TITLE:=LuCI support for Frps -LUCI_DEPENDS:=+wget +frps -LUCI_PKGARCH:=all - -define Package/$(PKG_NAME)/conffiles -/etc/config/frps -endef - -include $(TOPDIR)/feeds/luci/luci.mk - -# call BuildPackage - OpenWrt buildroot signature diff --git a/luci-app-frps/luasrc/controller/frps.lua b/luci-app-frps/luasrc/controller/frps.lua deleted file mode 100644 index 062d34dc..00000000 --- a/luci-app-frps/luasrc/controller/frps.lua +++ /dev/null @@ -1,24 +0,0 @@ --- Copyright 2020 lwz322 --- Licensed to the public under the MIT License. - -module("luci.controller.frps", package.seeall) - -function index() - if not nixio.fs.access("/etc/config/frps") then - return - end - - entry({"admin", "services", "frps"}, alias("admin", "services", "frps", "common"), _("Frps"), 99).dependent = 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", "status"}, call("action_status")).leaf = true -end - - -function action_status() - local e = {} - e.running = luci.sys.call("pidof frps >/dev/null") == 0 - e.bin_version = luci.sys.exec("frps -v") - luci.http.prepare_content("application/json") - luci.http.write_json(e) -end diff --git a/luci-app-frps/luasrc/model/cbi/frps/common.lua b/luci-app-frps/luasrc/model/cbi/frps/common.lua deleted file mode 100644 index f0f8fd3c..00000000 --- a/luci-app-frps/luasrc/model/cbi/frps/common.lua +++ /dev/null @@ -1,93 +0,0 @@ --- Copyright 2020 lwz322 --- Licensed to the public under the MIT License. - -local m, s, o - -m = Map("frps") -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.
Project GitHub URL") - -m:section(SimpleSection).template = "frps/frps_status" - -s = m:section(NamedSection, "main", "frps") -s.addremove = false -s.anonymous = true - -s:tab("general", translate("General Options")) -s:tab("advanced", translate("Advanced Options")) -s:tab("dashboard", translate("Dashboard Options")) - -o = s:taboption("general", Flag, "enabled", translate("Enabled")) - -o = s:taboption("general", Value, "client_file", translate("Client file")) -o.default = "/usr/bin/frps" -o.rmempty = false - -o = s:taboption("general", ListValue, "run_user", translate("Run daemon as user")) -o:value("", translate("root")) -local user -for user in luci.util.execi("cat /etc/passwd | cut -d':' -f1") do - o:value(user) -end - -o = s:taboption("general", Flag, "enable_logging", translate("Enable logging")) - -o = s:taboption("general", Value, "log_file", translate("Log file")) -o:depends("enable_logging", "1") -o.default = "/var/log/frps.log" - -o = s:taboption("general", ListValue, "log_level", translate("Log level")) -o:depends("enable_logging", "1") -o:value("trace", translate("Trace")) -o:value("debug", translate("Debug")) -o:value("info", translate("Info")) -o:value("warn", translate("Warning")) -o:value("error", translate("Error")) -o.default = "Warn" - -o = s:taboption("general", ListValue, "log_max_days", translate("Log max days")) -o.description = translate("Maximum number of days to keep log files is 3 day.") -o:depends("enable_logging", "1") -o.datatype = "uinteger" -o:value("1", translate("1")) -o:value("2", translate("2")) -o:value("3", translate("3")) -o.default = "3" -o.optional = false - -o = s:taboption("general", Flag, "disable_log_color", translate("Disable log color")) -o:depends("enable_logging", "1") -o.enabled = "true" -o.disabled = "false" - -o = s:taboption("advanced", Value, "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.datatype = "uinteger" - -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.datatype = "uinteger" -o.defalut = '0' -o.placeholder = '0' - -o = s:taboption("advanced", Value, "subdomain_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.datatype = "host" - -o = s:taboption("dashboard", Value, "dashboard_addr", translate("Dashboard addr")) -o.description = translatef("dashboard addr's default value is same with bind_addr") -o.default = "0.0.0.0" -o.datatype = "host" - -o = s:taboption("dashboard", Value, "dashboard_port", translate("Dashboard port")) -o.description = translatef("dashboard is available only if dashboard_port is set") -o.default = "7500" -o.datatype = "port" - -o = s:taboption("dashboard", Value, "dashboard_user", translate("Dashboard user")) -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.password = true - -return m diff --git a/luci-app-frps/luasrc/model/cbi/frps/server.lua b/luci-app-frps/luasrc/model/cbi/frps/server.lua deleted file mode 100644 index 2201468f..00000000 --- a/luci-app-frps/luasrc/model/cbi/frps/server.lua +++ /dev/null @@ -1,54 +0,0 @@ --- Copyright 2020 lwz322 --- Licensed to the public under the MIT License. - -local m, s, o - -m = Map("frps") -m.title = translate("Frps - Server Settings") -m.description = translate("FRPS Server Settings") - -s = m:section(NamedSection, "main", "frps") -s.anonymous = true -s.addremove = false - -o = s:option(Value, "bind_port", translate("Bind port")) -o.datatype = "port" -o.rmempty = false - -o = s:option(Value, "token", translate("Token")) -o.password = true - -o = s:option(Flag, "tcp_mux", translate("TCP mux")) -o.enabled = "true" -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.enabled = "true" -o.disabled = "false" -o.default = o.disabled -o.rmempty = false - -o = s:option(Value, "bind_udp_port", translate("UDP bind port")) -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.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 = 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.datatype = "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.datatype = "port" - -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. detailed_errors_to_client=false.(NO SPACE!)") -o.placeholder = "option=value" - -return m \ No newline at end of file diff --git a/luci-app-frps/luasrc/view/frps/frps_status.htm b/luci-app-frps/luasrc/view/frps/frps_status.htm deleted file mode 100644 index 47aecceb..00000000 --- a/luci-app-frps/luasrc/view/frps/frps_status.htm +++ /dev/null @@ -1,26 +0,0 @@ - - -
-

- <%:Collecting data...%> -

-
diff --git a/luci-app-frps/po/zh-cn/frps.po b/luci-app-frps/po/zh-cn/frps.po deleted file mode 100644 index 0b68185b..00000000 --- a/luci-app-frps/po/zh-cn/frps.po +++ /dev/null @@ -1,250 +0,0 @@ -msgid "" -msgstr "Content-Type: text/plain; charset=UTF-8" - -#: luasrc/model/cbi/frps/common.lua:54 -# msgid "-- default --" -# msgstr "-- 默认 --" - -#: luasrc/model/cbi/frps/common.lua:44 -msgid "Advanced Options" -msgstr "高级选项" - -#: luasrc/model/cbi/frps/server.lua:14 -msgid "Bind port" -msgstr "绑定端口" - -#: luasrc/model/cbi/frps/common.lua:22 -msgid "Client file" -msgstr "客户端文件" - -#: luasrc/model/cbi/frps/common.lua:7 -msgid "Frps - Common Settings" -msgstr "Frps - 通用设置" - -#: luasrc/model/cbi/frps/common.lua:18 -msgid "Dashboard Options" -msgstr "面板选项" - -#: luasrc/model/cbi/frps/common.lua:78 -msgid "Dashboard addr" -msgstr "面板绑定地址" - -#: luasrc/model/cbi/frps/common.lua:91 -msgid "Dashboard password" -msgstr "面板登录密码" - -#: luasrc/model/cbi/frps/common.lua:83 -msgid "Dashboard port" -msgstr "面板绑定端口" - -#: luasrc/model/cbi/frps/common.lua:88 -msgid "Dashboard user" -msgstr "面板登录用户名" - -#: luasrc/model/cbi/frps/common.lua:69 -# msgid "Debug" -# msgstr "调试" - -#: luasrc/model/cbi/frps/common.lua:80 -msgid "Disable log color" -msgstr "禁用日志颜色" - -#: luasrc/model/cbi/frps/common.lua:60 -msgid "Enable logging" -msgstr "启用日志" - -#: luasrc/model/cbi/frps/common.lua:47 -msgid "Enabled" -msgstr "已启用" - -#: luasrc/model/cbi/frps/common.lua:72 -msgid "Error" -msgstr "错误" - -#: luasrc/model/cbi/frps/server.lua:8 -msgid "Frps - Server Settings" -msgstr "Frps - 服务器设定" - -#: luasrc/model/cbi/frps/server.lua:8 -msgid "FRPS Server Settings" -msgstr "Frps 服务器设定" - -#: luasrc/model/cbi/frps/common.lua:32 -msgid "Frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
Project GitHub URL" -msgstr "Frp 是一个可用于内网穿透的高性能的反向代理应用。
Github 项目地址" - -#: luasrc/model/cbi/frps/common.lua:43 -msgid "General Options" -msgstr "常规选项" - -#: luasrc/model/cbi/frps/common.lua:70 -msgid "Info" -msgstr "信息" - -#: luasrc/model/cbi/frps/server.lua:31 -msgid "KCP bind port" -msgstr "KCP绑定端口" - -#: luasrc/model/cbi/frps/common.lua:62 -msgid "Log file" -msgstr "日志文件" - -#: luasrc/model/cbi/frps/common.lua:66 -msgid "Log level" -msgstr "日志等级" - -#: luasrc/model/cbi/frps/common.lua:48 -msgid "Log max days" -msgstr "日志保存天数" - -#: luasrc/model/cbi/frps/common.lua:49 -msgid "Maximum number of days to keep log files is 3 day." -msgstr "保留日志文件的最大天数为 3 天。" - -#: luasrc/model/cbi/frps/common.lua:85 -msgid "Max pool count" -msgstr "最大连接数" - -#: luasrc/model/cbi/frps/common.lua:89 -msgid "Max ports per-client" -msgstr "单客户端最大端口映射数" - -#: luasrc/view/frps/status_header.htm:26 -msgid "Not Running" -msgstr "服务未运行" - -#: luasrc/model/cbi/frps/server.lua:40 -msgid "Optional: Note: http port and https port can be same with bind_port" -msgstr "(可选)提示:http/https端口可以和绑定端口设定为一致" - -#: luasrc/model/cbi/frps/server.lua:36 -msgid "" -"Optional: if you want to support virtual host, you must set the http port " -"for listening" -msgstr "(可选)如果您希望支持虚拟主机,则必须设定http端口" - -#: luasrc/model/cbi/frps/server.lua:28 -msgid "Optional: udp port to help make udp hole to penetrate nat" -msgstr "(可选)设定UDP端口以帮助UDP协议穿透NAT" - -#: luasrc/model/cbi/frps/server.lua:32 -msgid "" -"Optional: udp port used for kcp protocol, it can be same with 'bind port'; " -"if not set, kcp is disabled in frps" -msgstr "(可选)UDP端口用于KCP协议,可与绑定端口设定为一致;留空以禁用KCP" - -#: luasrc/model/cbi/frps/common.lua:53 -msgid "Run daemon as user" -msgstr "以用户身份运行" - -#: luasrc/controller/frps.lua:22 -msgid "Server" -msgstr "服务端" - -#: luasrc/controller/frps.lua:19 -msgid "Settings" -msgstr "设置" - -#: luasrc/model/cbi/frps/common.lua:95 -msgid "Subdomain host" -msgstr "子域名" - -#: luasrc/model/cbi/frps/server.lua:21 -msgid "TCP mux" -msgstr "TCP 复用" - -#: luasrc/model/cbi/frps/server.lua:27 -msgid "Enforce frps only accept TLS connection" -msgstr "强制frps只接受TLS连接" - -#: luasrc/model/cbi/frps/server.lua:28 -msgid "Requirements: frpc v0.25.0+, frps v0.32.0+" -msgstr "要求:frpc版本0.25.0+, frps版本0.32.0+" - -#: luasrc/model/cbi/frps/server.lua:18 -msgid "Token" -msgstr "令牌" - -#: luasrc/model/cbi/frps/common.lua:68 -msgid "Trace" -msgstr "追踪" - -#: luasrc/model/cbi/frps/server.lua:27 -msgid "UDP bind port" -msgstr "UDP绑定端口" - -#: luasrc/model/cbi/frps/common.lua:71 -msgid "Log level" -msgstr "日志等级" - -#: luasrc/model/cbi/frps/common.lua:41 -msgid "Trace" -msgstr "追踪" - -#: luasrc/model/cbi/frps/common.lua:42 -msgid "Debug" -msgstr "调试" - -#: luasrc/model/cbi/frps/common.lua:43 -msgid "Info" -msgstr "信息" - -#: luasrc/model/cbi/frps/common.lua:44 -msgid "Warning" -msgstr "警告" - -#: luasrc/model/cbi/frps/common.lua:45 -msgid "Error" -msgstr "错误" - -#: luasrc/model/cbi/frps/common.lua:99 -msgid "dashboard addr's default value is same with bind_addr" -msgstr "面板地址默认和绑定地址一致" - -#: luasrc/model/cbi/frps/common.lua:102 -msgid "dashboard is available only if dashboard_port is set" -msgstr "仅在设定面板绑定端口后才可使用面板功能" - -#: luasrc/model/cbi/frps/common.lua:105 -msgid "" -"dashboard user and passwd for basic auth protect, if not set, both default " -"value is admin" -msgstr "面板用户名/密码用于基本安全认证;若留空,则用户名/密码均为admin" - -#: luasrc/model/cbi/frps/common.lua:96 -msgid "" -"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" -msgstr "如果subdomain_host不为空,可以在frpc配置文件中设置类型为http(s)的subdomain;subdomain为test,路由将使用test.frps.com" - -#: luasrc/model/cbi/frps/common.lua:90 -msgid "" -"max ports can be used for each client, default value is 0 means no limit" -msgstr "每个客户端最多可映射端口数,留空则默认为0(不限制)" - -#: luasrc/model/cbi/frps/common.lua:86 -msgid "" -"pool_count in each proxy will change to max_pool_count if they exceed the " -"maximum value" -msgstr "代理连接数(pool_count)超过最大值时将变更为最大连接数(max_pool_count)" - -#: luasrc/model/cbi/frps/server.lua:35 -msgid "vhost http port" -msgstr "虚拟主机http绑定端口" - -#: luasrc/model/cbi/frps/server.lua:39 -msgid "vhost https port" -msgstr "虚拟主机https绑定端口" - -#: luasrc/model/cbi/frps/server.lua:50 -msgid "Extra Settings" -msgstr "额外设置" - -#: luasrc/model/cbi/frps/server.lua:51 -msgid "List of extra settings will be added to config file. Format: option=value, eg. detailed_errors_to_client=false.(NO SPACE!)" -msgstr "额外设置列表将会被添加到config文件中。 格式:option=value,如:detailed_errors_to_client=false.(不含空格!)" - -#: luasrc/view/frps/frps_status.htm:7 -msgid "Open Frps page" -msgstr "打开 Frps 管理面板" diff --git a/luci-app-frps/po/zh_Hans b/luci-app-frps/po/zh_Hans deleted file mode 120000 index 41451e4a..00000000 --- a/luci-app-frps/po/zh_Hans +++ /dev/null @@ -1 +0,0 @@ -zh-cn \ No newline at end of file diff --git a/luci-app-frps/root/etc/config/frps b/luci-app-frps/root/etc/config/frps deleted file mode 100644 index bfdbac22..00000000 --- a/luci-app-frps/root/etc/config/frps +++ /dev/null @@ -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' diff --git a/luci-app-frps/root/etc/init.d/frps b/luci-app-frps/root/etc/init.d/frps deleted file mode 100755 index f9876d26..00000000 --- a/luci-app-frps/root/etc/init.d/frps +++ /dev/null @@ -1,197 +0,0 @@ -#!/bin/sh /etc/rc.common -# -# Copyright 2020 lwz322 -# Licensed to the public under the MIT License. -# - -START=99 -USE_PROCD=1 - -NAME="frps" -CONFIG_FOLDER="/var/etc/$NAME" - -_log() { - local level="$1" ; shift - local msg="$@" - logger -p "daemon.$level" -t "$NAME" "$msg" - - echo "[$level] $msg" >&2 -} - -_info() { - _log "info" $@ -} - -_err() { - _log "err" $@ -} - -append_options() { - local file="$1" ; shift - local o v - for o in "$@" ; do - v="$(eval echo "\$$o")" - if [ -n "$v" ] ; then - # add brackets when ipv6 address - if ( echo "$o" | grep -qE 'addr|ip' ) && - ( echo "$v" | grep -q ':' ) ; then - v="[$v]" - fi - - echo "${o} = $v" >>"$file" - fi - done -} - -append_setting() { - local file="$1" ; shift - local s="$1" - if [ -n "$s" ] ; then - echo "$s" >>"$file" - fi -} - -frps_scetion_validate() { - uci_validate_section "$NAME" "frps" "$1" \ - 'enabled:bool:0' \ - 'client_file:file:/usr/bin/frps' \ - 'run_user:string' \ - 'enable_logging:bool:0' \ - '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' \ - 'token:string' \ - 'tcp_mux:or("true", "false"):true' \ - 'tls_only:or("true", "false"):false' \ - 'bind_udp_port:port' \ - 'kcp_bind_port:port' \ - 'vhost_http_port:port' \ - 'vhost_https_port:port' -} - -client_file_validate() { - local file="$1" - - test -f "$file" || return 1 - test -x "$file" || chmod 755 "$file" - - eval "$file" -h | grep -q "$NAME" - return $? -} - -add_rule_extra_option() { - append_setting "$2" "$1" -} - -create_config_file() { - local config_file="$1" - local tmp_file="$(mktemp /tmp/frps-XXXXXX)" - - echo "[common]" > "$tmp_file" - - append_options "$tmp_file" \ - "bind_port" "token" "tcp_mux" "tls_only" "bind_udp_port" "kcp_bind_port" "vhost_http_port" "vhost_https_port" - - - if [ "x$enable_logging" = "x1" ] ; then - if [ -z "$log_file" ]; then - log_file="/var/log/frps.log" - fi - - append_options "$tmp_file" \ - "log_file" "log_level" "log_max_days" "disable_log_color" - - if [ -f "$log_file" ] ; then - echo > "$log_file" - else - local log_folder="$(dirname "$log_file")" - - if [ ! -d "$log_folder" ] ; then - mkdir -p "$log_folder" - fi - fi - - if [ -n "$run_user" ] && ( user_exists "$run_user" ) ; then - chmod 644 "$log_file" - chown "$run_user" "$log_file" - else - run_user="" - fi - fi - - append_options "$tmp_file" \ - "max_pool_count" "max_ports_per_client" "subdomain_host" "dashboard_addr" "dashboard_port" "dashboard_user" "dashboard_pwd" - - extra_setting=$(uci get frps.main.extra_setting 2>/dev/null) - if [ -n "$extra_setting" ] ; then - for o in $extra_setting ;do - echo "$o" >> "$tmp_file" - done - fi - - sed '/^$/d' "$tmp_file" >"$config_file" - - if [ "$?" = "0" ] ; then - rm -f "$tmp_file" - fi -} - -start_instance() { - local section="$1" - - if ! frps_scetion_validate "$section" ; then - _err "Config validate failed." - return 1 - fi - - if [ "x$enabled" != "x1" ] ; then - _info "Instance \"$section\" disabled." - return 1 - fi - - if [ -z "$client_file" ] || ( ! client_file_validate "$client_file" ) ; then - _err "Client file not valid." - return 1 - fi - - test -d "$CONFIG_FOLDER" || mkdir -p "$CONFIG_FOLDER" - - local config_file="$CONFIG_FOLDER/frps.$section.ini" - - create_config_file "$config_file" - - if [ ! -f "$config_file" ] ; then - _err "Could not create config file: \"$config_file\"" - return 1 - fi - - procd_open_instance "$NAME.$section" - procd_set_param command "$client_file" - procd_append_param command -c "$config_file" - procd_set_param respawn - procd_set_param file "$config_file" - - if [ -n "$run_user" ] ; then - procd_set_param user "$run_user" - fi - - procd_close_instance -} - -service_triggers() { - procd_add_reload_trigger "$NAME" -} - -start_service() { - config_load "$NAME" - config_foreach start_instance "frps" -} diff --git a/luci-app-frps/root/etc/uci-defaults/40_luci-frps b/luci-app-frps/root/etc/uci-defaults/40_luci-frps deleted file mode 100644 index ba00ee63..00000000 --- a/luci-app-frps/root/etc/uci-defaults/40_luci-frps +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -[ ! -f "/usr/share/ucitrack/luci-app-frps.json" ] && { - cat > /usr/share/ucitrack/luci-app-frps.json << EEOF -{ - "config": "frps", - "init": "frps" -} -EEOF -} - -uci -q batch <<-EOF >/dev/null - delete ucitrack.@frps[-1] - add ucitrack frps - set ucitrack.@frps[-1].init=frps - commit ucitrack -EOF - -rm -rf /tmp/luci-indexcache /tmp/luci-modulecache -exit 0 diff --git a/luci-app-frps/root/usr/share/rpcd/acl.d/luci-app-frps.json b/luci-app-frps/root/usr/share/rpcd/acl.d/luci-app-frps.json deleted file mode 100644 index ceed4265..00000000 --- a/luci-app-frps/root/usr/share/rpcd/acl.d/luci-app-frps.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "luci-app-frps": { - "description": "Grant UCI access for luci-app-frps", - "read": { - "uci": [ "frps" ] - }, - "write": { - "uci": [ "frps" ] - } - } -} diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile index 9436f89e..4c5bf04e 100644 --- a/luci-app-passwall/Makefile +++ b/luci-app-passwall/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall PKG_VERSION:=26.4.15 -PKG_RELEASE:=90 +PKG_RELEASE:=91 PKG_PO_VERSION:=$(PKG_VERSION) PKG_CONFIG_DEPENDS:= \ diff --git a/luci-app-passwall/luasrc/controller/passwall.lua b/luci-app-passwall/luasrc/controller/passwall.lua index 8f0f6609..cf591b17 100644 --- a/luci-app-passwall/luasrc/controller/passwall.lua +++ b/luci-app-passwall/luasrc/controller/passwall.lua @@ -775,7 +775,11 @@ function save_node_list_opt() end function update_rules() - local update = http.formvalue("update") + local update = http.formvalue("update") or "" + if update == "" then + http_write_json_error({ message = "missing update target" }) + return + end luci.sys.call("lua /usr/share/passwall/rule_update.lua log '" .. update .. "' > /dev/null 2>&1 &") http_write_json() end @@ -1111,9 +1115,9 @@ function fetch_certsha256() local address = (id ~= "") and uci:get(appname, id, "address") or "" local port = (id ~= "") and uci:get(appname, id, "port") or 0 if id == "" or address == "" or not api.datatypes.hostname(address) or port == 0 then - http_write_json({ code = 1 }) + http_write_json_error() return end local data = api.fetch_cert_sha256(address, port, 5) - http_write_json(data ~= "" and { code = 0, data = data } or { code = 1 }) + http_write_json(data ~= "" and { code = 1, data = data } or { code = 0 }) end diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/shunt_rules.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/shunt_rules.lua index 753a7b87..85596c9b 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/shunt_rules.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/shunt_rules.lua @@ -60,6 +60,7 @@ end protocol = s:option(MultiValue, "protocol", translate("Protocol")) protocol:value("http") protocol:value("tls") +protocol:value("quic") protocol:value("bittorrent") protocol.widget = "checkbox" protocol.default = nil diff --git a/luci-app-passwall/luasrc/passwall/api.lua b/luci-app-passwall/luasrc/passwall/api.lua index 65e83904..cff5ae02 100644 --- a/luci-app-passwall/luasrc/passwall/api.lua +++ b/luci-app-passwall/luasrc/passwall/api.lua @@ -100,21 +100,17 @@ function get_new_port() end function exec_call(cmd) - local process = io.popen(cmd .. '; echo -e "\n$?"') - local lines = {} - local result = "" - local return_code - for line in process:lines() do - lines[#lines + 1] = line + math.randomseed(os.time()) + local tag = "\x01__RC__" .. tostring(math.random(100000, 999999)) .. "\x01" + local f = io.popen('(' .. cmd .. '); printf "\\n' .. tag .. '%d" "$?"') + local out = f:read("*a") or "" + f:close() + local rc = out:match(tag .. "(%d+)%s*$") + if not rc then + return 255, trim(out) end - process:close() - if #lines > 0 then - return_code = lines[#lines] - for i = 1, #lines - 1 do - result = result .. lines[i] .. ((i == #lines - 1) and "" or "\n") - end - end - return tonumber(return_code), trim(result) + out = out:gsub("\n?" .. tag .. "%d+%s*$", "") + return tonumber(rc), trim(out) end function base64Decode(text) diff --git a/luci-app-passwall/luasrc/view/passwall/node_config/header.htm b/luci-app-passwall/luasrc/view/passwall/node_config/header.htm index 1291996d..31df86a1 100644 --- a/luci-app-passwall/luasrc/view/passwall/node_config/header.htm +++ b/luci-app-passwall/luasrc/view/passwall/node_config/header.htm @@ -66,7 +66,7 @@ local api = self.api alert("<%:Error%>"); return; } - if (!res || res.code !== 0 || !res.data) { + if (!res || res.code !== 1 || !res.data) { alert(res && res.msg ? res.msg : "<%:Fetch Failed%> !"); return; } diff --git a/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm b/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm index 8fec4561..8d849abc 100644 --- a/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm +++ b/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm @@ -278,10 +278,10 @@ table td, .table .td { ajaxList = []; } - function to_add_node(protocol) { + function to_add_node() { ajaxAbortAll(); const dom = document.getElementsByClassName("cbi-tab")[0]; - const current_group = dom.getAttribute("group_name") + const current_group = dom ? (dom.getAttribute("group_name") || "default") : "default"; window.location.href = '<%=api.url("add_node")%>?redirect=1&group=' + current_group; } diff --git a/luci-app-passwall/root/usr/share/passwall/haproxy_check.sh b/luci-app-passwall/root/usr/share/passwall/haproxy_check.sh index cea5d629..3f485f9d 100755 --- a/luci-app-passwall/root/usr/share/passwall/haproxy_check.sh +++ b/luci-app-passwall/root/usr/share/passwall/haproxy_check.sh @@ -8,7 +8,7 @@ listen_port=$2 server_address=$3 server_port=$4 -pgrep -af "${CONFIG}/" | awk '/app\.sh.*(start|stop)/ || /nftables\.sh/ || /iptables\.sh/ { found = 1 } END { exit !found }' && { +pgrep -af "${CONFIG}/" | grep -E 'app\.sh.*(start|stop)|nftables\.sh|iptables\.sh|subscribe\.lua' >/dev/null && { # 特定任务执行中不检测 exit 0 } diff --git a/luci-app-passwall/root/usr/share/passwall/socks_auto_switch.sh b/luci-app-passwall/root/usr/share/passwall/socks_auto_switch.sh index 6ab834a8..dac69da2 100755 --- a/luci-app-passwall/root/usr/share/passwall/socks_auto_switch.sh +++ b/luci-app-passwall/root/usr/share/passwall/socks_auto_switch.sh @@ -5,6 +5,12 @@ APP_FILE=${APP_PATH}/app.sh flag=0 +check_process() { + while pgrep -af "${CONFIG}/" | grep -E 'app\.sh.*(start|stop)|nftables\.sh|iptables\.sh|subscribe\.lua' >/dev/null; do + sleep 6s + done +} + test_url() { local url=$1 local try=1 @@ -48,6 +54,7 @@ test_node() { local node_id=$1 local _type=$(echo $(config_n_get ${node_id} type) | tr 'A-Z' 'a-z') [ -n "${_type}" ] && { + check_process local _tmp_port=$(get_new_port 48800 tcp,udp) NO_REC_PROCESS=1 $APP_FILE run_socks flag="test_node_${node_id}" node=${node_id} bind=127.0.0.1 socks_port=${_tmp_port} config_file=test_node_${node_id}.json sleep 2s @@ -92,6 +99,7 @@ test_auto_switch() { if [ "$restore_switch" = "1" ] && [ -n "$main_node" ] && [ "$now_node" != "$main_node" ]; then test_node ${main_node} [ $? -eq 0 ] && { + check_process #主节点正常,切换到主节点 echolog "Socks切换检测:端口[${socks_port}] 主节点【$(config_n_get $main_node type):[$(config_n_get $main_node remarks)]】正常,切换到主节点!" NO_REC_PROCESS=1 $APP_FILE socks_node_switch flag=${id} new_node=${main_node} @@ -131,6 +139,7 @@ test_auto_switch() { # [ -z "$(echo $b_nodes | grep $main_node)" ] && uci add_list $CONFIG.${id}.autoswitch_backup_node=$main_node # uci commit $CONFIG # } + check_process echolog "Socks切换检测:端口[${socks_port}]【$(config_n_get $new_node type):[$(config_n_get $new_node remarks)]】正常,切换到此节点!" NO_REC_PROCESS=1 $APP_FILE socks_node_switch flag=${id} new_node=${new_node} [ $? -eq 0 ] && { @@ -170,11 +179,7 @@ start() { sleep 6s continue } - pgrep -af "${CONFIG}/" | awk '/app\.sh.*(start|stop)/ || /nftables\.sh/ || /iptables\.sh/ { found = 1 } END { exit !found }' && { - # 特定任务执行中不检测 - sleep 6s - continue - } + check_process touch $LOCK_FILE test_auto_switch "$backup_node" rm -f $LOCK_FILE diff --git a/luci-app-passwall/root/usr/share/passwall/subscribe.lua b/luci-app-passwall/root/usr/share/passwall/subscribe.lua index 87fd60bc..919f1c93 100755 --- a/luci-app-passwall/root/usr/share/passwall/subscribe.lua +++ b/luci-app-passwall/root/usr/share/passwall/subscribe.lua @@ -503,35 +503,35 @@ end -- 处理数据 local function processData(szType, content, add_mode, group, sub_cfg) --log(2, content, add_mode, group) - local default_allowinsecure = DEFAULT_ALLOWINSECURE - local default_ss_type = DEFAULT_SS_TYPE - local default_trojan_type = DEFAULT_TROJAN_TYPE - local default_vmess_type = DEFAULT_VMESS_TYPE - local default_vless_type = DEFAULT_VLESS_TYPE - local default_hysteria2_type = DEFAULT_HYSTERIA2_TYPE + local sub_allowinsecure = DEFAULT_ALLOWINSECURE + local sub_ss_type = DEFAULT_SS_TYPE + local sub_trojan_type = DEFAULT_TROJAN_TYPE + local sub_vmess_type = DEFAULT_VMESS_TYPE + local sub_vless_type = DEFAULT_VLESS_TYPE + local sub_hysteria2_type = DEFAULT_HYSTERIA2_TYPE if sub_cfg then if sub_cfg.allowInsecure and sub_cfg.allowInsecure ~= "1" then - default_allowinsecure = nil + sub_allowinsecure = nil end local ss_type = sub_cfg.ss_type or "global" if ss_type ~= "global" and core_has[ss_type] then - default_ss_type = ss_type + sub_ss_type = ss_type end local trojan_type = sub_cfg.trojan_type or "global" if trojan_type ~= "global" and core_has[trojan_type] then - default_trojan_type = trojan_type + sub_trojan_type = trojan_type end local vmess_type = sub_cfg.vmess_type or "global" if vmess_type ~= "global" and core_has[vmess_type] then - default_vmess_type = vmess_type + sub_vmess_type = vmess_type end local vless_type = sub_cfg.vless_type or "global" if vless_type ~= "global" and core_has[vless_type] then - default_vless_type = vless_type + sub_vless_type = vless_type end local hysteria2_type = sub_cfg.hysteria2_type or "global" if hysteria2_type ~= "global" and core_has[hysteria2_type] then - default_hysteria2_type = hysteria2_type + sub_hysteria2_type = hysteria2_type end end local result = { @@ -573,9 +573,9 @@ local function processData(szType, content, add_mode, group, sub_cfg) result.remarks = base64Decode(params.remarks) elseif szType == 'vmess' then local info = jsonParse(content) - if default_vmess_type == "sing-box" and has_singbox then + if sub_vmess_type == "sing-box" and has_singbox then result.type = 'sing-box' - elseif default_vmess_type == "xray" and has_xray then + elseif sub_vmess_type == "xray" and has_xray then result.type = "Xray" else log("跳过 VMess 节点,因未适配到 VMess 核心程序,或未正确设置节点使用类型。") @@ -670,7 +670,7 @@ local function processData(szType, content, add_mode, group, sub_cfg) result.tls_CertSha = info.pcs result.tls_CertByName = info.vcn local insecure = info.allowinsecure or info.allowInsecure or info.insecure - result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0") + result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0") else result.tls = "0" end @@ -686,7 +686,7 @@ local function processData(szType, content, add_mode, group, sub_cfg) return nil end elseif szType == "ss" then - result = set_ss_implementation(default_ss_type, result) + result = set_ss_implementation(sub_ss_type, result) if not result then return nil end --SS-URI = "ss://" userinfo "@" hostname ":" port [ "/" ] [ "?" plugin ] [ "#" tag ] @@ -950,7 +950,7 @@ local function processData(szType, content, add_mode, group, sub_cfg) end end local insecure = params.allowinsecure or params.allowInsecure or params.insecure - result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0") + result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0") result.uot = params.udp elseif (params.type ~= "tcp" and params.type ~= "raw") and (params.headerType and params.headerType ~= "none") then result.error_msg = "请更换 Xray 或 Sing-Box 来支持 SS 更多的传输方式。" @@ -959,7 +959,7 @@ local function processData(szType, content, add_mode, group, sub_cfg) if params["shadow-tls"] then if result.type ~= "sing-box" and result.type ~= "SS-Rust" then - result.error_msg = default_ss_type .. " 不支持 shadow-tls 插件。" + result.error_msg = sub_ss_type .. " 不支持 shadow-tls 插件。" else -- 解析SS Shadow-TLS 插件参数 local function parseShadowTLSParams(b64str, out) @@ -1001,12 +1001,12 @@ local function processData(szType, content, add_mode, group, sub_cfg) end end elseif szType == "trojan" then - if default_trojan_type == "trojan-plus" and has_trojan_plus then + if sub_trojan_type == "trojan-plus" and has_trojan_plus then result.type = "Trojan-Plus" - elseif default_trojan_type == "sing-box" and has_singbox then + elseif sub_trojan_type == "sing-box" and has_singbox then result.type = 'sing-box' result.protocol = 'trojan' - elseif default_trojan_type == "xray" and has_xray then + elseif sub_trojan_type == "xray" and has_xray then result.type = 'Xray' result.protocol = 'trojan' else @@ -1055,7 +1055,7 @@ local function processData(szType, content, add_mode, group, sub_cfg) result.tls_CertSha = params.pcs result.tls_CertByName = params.vcn local insecure = params.allowinsecure or params.allowInsecure or params.insecure - result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0") + result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0") if not params.type then params.type = "tcp" end params.type = string.lower(params.type) @@ -1141,7 +1141,7 @@ local function processData(szType, content, add_mode, group, sub_cfg) end elseif szType == "ssd" then - result = set_ss_implementation(default_ss_type, result) + result = set_ss_implementation(sub_ss_type, result) if not result then return nil end result.address = content.server result.port = content.port @@ -1152,9 +1152,9 @@ local function processData(szType, content, add_mode, group, sub_cfg) result.group = content.airport result.remarks = content.remarks elseif szType == "vless" then - if default_vless_type == "sing-box" and has_singbox then + if sub_vless_type == "sing-box" and has_singbox then result.type = 'sing-box' - elseif default_vless_type == "xray" and has_xray then + elseif sub_vless_type == "xray" and has_xray then result.type = "Xray" else log("跳过 VLESS 节点,因未适配到 VLESS 核心程序,或未正确设置节点使用类型。") @@ -1307,7 +1307,7 @@ local function processData(szType, content, add_mode, group, sub_cfg) result.reality_mldsa65Verify = params.pqv or nil end local insecure = params.allowinsecure or params.allowInsecure or params.insecure - result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0") + result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0") end result.port = port @@ -1364,7 +1364,7 @@ local function processData(szType, content, add_mode, group, sub_cfg) result.hysteria_auth_password = params.auth result.tls_serverName = params.peer or params.sni or "" local insecure = params.allowinsecure or params.allowInsecure or params.insecure - result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0") + result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0") result.alpn = params.alpn result.hysteria_up_mbps = params.upmbps result.hysteria_down_mbps = params.downmbps @@ -1410,12 +1410,12 @@ local function processData(szType, content, add_mode, group, sub_cfg) result.tls_CertSha = params.pcs result.tls_CertByName = params.vcn local insecure = params.allowinsecure or params.insecure - result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0") + result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0") result.hysteria2_tls_pinSHA256 = params.pinSHA256 result.hysteria2_hop = params.mport - if (default_hysteria2_type == "sing-box" and has_singbox) or (default_hysteria2_type == "xray" and has_xray) then - local is_singbox = default_hysteria2_type == "sing-box" and has_singbox + if (sub_hysteria2_type == "sing-box" and has_singbox) or (sub_hysteria2_type == "xray" and has_xray) then + local is_singbox = sub_hysteria2_type == "sing-box" and has_singbox result.type = is_singbox and 'sing-box' or 'Xray' result.protocol = "hysteria2" if params["obfs-password"] or params["obfs_password"] then @@ -1490,7 +1490,7 @@ local function processData(szType, content, add_mode, group, sub_cfg) result.tuic_congestion_control = params.congestion_control or "cubic" result.tuic_udp_relay_mode = params.udp_relay_mode or "native" local insecure = params.allowinsecure or params.insecure or params.allow_insecure - result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0") + result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0") elseif szType == "anytls" then if has_singbox then result.type = 'sing-box' @@ -1554,7 +1554,7 @@ local function processData(szType, content, add_mode, group, sub_cfg) end result.port = port local insecure = params.allowinsecure or params.insecure - result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0") + result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0") end elseif szType == 'naive+https' or szType == 'naive+quic' then if has_singbox then diff --git a/luci-app-turboacc/Makefile b/luci-app-turboacc/Makefile index 175a0809..a6c4add0 100644 --- a/luci-app-turboacc/Makefile +++ b/luci-app-turboacc/Makefile @@ -1,63 +1,51 @@ # SPDX-Identifier-License: GPL-3.0-only # -# Copyright (C) 2022 Lean -# Copyright (C) 2019-2024 ImmortalWrt.org +# Copyright (C) 2024 Lean +# Copyright (C) 2019-2022 ImmortalWrt.org include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-turboacc -PKG_RELEASE:=1 -PKG_FLAGS:=nonshared - -PKG_LICENSE:=GPL-3.0-only -PKG_MAINTAINER:=Lean PKG_CONFIG_DEPENDS:= \ - CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_BBR_CCA \ - CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_DNSFORWARDER \ - CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_DNSPROXY \ - CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_OFFLOADING \ - CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_SHORTCUT_FE \ - CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_SHORTCUT_FE_CM + CONFIG_PACKAGE_TURBOACC_INCLUDE_NO_FASTPATH \ + CONFIG_PACKAGE_TURBOACC_INCLUDE_FLOW_OFFLOADING \ + CONFIG_PACKAGE_TURBOACC_INCLUDE_FAST_CLASSIFIER \ + CONFIG_PACKAGE_TURBOACC_INCLUDE_SHORTCUT_FE_CM \ + CONFIG_PACKAGE_TURBOACC_INCLUDE_BBR_CCA -LUCI_TITLE:=LuCI support for Flow Offload / Shortcut-FE -LUCI_DEPENDS:=+PACKAGE_$(PKG_NAME)_INCLUDE_BBR_CCA:kmod-tcp-bbr \ - +PACKAGE_$(PKG_NAME)_INCLUDE_OFFLOADING:kmod-ipt-offload \ - +PACKAGE_$(PKG_NAME)_INCLUDE_SHORTCUT_FE:kmod-fast-classifier \ - +PACKAGE_$(PKG_NAME)_INCLUDE_SHORTCUT_FE_CM:kmod-shortcut-fe-cm +PKG_LICENSE:=GPL-3.0-only +PKG_MAINTAINER:=Tianling Shen + +LUCI_TITLE:=LuCI support for FastPath (FW3 or FW4) +LUCI_DEPENDS:= \ + +PACKAGE_TURBOACC_INCLUDE_FLOW_OFFLOADING:kmod-ipt-offload \ + +PACKAGE_TURBOACC_INCLUDE_FAST_CLASSIFIER:kmod-fast-classifier \ + +PACKAGE_TURBOACC_INCLUDE_SHORTCUT_FE_CM:kmod-shortcut-fe-cm \ + +PACKAGE_TURBOACC_INCLUDE_BBR_CCA:kmod-tcp-bbr LUCI_PKGARCH:=all -define Package/$(PKG_NAME)/config -config PACKAGE_$(PKG_NAME)_INCLUDE_OFFLOADING - bool "Include Flow Offload" - default y if !(TARGET_ipq40xx||TARGET_ipq806x||TARGET_qualcommax) +define Package/luci-app-turboacc/config + choice + prompt "FastPath Engine" + default PACKAGE_TURBOACC_INCLUDE_FLOW_OFFLOADING if !(TARGET_qualcommax||TARGET_ipq50xx||TARGET_ipq53xx||TARGET_ipq60xx||TARGET_ipq807x||TARGET_ipq807x||TARGET_ipq95xx) -config PACKAGE_$(PKG_NAME)_INCLUDE_SHORTCUT_FE - bool "Include Shortcut-FE" - depends on PACKAGE_$(PKG_NAME)_INCLUDE_OFFLOADING=n - default y if (TARGET_ipq40xx) + config PACKAGE_TURBOACC_INCLUDE_NO_FASTPATH + bool "Use NSS ECM" if (TARGET_qualcommax||TARGET_ipq50xx||TARGET_ipq53xx||TARGET_ipq60xx||TARGET_ipq807x||TARGET_ipq807x||TARGET_ipq95xx) -config PACKAGE_$(PKG_NAME)_INCLUDE_SHORTCUT_FE_CM - bool "Include Shortcut-FE CM" - depends on PACKAGE_$(PKG_NAME)_INCLUDE_OFFLOADING=n - depends on PACKAGE_$(PKG_NAME)_INCLUDE_SHORTCUT_FE=n - default y if !(TARGET_ipq806x||TARGET_qualcommax) + config PACKAGE_TURBOACC_INCLUDE_FLOW_OFFLOADING + bool "Use flow offloading" -config PACKAGE_$(PKG_NAME)_INCLUDE_BBR_CCA - bool "Include BBR CCA" - default y + config PACKAGE_TURBOACC_INCLUDE_FAST_CLASSIFIER + bool "Use fast classifier" -config PACKAGE_$(PKG_NAME)_INCLUDE_PDNSD - bool "Include Pdnsd" - default y + config PACKAGE_TURBOACC_INCLUDE_SHORTCUT_FE_CM + bool "Use shortcut-fe connection manager" + endchoice -config PACKAGE_$(PKG_NAME)_INCLUDE_DNSFORWARDER - bool "Include DNSForwarder" - default n - -config PACKAGE_$(PKG_NAME)_INCLUDE_DNSPROXY - bool "Include DNSProxy" - default n + config PACKAGE_TURBOACC_INCLUDE_BBR_CCA + bool "Enable BBR CCA" + default y endef include $(TOPDIR)/feeds/luci/luci.mk diff --git a/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js b/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js new file mode 100644 index 00000000..e1801011 --- /dev/null +++ b/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js @@ -0,0 +1,231 @@ +/* Copyright (C) 2022 ImmortalWrt.org */ + +'use strict'; +'require form'; +'require fs'; +'require poll'; +'require rpc'; +'require uci'; +'require view'; + +var getSystemFeatures = rpc.declare({ + object: 'luci.turboacc', + method: 'getSystemFeatures', + expect: { '': {} } +}); + +var getFastPathStat = rpc.declare({ + object: 'luci.turboacc', + method: 'getFastPathStat', + expect: { '': {} } +}); + +var getFullConeStat = rpc.declare({ + object: 'luci.turboacc', + method: 'getFullConeStat', + expect: { '': {} } +}); + +var getTCPCCAStat = rpc.declare({ + object: 'luci.turboacc', + method: 'getTCPCCAStat', + expect: { '': {} } +}); + +var callInitAction = rpc.declare({ + object: 'luci', + method: 'setInitAction', + params: [ 'name', 'action' ], + expect: { result: false } +}); + +function getServiceStatus() { + return Promise.all([ + L.resolveDefault(getFastPathStat(), {}), + L.resolveDefault(getFullConeStat(), {}), + L.resolveDefault(getTCPCCAStat(), {}) + ]); +} + +function renderStatus(stats) { + var spanTemp = '%s'; + var renderHTML = []; + for (var stat of stats) + if (stat.type) { + if (stat.type.includes(' / ')) { + var types = stat.type.split(' / '); + var inner = spanTemp.format('green', types[0]); + for (var i of types.slice(1)) + inner += spanTemp.format('none', ' / ') + spanTemp.format('red', i); + renderHTML.push(inner); + } else + renderHTML.push(spanTemp.format('green', stat.type)); + } else + renderHTML.push(spanTemp.format('red', _('Disabled'))); + return renderHTML; +} + +return view.extend({ + load: function() { + return Promise.all([ + uci.load('turboacc'), + L.resolveDefault(getSystemFeatures(), {}), + L.resolveDefault(fs.stat('/etc/init.d/qca-nss-ecm'), null) + ]); + }, + + render: function(data) { + var m, s, o; + var features = data[1]; + features.hasNSSECM = !!features.hasNSSECM || !!data[2]; + + m = new form.Map('turboacc', _('TurboACC settings'), + _('Open source flow offloading engine (fast path or hardware NAT).')); + + s = m.section(form.TypedSection); + s.anonymous = true; + s.render = function () { + poll.add(function () { + return L.resolveDefault(getServiceStatus()).then(function (res) { + var stats = renderStatus(res); + var tds = [ 'fastpath_state', 'fullcone_state', 'tcpcca_state' ]; + for (var i in tds) { + var view = document.getElementById(tds[i]); + view.innerHTML = stats[i]; + } + }); + }); + + return E('fieldset', { 'class': 'cbi-section' }, [ + E('legend', {}, _('Acceleration Status')), + E('table', { 'class': 'table', 'width': '100%', 'cellspacing': '10' }, [ + E('tr', {}, [ + E('td', { 'width': '33%' }, _('FastPath Engine')), + E('td', { 'id': 'fastpath_state' }, E('em', {}, _('Collecting data...'))) + ]), + E('tr', {}, [ + E('td', { 'width': '33%' }, _('Full Cone NAT')), + E('td', { 'id': 'fullcone_state' }, E('em', {}, _('Collecting data...'))) + ]), + E('tr', {}, [ + E('td', { 'width': '33%' }, _('TCP CCA')), + E('td', { 'id': 'tcpcca_state' }, E('em', {}, _('Collecting data...'))) + ]) + ]) + ]); + } + + s = m.section(form.NamedSection, 'config', 'turboacc'); + + o = s.option(form.ListValue, 'fastpath', _('Fastpath engine'), + _('The offloading engine for routing/NAT.')); + o.value('disabled', _('Disable')); + if (features.hasFLOWOFFLOADING) + o.value('flow_offloading', _('Flow offloading')); + if (features.hasFASTCLASSIFIER) + o.value('fast_classifier', _('Fast classifier')); + if (features.hasSHORTCUTFECM) + o.value('shortcut_fe_cm', _('SFE connection manager')); + if (features.hasNSSECM) + o.value('qca_nss_ecm', _('QCA NSS ECM')); + if (features.hasMEDIATEKHNAT) + o.value('mediatek_hnat', _('MediaTek HNAT')); + o.default = 'disabled'; + o.rmempty = false; + o.onchange = function(ev, section_id, value) { + var desc = ev.target.nextElementSibling; + if (value === 'flow_offloading') + desc.innerHTML = _('Software based offloading for routing/NAT.'); + else if (value === 'fast_classifier') + desc.innerHTML = _('Fast classifier connection manager for the shortcut forwarding engine.'); + else if (value === 'shortcut_fe_cm') + desc.innerHTML = _('Simple connection manager for the shortcut forwarding engine.'); + else if (value === 'qca_nss_ecm') + desc.innerHTML = _('Qualcomm NSS ECM acceleration engine.'); + else if (value === 'mediatek_hnat') + desc.innerHTML = _('MediaTek\'s open source hardware offloading engine.'); + else + desc.innerHTML = _('The offloading engine for routing/NAT.'); + } + + o = s.option(form.Flag, 'fastpath_fo_hw', _('Hardware flow offloading'), + _('Requires hardware NAT support. Implemented at least for mt7621.')); + o.default = o.disabled; + o.rmempty = false; + o.depends('fastpath', 'flow_offloading'); + + o = s.option(form.Flag, 'fastpath_fc_br', _('Bridge Acceleration'), + _('Enable bridge acceleration (may be functional conflict with bridge-mode VPN server).')); + o.default = o.disabled; + o.rmempty = false; + o.depends('fastpath', 'fast_classifier'); + + if (features.hasIPV6) { + o = s.option(form.Flag, 'fastpath_fc_ipv6', _('IPv6 acceleration'), + _('Enable IPv6 Acceleration.')); + o.default = o.disabled; + o.rmempty = false; + o.depends('fastpath', 'fast_classifier'); + } + + o = s.option(form.Flag, 'fastpath_mh_eth_hnat', _('Enable ethernet HNAT'), + _('Enable hardware offloading for wired connections.')); + o.default = o.enabled; + o.rmempty = false; + o.depends('fastpath', 'mediatek_hnat'); + + o = s.option(form.Flag, 'fastpath_mh_eth_hnat_v6', _('Enable ethernet IPv6 HNAT'), + _('Enable hardware offloading for wired IPv6 connections.')); + o.default = o.enabled; + o.rmempty = false; + o.depends('fastpath_mh_eth_hnat', '1'); + + o = s.option(form.ListValue, 'fullcone', _('Full cone NAT'), + _('Full cone NAT (NAT1) can improve gaming performance effectively.')); + o.value('0', _('Disable')) + if (features.hasXTFULLCONENAT || features.hasNFTFULLCONENAT) { + o.value('1', _('FULLCONENAT')); + o.value('2', _('Boardcom Fullcone NAT1')); + } + o.default = '0'; + o.rmempty = false; + + o = s.option(form.ListValue, 'tcpcca', _('TCP CCA'), + _('TCP congestion control algorithm.')); + for (var i of features.hasTCPCCA.split(' ').sort()) + o.value(i); + o.default = 'cubic'; + o.rmempty = false; + + return m.render(); + }, + + markUserEdited() { + uci.set('turboacc', 'global', 'set', '1'); + }, + + handleSave(ev) { + this.markUserEdited(); + return this.super('handleSave', [ev]); + }, + + handleSaveApply(ev, mode) { + this.markUserEdited(); + + const applyNssEcmRestart = () => { + const section = uci.sections('turboacc', 'turboacc').find(s => s['.name'] == 'config'); + + if (section?.fastpath === 'qca_nss_ecm') + callInitAction('qca-nss-ecm', 'restart'); + }; + + const fn = L.bind(() => { + uci.unload('turboacc'); + uci.load('turboacc').then(applyNssEcmRestart); + document.removeEventListener('uci-applied', fn); + }); + + document.addEventListener('uci-applied', fn); + return this.super('handleSaveApply', [ev, mode]); + } +}); diff --git a/luci-app-turboacc/luasrc/controller/turboacc.lua b/luci-app-turboacc/luasrc/controller/turboacc.lua deleted file mode 100644 index 5b99975b..00000000 --- a/luci-app-turboacc/luasrc/controller/turboacc.lua +++ /dev/null @@ -1,39 +0,0 @@ -module("luci.controller.turboacc", package.seeall) - -function index() - if not nixio.fs.access("/etc/config/turboacc") then - return - end - local page - page = entry({"admin", "network", "turboacc"}, cbi("turboacc"), _("Turbo ACC Center"), 101) - page.i18n = "turboacc" - page.dependent = true - - entry({"admin", "network", "turboacc", "status"}, call("action_status")) -end - -local function fastpath_status() - return luci.sys.call("/etc/init.d/turboacc check_status fastpath >/dev/null") == 0 -end - -local function bbr_status() - return luci.sys.call("/etc/init.d/turboacc check_status bbr") == 0 -end - -local function fullconenat_status() - return luci.sys.call("/etc/init.d/turboacc check_status fullconenat") == 0 -end - -local function dnscaching_status() - return luci.sys.call("/etc/init.d/turboacc check_status dns") == 0 -end - -function action_status() - luci.http.prepare_content("application/json") - luci.http.write_json({ - fastpath_state = fastpath_status(), - fullconenat_state = fullconenat_status(), - bbr_state = bbr_status(), - dnscaching_state = dnscaching_status() - }) -end diff --git a/luci-app-turboacc/luasrc/model/cbi/turboacc.lua b/luci-app-turboacc/luasrc/model/cbi/turboacc.lua deleted file mode 100644 index 7fc1616d..00000000 --- a/luci-app-turboacc/luasrc/model/cbi/turboacc.lua +++ /dev/null @@ -1,62 +0,0 @@ -local kernel_version = luci.sys.exec("echo -n $(uname -r)") - -m = Map("turboacc") -m.title = translate("Turbo ACC Acceleration Settings") -m.description = translate("Opensource Flow Offloading driver (Fast Path or Hardware NAT)") - -m:append(Template("turboacc/turboacc_status")) - -s = m:section(TypedSection, "turboacc", "") -s.addremove = false -s.anonymous = true - -if nixio.fs.access("/lib/modules/" .. kernel_version .. "/xt_FLOWOFFLOAD.ko") or nixio.fs.access("/lib/modules/" .. kernel_version .. "/nft_flow_offload.ko") then -sw_flow = s:option(Flag, "sw_flow", translate("Software flow offloading")) -sw_flow.default = 0 -sw_flow.description = translate("Software based offloading for routing/NAT") -sw_flow:depends("sfe_flow", 0) -end - -if luci.sys.call("cat /etc/openwrt_release | grep -Eq 'filogic|mt762' ") == 0 then -hw_flow = s:option(Flag, "hw_flow", translate("Hardware flow offloading")) -hw_flow.default = 0 -hw_flow.description = translate("Requires hardware NAT support, implemented at least for mt762x") -hw_flow:depends("sw_flow", 1) -end - -if luci.sys.call("cat /etc/openwrt_release | grep -Eq 'mediatek' ") == 0 then -if nixio.fs.access("/lib/modules/" .. kernel_version .. "/mt7915e.ko") then -hw_wed = s:option(Flag, "hw_wed", translate("MTK WED WO offloading")) -hw_wed.default = 0 -hw_wed.description = translate("Requires hardware support, implemented at least for Filogic 8x0") -hw_wed:depends("hw_flow", 1) -end -end - -if nixio.fs.access("/lib/modules/" .. kernel_version .. "/shortcut-fe-cm.ko") -or nixio.fs.access("/lib/modules/" .. kernel_version .. "/fast-classifier.ko") -then -sfe_flow = s:option(Flag, "sfe_flow", translate("Shortcut-FE flow offloading")) -sfe_flow.default = 0 -sfe_flow.description = translate("Shortcut-FE based offloading for routing/NAT") -sfe_flow:depends("sw_flow", 0) -end - -if nixio.fs.access("/lib/modules/" .. kernel_version .. "/tcp_bbr.ko") then -bbr_cca = s:option(Flag, "bbr_cca", translate("BBR CCA")) -bbr_cca.default = 0 -bbr_cca.description = translate("Using BBR CCA can improve TCP network performance effectively") -end - -if nixio.fs.access("/lib/modules/" .. kernel_version .. "/xt_FULLCONENAT.ko") or nixio.fs.access("/lib/modules/" .. kernel_version .. "/nft_fullcone.ko") then -fullcone_nat = s:option(Flag, "fullcone_nat", translate("FullCone NAT")) -fullcone_nat.default = 0 -fullcone_nat.description = translate("Using FullCone NAT can improve gaming performance effectively") -if nixio.fs.access("/usr/sbin/nft") then -fullcone_nat6 = s:option(Flag, "fullcone_nat6", translate("FullCone NAT6")) -fullcone_nat6.default = 0 -fullcone_nat6.description = translate("Using FullCone NAT6 can improve gaming performance effectively") -end -end - -return m diff --git a/luci-app-turboacc/luasrc/view/turboacc/turboacc_status.htm b/luci-app-turboacc/luasrc/view/turboacc/turboacc_status.htm deleted file mode 100644 index 19441984..00000000 --- a/luci-app-turboacc/luasrc/view/turboacc/turboacc_status.htm +++ /dev/null @@ -1,24 +0,0 @@ -
- <%:Running Status%> - - - - -
<%:Flow Offloading%><%:Collecting data...%>
<%:FullCone NAT%><%:Collecting data...%>
<%:BBR CCA%><%:Collecting data...%>
-
- - diff --git a/luci-app-turboacc/po/templates/turboacc.pot b/luci-app-turboacc/po/templates/turboacc.pot new file mode 100644 index 00000000..4ac21786 --- /dev/null +++ b/luci-app-turboacc/po/templates/turboacc.pot @@ -0,0 +1,153 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:91 +msgid "Acceleration Status" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:182 +msgid "Boardcom fullcone" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:151 +msgid "Bridge Acceleration" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:95 +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:99 +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:103 +msgid "Collecting data..." +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:120 +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:179 +msgid "Disable" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:57 +msgid "Disabled" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:159 +msgid "Enable IPv6 Acceleration." +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:152 +msgid "" +"Enable bridge acceleration (may be functional conflict with bridge-mode VPN " +"server)." +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:165 +msgid "Enable ethernet HNAT" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:171 +msgid "Enable ethernet IPv6 HNAT" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:172 +msgid "Enable hardware offloading for wired IPv6 connections." +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:166 +msgid "Enable hardware offloading for wired connections." +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:124 +msgid "Fast classifier" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:136 +msgid "Fast classifier connection manager for the shortcut forwarding engine." +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:94 +msgid "FastPath Engine" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:118 +msgid "Fastpath engine" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:122 +msgid "Flow offloading" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:98 +msgid "Full Cone NAT" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:177 +msgid "Full cone NAT" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:178 +msgid "Full cone NAT (NAT1) can improve gaming performance effectively." +msgstr "" + +#: applications/luci-app-turboacc/root/usr/share/rpcd/acl.d/luci-app-turboacc.json:3 +msgid "Grant UCI access for luci-app-turboacc" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:145 +msgid "Hardware flow offloading" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:158 +msgid "IPv6 acceleration" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:128 +msgid "MediaTek HNAT" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:140 +msgid "MediaTek's open source hardware offloading engine." +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:74 +msgid "Open source flow offloading engine (fast path or hardware NAT)." +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:146 +msgid "Requires hardware NAT support. Implemented at least for mt7621." +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:126 +msgid "SFE connection manager" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:138 +msgid "Simple connection manager for the shortcut forwarding engine." +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:134 +msgid "Software based offloading for routing/NAT." +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:102 +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:186 +msgid "TCP CCA" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:187 +msgid "TCP congestion control algorithm." +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:119 +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:142 +msgid "The offloading engine for routing/NAT." +msgstr "" + +#: applications/luci-app-turboacc/root/usr/share/luci/menu.d/luci-app-turboacc.json:3 +msgid "TurboACC" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:73 +msgid "TurboACC settings" +msgstr "" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:181 +msgid "xt_FULLCONENAT" +msgstr "" diff --git a/luci-app-turboacc/po/zh-cn b/luci-app-turboacc/po/zh-cn new file mode 120000 index 00000000..8d69574d --- /dev/null +++ b/luci-app-turboacc/po/zh-cn @@ -0,0 +1 @@ +zh_Hans \ No newline at end of file diff --git a/luci-app-turboacc/po/zh-cn/turboacc.po b/luci-app-turboacc/po/zh-cn/turboacc.po deleted file mode 100644 index 08bbd260..00000000 --- a/luci-app-turboacc/po/zh-cn/turboacc.po +++ /dev/null @@ -1,101 +0,0 @@ -msgid "Turbo ACC Center" -msgstr "Turbo ACC 网络加速" - -msgid "Turbo ACC Acceleration Settings" -msgstr "Turbo ACC 网络加速设置" - -msgid "Linux Flow Offload Forwarding Engine Settings" -msgstr "Linux Flow Offload Forwarding 转发加速引擎设置" - -msgid "Opensource Flow Offloading driver (Fast Path or Hardware NAT)" -msgstr "开源流量分载驱动 (支持 Fast Path 或者 硬件 NAT)" - -msgid "Software flow offloading" -msgstr "软件流量分载" - -msgid "Software based offloading for routing/NAT" -msgstr "基于软件的 Routing/NAT 分载" - -msgid "Hardware flow offloading" -msgstr "硬件流量分载" - -msgid "Requires hardware NAT support, implemented at least for mt762x" -msgstr "需要硬件 NAT 支持,目前 mt762x 已实现" - -msgid "Requires hardware support, implemented at least for Filogic 8x0" -msgstr "需要硬件支持,目前 Filogic 8x0 已实现" - -msgid "Shortcut-FE flow offloading" -msgstr "Shortcut-FE 流量分载" - -msgid "Shortcut-FE based offloading for routing/NAT" -msgstr "基于 Shortcut-FE 的 Routing/NAT 分载" - -msgid "Bridge Acceleration" -msgstr "桥接加速" - -msgid "Enable Bridge Acceleration (may be functional conflict with bridge-mode VPN server)" -msgstr "启用桥接加速 (可能会和路由器上桥接模式的VPN服务器冲突)" - -msgid "IPv6 Acceleration" -msgstr "IPv6 加速" - -msgid "Enable IPv6 Acceleration" -msgstr "启用 IPv6 加速" - -msgid "BBR CCA" -msgstr "BBR 拥塞控制算法" - -msgid "Using BBR CCA can improve TCP network performance effectively" -msgstr "使用 BBR 拥塞控制算法可以有效提升 TCP 网络性能" - -msgid "FullCone NAT" -msgstr "全锥形 NAT" - -msgid "Using FullCone NAT can improve gaming performance effectively" -msgstr "使用全锥形 NAT 可以有效提升游戏体验" - -msgid "DNS Caching" -msgstr "DNS 缓存" - -msgid "Enable DNS Caching and anti ISP DNS pollution" -msgstr "启用 DNS 多线程查询、缓存,并防止 ISP 的 DNS 广告和域名劫持" - -msgid "Resolve DNS Mode" -msgstr "DNS 解析方式" - -msgid "DNS Program" -msgstr "DNS 解析程序" - -msgid "Using PDNSD to query and cache" -msgstr "使用 PDNSD 解析" - -msgid "Using DNSForwarder to query and cache" -msgstr "使用 DNSForwarder 解析" - -msgid "Using DNSProxy to query and cache" -msgstr "使用 DNSProxy 解析" - -msgid "Upsteam DNS Server" -msgstr "上游 DNS 服务器" - -msgid "Muitiple DNS server can saperate with ','" -msgstr "多个上游 DNS 服务器请用 ',' 分隔(注意用英文逗号)" - -msgid "Running Status" -msgstr "运行状态" - -msgid "Flow Offloading" -msgstr "流量分载" - -msgid "BBR CCA" -msgstr "BBR 拥塞控制算法" - -msgid "FullCone NAT" -msgstr "全锥型 NAT" - -msgid "DNS Caching" -msgstr "DNS 缓存" - -msgid "MTK WED WO offloading" -msgstr "MTK 无线硬件加速" diff --git a/luci-app-turboacc/po/zh_Hans b/luci-app-turboacc/po/zh_Hans deleted file mode 120000 index 41451e4a..00000000 --- a/luci-app-turboacc/po/zh_Hans +++ /dev/null @@ -1 +0,0 @@ -zh-cn \ No newline at end of file diff --git a/luci-app-turboacc/po/zh_Hans/turboacc.po b/luci-app-turboacc/po/zh_Hans/turboacc.po new file mode 100644 index 00000000..9fafa21a --- /dev/null +++ b/luci-app-turboacc/po/zh_Hans/turboacc.po @@ -0,0 +1,178 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: zh-Hans\n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:91 +msgid "Acceleration Status" +msgstr "加速状态" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:182 +msgid "Boardcom fullcone" +msgstr "Boardcom fullcone" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:151 +msgid "Bridge Acceleration" +msgstr "桥接加速" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:95 +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:99 +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:103 +msgid "Collecting data..." +msgstr "正在收集数据…" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:120 +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:179 +msgid "Disable" +msgstr "禁用" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:57 +msgid "Disabled" +msgstr "已禁用" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:159 +msgid "Enable IPv6 Acceleration." +msgstr "启用 IPv6 加速。" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:152 +msgid "" +"Enable bridge acceleration (may be functional conflict with bridge-mode VPN " +"server)." +msgstr "启用桥接加速(可能会与桥接模式的 VPN 服务器冲突)。" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:165 +msgid "Enable ethernet HNAT" +msgstr "启用以太网 HNAT" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:171 +msgid "Enable ethernet IPv6 HNAT" +msgstr "启用以太网 IPv6 HNAT" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:172 +msgid "Enable hardware offloading for wired IPv6 connections." +msgstr "为有线 IPv6 连接启用硬件加速。" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:166 +msgid "Enable hardware offloading for wired connections." +msgstr "为有线连接启用硬件加速。" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:124 +msgid "Fast classifier" +msgstr "Fast classifier" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:136 +msgid "Fast classifier connection manager for the shortcut forwarding engine." +msgstr "快速转发引擎(SFE)的 fast classifier 连接管理器。" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:94 +msgid "FastPath Engine" +msgstr "快速转发引擎" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:118 +msgid "Fastpath engine" +msgstr "快速转发引擎" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:122 +msgid "Flow offloading" +msgstr "Flow offloading" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:98 +msgid "Full Cone NAT" +msgstr "全锥形 NAT1" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:177 +msgid "Full cone NAT" +msgstr "全锥形 NAT1" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:177 +msgid "FULLCONENAT" +msgstr "兼容模式全锥形 NAT1" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:177 +msgid "Boardcom Fullcone NAT1" +msgstr "高性能 Boardcom 全锥形 NAT1" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:178 +msgid "Full cone NAT (NAT1) can improve gaming performance effectively." +msgstr "Full cone NAT(NAT1)可以有效提升游戏体验。" + +#: applications/luci-app-turboacc/root/usr/share/rpcd/acl.d/luci-app-turboacc.json:3 +msgid "Grant UCI access for luci-app-turboacc" +msgstr "授予 luci-app-turboacc 访问 UCI 配置的权限。" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:145 +msgid "Hardware flow offloading" +msgstr "硬件流量分载" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:158 +msgid "IPv6 acceleration" +msgstr "IPv6 加速" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:128 +msgid "MediaTek HNAT" +msgstr "MediaTek HNAT" + +msgid "MTK WED WO offloading" +msgstr "MTK 无线硬件加速" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:140 +msgid "MediaTek's open source hardware offloading engine." +msgstr "由联发科实现的开源硬件流量分载引擎。" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:74 +msgid "Open source flow offloading engine (fast path or hardware NAT)." +msgstr "开源流量分载引擎(快速转发或硬件 NAT)。" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:146 +msgid "Requires hardware NAT support. Implemented at least for mt7621." +msgstr "需要硬件 NAT 支持。目前 mt762x/mt798x 已实现。" + +msgid "Requires hardware support, implemented at least for Filogic 8x0" +msgstr "需要硬件支持,目前 Filogic 8x0 已实现" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:126 +msgid "SFE connection manager" +msgstr "SFE connection manager" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:138 +msgid "Simple connection manager for the shortcut forwarding engine." +msgstr "快速转发引擎(SFE)的简单连接管理器。" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:134 +msgid "Software based offloading for routing/NAT." +msgstr "基于软件的 路由/NAT 分载。" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:102 +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:186 +msgid "TCP CCA" +msgstr "TCP 拥塞控制算法" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:187 +msgid "TCP congestion control algorithm." +msgstr "TCP 拥塞控制算法。" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:119 +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:142 +msgid "The offloading engine for routing/NAT." +msgstr "用于 路由/NAT 的分载引擎。" + +#: applications/luci-app-turboacc/root/usr/share/luci/menu.d/luci-app-turboacc.json:3 +msgid "TurboACC" +msgstr "Turbo ACC 网络加速" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:73 +msgid "TurboACC settings" +msgstr "Turbo ACC 网络加速设置" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:181 +msgid "xt_FULLCONENAT" +msgstr "兼容模式" + +#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:182 +msgid "Boardcom fullcone" +msgstr "高性能模式" diff --git a/luci-app-turboacc/root/etc/config/turboacc b/luci-app-turboacc/root/etc/config/turboacc index 67768bfd..f89f86a3 100644 --- a/luci-app-turboacc/root/etc/config/turboacc +++ b/luci-app-turboacc/root/etc/config/turboacc @@ -1,9 +1,4 @@ +config turboacc 'global' + option set '0' config turboacc 'config' - option sw_flow '1' - option hw_flow '1' - option sfe_flow '1' - option fullcone_nat '1' - option fullcone_nat6 '0' - option hw_wed '0' - option bbr_cca '0' diff --git a/luci-app-turboacc/root/etc/init.d/turboacc b/luci-app-turboacc/root/etc/init.d/turboacc index 85a014f2..f8a0dbbc 100755 --- a/luci-app-turboacc/root/etc/init.d/turboacc +++ b/luci-app-turboacc/root/etc/init.d/turboacc @@ -1,364 +1,90 @@ #!/bin/sh /etc/rc.common -# Copyright (C) 2022 Lean -# Copyright (C) 2019-2021 Tianling Shen +# Copyright (C) 2018 Lean +# Copyright (C) 2019-2022 Tianling Shen START=90 STOP=10 +USE_PROCD=1 -EXTRA_COMMANDS="check_status" -EXTRA_HELP=" check_status Check running status of utils" - -restart_utils="true" - -inital_conf(){ +start_service() { config_load "turboacc" - config_get "hw_wed" "config" "hw_wed" "0" - config_get "hw_flow" "config" "hw_flow" "0" - config_get "sw_flow" "config" "sw_flow" "0" - config_get "sfe_flow" "config" "sfe_flow" "0" - config_get "bbr_cca" "config" "bbr_cca" "0" - config_get "fullcone_nat" "config" "fullcone_nat" "0" - config_get "fullcone_nat6" "config" "fullcone_nat6" "0" - [[ ! -e "/lib/modules/$(uname -r)/xt_FLOWOFFLOAD.ko" && ! -e "/lib/modules/$(uname -r)/nft_flow_offload.ko" ]] && { sw_flow="0"; hw_flow="0"; } - [[ ! -e "/lib/modules/$(uname -r)/xt_FULLCONENAT.ko" && ! -e "/lib/modules/$(uname -r)/nft_fullcone.ko" ]] && { fullcone_nat="0"; fullcone_nat6="0"; } - [ ! -e "/lib/modules/$(uname -r)/tcp_bbr.ko" ] && bbr_cca="0" -} + local fastpath + config_get fastpath "config" "fastpath" -start_pdnsd() { - [ -d "/var/run/dnscache" ] || mkdir -p "/var/run/dnscache" - cat > "/var/run/dnscache/dnscache.conf" < "/var/dnscache/pdnsd.cache" - chown -R nobody.nogroup "/var/dnscache" + if [ "$fastpath" != "fast_classifier" ] && lsmod | grep -q "fast_classifier"; then + echo "0" > "/sys/fast_classifier/skip_to_bridge_ingress" 2>"/dev/null" + rm -f "/dev/sfe_ipv6" + rmmod "fast_classifier" 2>"/dev/null" fi - [ -d "/var/sbin" ] || mkdir -p "/var/sbin" - cp -a "/usr/sbin/pdnsd" "/var/sbin/dnscache" - /var/sbin/dnscache -c "/var/run/dnscache/dnscache.conf" > "/var/log/dnscache.file" 2>&1 & - echo "PDNSD: Start DNS Caching" -} - -start_dnsforwarder() { - mkdir -p "/var/run/dnscache" - cat > "/var/run/dnscache/dnscache.conf" < "/var/log/dnscache.file" 2>&1 & - echo "DnsForwarder: Start DNS Caching" - -} - -start_dnsproxy() { - [ -d "/var/run/dnscache" ] || mkdir -p "/var/run/dnscache" - echo -e "${dns_caching_dns//,/\\n}" > "/var/run/dnscache/dnscache.conf" - - [ -d "/var/sbin" ] || mkdir -p "/var/sbin" - cp -a "/usr/bin/dnsproxy" "/var/sbin/dnscache" - /var/sbin/dnscache -l "127.0.0.1" -p "5333" -b "tls://9.9.9.9" -f "tls://8.8.8.8" -u "/var/run/dnscache/dnscache.conf" --all-servers --cache --cache-min-ttl=3600 > "/var/log/dnscache.file" 2>&1 & - echo "DNSProxy: Start DNS Caching" -} - -stop_dnscache() { - killall -9 "dnscache" - kill -9 $(ps -w | grep dnscache-while.sh | grep -v "grep" | awk '{print $1}') - rm -rf "/var/dnscache" "/var/run/dnscache" - echo "Stop DNS Caching" -} - -change_dns() { - uci -q delete dhcp.@dnsmasq[0].server - uci add_list dhcp.@dnsmasq[0].server="127.0.0.1#5333" - uci set dhcp.@dnsmasq[0].noresolv="1" - uci commit dhcp -} - -revert_dns() { - uci set dhcp.@dnsmasq[0].noresolv="0" - uci -q del_list dhcp.@dnsmasq[0].server="127.0.0.1#5333" - if [ -d "/tmp/resolv.conf.d" ]; then - uci set dhcp.@dnsmasq[0].resolvfile="/tmp/resolv.conf.d/resolv.conf.auto" - else - uci set dhcp.@dnsmasq[0].resolvfile="/tmp/resolv.conf.auto" - fi - uci commit dhcp -} - -load_sfe() { - local kernel_version=$(uname -r) - - [ -e "/lib/modules/$kernel_version/shortcut-fe-cm.ko" ] && modprobe shortcut-fe-cm - [ -e "/lib/modules/$kernel_version/fast-classifier.ko" ] && modprobe fast-classifier -} - -unload_sfe() { - [ -d /sys/module/shortcut_fe_cm ] && rmmod shortcut_fe_cm - [ -d /sys/module/fast_classifier ] && rmmod fast_classifier -} - -load_wed() { - local kernel_version=$(uname -r) - - grep -Eq 'mediatek' /etc/openwrt_release && \ - ! grep -Eq 'mt7915e' /etc/modules.conf && \ - [ -e "/lib/modules/$kernel_version/mt7915e.ko" ] && { - sed -i '$aoptions mt7915e wed_enable=Y' /etc/modules.conf - rmmod mt7915e && sleep 1 && modprobe mt7915e && wifi up - } -} - -unload_wed() { - local kernel_version=$(uname -r) - - grep -Eq 'mediatek' /etc/openwrt_release && \ - grep -Eq 'mt7915e' /etc/modules.conf && \ - [ -e "/lib/modules/$kernel_version/mt7915e.ko" ] && { - sed -i '/mt7915e/d' /etc/modules.conf - rmmod mt7915e && sleep 1 && modprobe mt7915e && wifi up - } -} - -start(){ - inital_conf - - uci set firewall.@defaults[0].flow_offloading="${sw_flow}" - uci set firewall.@defaults[0].flow_offloading_hw="${hw_flow}" - uci set firewall.@defaults[0].fullcone="${fullcone_nat}" - uci set firewall.@defaults[0].fullcone6="${fullcone_nat6}" - uci commit firewall - - [ "${sw_flow}" -ne "1" ] && [ "${sfe_flow}" -eq "1" ] && { - load_sfe - } - - [ "${hw_flow}" -eq "1" ] && [ "${hw_wed}" -eq "1" ] && { - load_wed - } - - if [ "${bbr_cca}" -eq "1" ]; then - sysctl -w net.ipv4.tcp_congestion_control="bbr" - else - sysctl -w net.ipv4.tcp_congestion_control="cubic" + if [ "$fastpath" != "shortcut_fe_cm" ] && lsmod | grep -q "shortcut_fe_cm"; then + rmmod "shortcut_fe_cm" 2>"/dev/null" fi - if [ "${restart_utils}" = "true" ]; then - echo "DNSMASQ change" - /etc/init.d/dnsmasq restart >"/dev/null" 2>&1 - /etc/init.d/firewall restart >"/dev/null" 2>&1 + if [ "$fastpath" != "mediatek_hnat" ] && lsmod | grep -q "mtkhnat"; then + echo "0" > "/sys/kernel/debug/hnat/hook_toggle" 2>"/dev/null" fi -} -stop(){ - inital_conf + local flow_offloading="0" + local flow_offloading_hw="0" + case "$fastpath" in + "flow_offloading") + flow_offloading="1" + local fastpath_fo_hw flow_offloading_hw + config_get_bool fastpath_fo_hw "config" "fastpath_fo_hw" "0" + [ "$fastpath_fo_hw" -eq "0" ] || flow_offloading_hw="1" + ;; + "fast_classifier") + local fastpath_fc_br fastpath_fc_ipv6 + config_get_bool fastpath_fc_br "config" "fastpath_fc_br" "0" + config_get_bool fastpath_fc_ipv6 "config" "fastpath_fc_ipv6" "0" - uci set firewall.@defaults[0].flow_offloading="${sw_flow}" - uci set firewall.@defaults[0].flow_offloading_hw="${hw_flow}" - uci set firewall.@defaults[0].fullcone="${fullcone_nat}" - uci set firewall.@defaults[0].fullcone6="${fullcone_na6}" - uci commit firewall + lsmod | grep -q "fast_classifier" || modprobe "fast_classifier" 2>"/dev/null" + echo "$fastpath_fc_br" > "/sys/fast_classifier/skip_to_bridge_ingress" 2>"/dev/null" + if [ "$fastpath_fc_ipv6" -eq "1" ]; then + [ -e "/dev/sfe_ipv6" ] || mknod "/dev/sfe_ipv6" "c" "$(cat "/sys/sfe_ipv6/debug_dev")" "0" + else + [ ! -e "/dev/sfe_ipv6" ] || rm -f "/dev/sfe_ipv6" + fi + ;; + "shortcut_fe_cm") + lsmod |grep -q "shortcut_fe_cm" || modprobe "shortcut_fe_cm" 2>"/dev/null" + ;; + "qca_nss_ecm") + [ -x "/etc/init.d/qca-nss-ecm" ] && /etc/init.d/qca-nss-ecm restart >/dev/null 2>&1 + ;; + "mediatek_hnat") + local fastpath_mh_eth_hnat fastpath_mh_eth_hnat_v6 + config_get_bool fastpath_mh_eth_hnat "config" "fastpath_mh_eth_hnat" "1" + config_get_bool fastpath_mh_eth_hnat_v6 "config" "fastpath_mh_eth_hnat_v6" "1" - [ "${hw_wed}" -eq "0" ] && { - unload_wed - } + local hnat_path="/sys/kernel/debug/hnat" + echo "$fastpath_mh_eth_hnat" > "$hnat_path/hook_toggle" + echo "8 $fastpath_mh_eth_hnat_v6" > "$hnat_path/hnat_setting" + ;; + esac - unload_sfe + uci -q set "firewall.@defaults[0].flow_offloading"="$flow_offloading" + uci -q set "firewall.@defaults[0].flow_offloading_hw"="$flow_offloading_hw" - if [ "${restart_utils}" = "true" ]; then - echo "DNSMASQ revert" - /etc/init.d/dnsmasq restart >"/dev/null" 2>&1 - /etc/init.d/firewall restart >"/dev/null" 2>&1 - fi -} + local fullcone + config_get "fullcone" "config" "fullcone" "0" + uci -q set "firewall.@defaults[0].fullcone"="$fullcone" -restart(){ - restart_utils="false" + local tcpcca + config_get "tcpcca" "config" "tcpcca" "cubic" + sysctl -w net.ipv4.tcp_congestion_control="$tcpcca" >"/dev/null" - stop - start - - echo "DNSMASQ restart" - /etc/init.d/dnsmasq restart >"/dev/null" 2>&1 + uci -q commit "firewall" /etc/init.d/firewall restart >"/dev/null" 2>&1 } -check_status(){ - case "$1" in - "fastpath") - if [[ "$(cat "/sys/module/xt_FLOWOFFLOAD/refcnt" 2>"/dev/null" || echo 0)" -ne "0" || "$(cat "/sys/module/nft_flow_offload/refcnt" 2>"/dev/null" || echo 0)" -ne "0" ]]; then - echo -n "Flow Offloading" - exit 0 - elif [[ "$(cat "/sys/module/xt_FLOWOFFLOAD/refcnt" 2>"/dev/null")" -eq "0" || "$(cat "/sys/module/nft_flow_offload/refcnt" 2>"/dev/null")" -eq "0" ]] && \ - [ -e /sys/kernel/debug/hnat/hnat_version ]; then - echo -n "MediaTek HWNAT" - exit 0 - elif [ -d /sys/kernel/debug/ecm/ecm_nss_ipv4 ]; then - echo -n "QCA-NSS-ECM" - exit 0 - elif [ -d /sys/kernel/debug/ecm/ecm_sfe_ipv4 ]; then - echo -n "QCA-ECM-SFE" - exit 0 - elif [ -d /sys/module/fast_classifier ]; then - echo -n "Shortcut-FE" - exit 0 - elif [ -d /sys/module/shortcut_fe_cm ]; then - echo -n "Shortcut-FE ECM" - exit 0 - else - exit 1 - fi - ;; - "fullconenat") - if [[ -z "$(iptables -t nat -L zone_wan_postrouting | grep -i fullcone)" && "$(cat "/sys/module/nft_fullcone/refcnt" 2>"/dev/null" || echo 0)" -eq "0" ]]; then - exit 1 - else - exit 0 - fi - ;; - "bbr") - [ "x$(cat "/proc/sys/net/ipv4/tcp_congestion_control" 2>"/dev/null")" = "xbbr" ] && \ - exit 0 || exit 1 - ;; - *) - exit 2 - ;; - esac +reload_service() { + stop + start +} + +service_triggers() { + procd_add_reload_trigger "turboacc" } diff --git a/luci-app-turboacc/root/etc/uci-defaults/luci-turboacc b/luci-app-turboacc/root/etc/uci-defaults/luci-turboacc deleted file mode 100644 index 5b2ede02..00000000 --- a/luci-app-turboacc/root/etc/uci-defaults/luci-turboacc +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -[ ! -f "/usr/share/ucitrack/luci-app-turboacc.json" ] && { - cat > /usr/share/ucitrack/luci-app-turboacc.json << EEOF -{ - "config": "turboacc", - "init": "turboacc" -} -EEOF -} - -uci -q batch <<-EOF >/dev/null - delete ucitrack.@turboacc[-1] - add ucitrack turboacc - set ucitrack.@turboacc[-1].init=turboacc - commit ucitrack -EOF - -[ -n "$(lsmod | grep mtkhnat)" ] && \ - uci set turboacc.config.sw_flow='0' && \ - uci set turboacc.config.hw_flow='0' - -uci commit turboacc - -exit 0 diff --git a/luci-app-turboacc/root/etc/uci-defaults/turboacc b/luci-app-turboacc/root/etc/uci-defaults/turboacc new file mode 100644 index 00000000..33767349 --- /dev/null +++ b/luci-app-turboacc/root/etc/uci-defaults/turboacc @@ -0,0 +1,55 @@ +#!/bin/sh + +[ "$(uci -q get "turboacc.global.set")" -eq "1" ] && exit 0 + +cat <<-EOF > "/etc/config/turboacc" + +config turboacc 'global' + option set '0' + +config turboacc 'config' + option tcpcca 'cubic' + +EOF + +kernel_ver="$(uname -r)" + +if [ -e "/etc/init.d/qca-nss-ecm" ]; then + uci -q set "turboacc.config.fastpath"="qca_nss_ecm" +elif [ -e "/lib/modules/$kernel_ver/mtkhnat.ko" ]; then + uci -q set "turboacc.config.fastpath"="mediatek_hnat" + uci -q set "turboacc.config.fastpath_mh_eth_hnat"="1" + uci -q set "turboacc.config.fastpath_mh_eth_hnat_v6"="1" +elif [ -e "/lib/modules/$kernel_ver/xt_FLOWOFFLOAD.ko" ]; then + uci -q set "turboacc.config.fastpath"="flow_offloading" + if grep -q "mt762" "/etc/openwrt_release"; then + uci -q set "turboacc.config.fastpath_fo_hw"="1" + else + uci -q set "turboacc.config.fastpath_fo_hw"="0" + fi +elif [ -e "/lib/modules/$kernel_ver/fast-classifier.ko" ]; then + uci -q set "turboacc.config.fastpath"="fast_classifier" + uci -q set "turboacc.config.fastpath_fc_br"="1" + if [ -d "/proc/sys/net/ipv6" ]; then + uci -q set "turboacc.config.fastpath_fc_ipv6"="1" + else + uci -q set "turboacc.config.fastpath_fc_ipv6"="0" + fi +elif [ -e "/lib/modules/$kernel_ver/shortcut-fe-cm.ko" ]; then + uci -q set "turboacc.config.fastpath"="shortcut_fe_cm" +else + uci -q set "turboacc.config.fastpath"="none" +fi + +if [ -e "/lib/modules/$kernel_ver/xt_FULLCONENAT.ko" ]; then + uci -q set "turboacc.config.fullcone"="1" +else + uci -q set "turboacc.config.fullcone"="0" +fi + +uci -q commit "turboacc" + +/etc/init.d/turboacc enable >/dev/null 2>&1 +/etc/init.d/turboacc start >/dev/null 2>&1 + +exit 0 diff --git a/luci-app-turboacc/root/usr/libexec/rpcd/luci.turboacc b/luci-app-turboacc/root/usr/libexec/rpcd/luci.turboacc new file mode 100755 index 00000000..ab3e6e6d --- /dev/null +++ b/luci-app-turboacc/root/usr/libexec/rpcd/luci.turboacc @@ -0,0 +1,144 @@ +#!/usr/bin/env lua +-- Copyright (C) 2022 ImmortalWrt.org + +local json = require "luci.jsonc" +local fs = require "nixio.fs" +local util = require "luci.util" +local sys = require "luci.sys" + +string.trim = util.trim + +local function readfile(path) + local s = fs.readfile(path) + return s and (s:gsub("^%s+", ""):gsub("%s+$", "")) +end + +local methods = { + getSystemFeatures = { + call = function() + local boardinfo = util.ubus("system", "board") or {} + local features = { + hasIPV6 = fs.access("/proc/net/ipv6_route"), + hasFLOWOFFLOADING = fs.access("/lib/modules/" .. boardinfo.kernel .. "/xt_FLOWOFFLOAD.ko") or fs.access("/lib/modules/" .. boardinfo.kernel .. "/xt_FLOWOFFLOAD.ko"), + hasFASTCLASSIFIER = fs.access("/lib/modules/" .. boardinfo.kernel .. "/fast-classifier.ko"), + hasSHORTCUTFECM = fs.access("/lib/modules/" .. boardinfo.kernel .. "/shortcut-fe-cm.ko"), + hasNSSECM = fs.access("/etc/init.d/qca-nss-ecm"), + hasMEDIATEKHNAT = fs.access("/lib/modules/" .. boardinfo.kernel .. "/mtkhnat.ko"), + hasXTFULLCONENAT = fs.access("/lib/modules/" .. boardinfo.kernel .. "/xt_FULLCONENAT.ko"), + hasNFTFULLCONENAT = fs.access("/lib/modules/" .. boardinfo.kernel .. "/nft_fullcone.ko"), + hasTCPCCA = readfile("/proc/sys/net/ipv4/tcp_available_congestion_control") + } + print(json.stringify(features)) + end + }, + getFastPathStat = { + call = function() + local fptype + if fs.access("/sys/module/xt_FLOWOFFLOAD/refcnt") and + (readfile("/sys/module/xt_FLOWOFFLOAD/refcnt") or "0") ~= "0" then + fptype = "Flow offloading (FW3)" + elseif fs.access("/sys/module/nft_flow_offload/refcnt") and + (readfile("/sys/module/nft_flow_offload/refcnt") or "0") ~= "0" then + fptype = "Flow offloading (FW4)" + elseif fs.stat("/sys/module/fast_classifier", "type") == "dir" then + fptype = "Fast classifier" + elseif fs.stat("/sys/module/shortcut_fe_cm", "type") == "dir" then + fptype = "Shortcut-FE CM" + elseif fs.stat("/sys/module/ecm", "type") == "dir" then + fptype = "QCA NSS ECM" + elseif fs.stat("/sys/kernel/debug/hnat", "type") == "dir" then + local ethernet_hnat = (readfile("/sys/kernel/debug/hnat/hook_toggle") ~= "enabled") and + " / Ethernet HNAT Disabled" or "" + local wireless_hnat = (sys.call("grep -q 'WHNAT=1' '/etc/wireless/mediatek/'*_card*.dat") ~= 0) and + " / Wireless HNAT Disabled" or "" + if (ethernet_hnat == "") or (wireless_hnat == "") then + fptype = "MediaTek HNAT" .. ethernet_hnat .. wireless_hnat + end + end + print(json.stringify({ type = fptype })) + end + }, + getFullConeStat = { + call = function() + local fctype + if fs.access("/sys/module/xt_FULLCONENAT/refcnt") and + (readfile("/sys/module/xt_FULLCONENAT/refcnt") or "0") ~= "0" then + fctype = "xt_FULLCONENAT" + elseif fs.access("/sys/module/nft_fullcone/refcnt") and + (readfile("/sys/module/nft_fullcone/refcnt") or "0") ~= "0" then + fctype = "nft_FULLCONENAT" + elseif sys.call("iptables -t nat -L zone_wan_postrouting | grep -q fullcone") == 0 then + fctype = "Boardcom Fullcone" + end + print(json.stringify({ type = fctype })) + end + }, + getTCPCCAStat = { + call = function() + local ccatype = readfile("/proc/sys/net/ipv4/tcp_congestion_control") + ccatype = ccatype and ccatype:upper() or nil + print(json.stringify({ type = ccatype })) + end + } +} + +local function parseInput() + local parse = json.new() + local done, err + + while true do + local chunk = io.read(4096) + if not chunk then + break + elseif not done and not err then + done, err = parse:parse(chunk) + end + end + + if not done then + print(json.stringify({ error = err or "Incomplete input" })) + os.exit(1) + end + + return parse:get() +end + +local function validateArgs(func, uargs) + local method = methods[func] + if not method then + print(json.stringify({ error = "Method not found" })) + os.exit(1) + end + + if type(uargs) ~= "table" then + print(json.stringify({ error = "Invalid arguments" })) + os.exit(1) + end + + uargs.ubus_rpc_session = nil + + local k, v + local margs = method.args or {} + for k, v in pairs(uargs) do + if margs[k] == nil or + (v ~= nil and type(v) ~= type(margs[k])) + then + print(json.stringify({ error = "Invalid arguments" })) + os.exit(1) + end + end + + return method +end + +if arg[1] == "list" then + local _, method, rv = nil, nil, {} + for _, method in pairs(methods) do rv[_] = method.args or {} end + print((json.stringify(rv):gsub(":%[%]", ":{}"))) +elseif arg[1] == "call" then + local args = parseInput() + local method = validateArgs(arg[2], args) + local result, code = method.call(args) + print((json.stringify(result):gsub("^%[%]$", "{}"))) + os.exit(code or 0) +end diff --git a/luci-app-turboacc/root/usr/share/dnscache/dnscache-while.sh b/luci-app-turboacc/root/usr/share/dnscache/dnscache-while.sh deleted file mode 100755 index 63a94bbd..00000000 --- a/luci-app-turboacc/root/usr/share/dnscache/dnscache-while.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -sleeptime=60 - -dnsconf="/var/run/dnscache/dnscache.conf" -dnsprogram="/var/sbin/dnscache" -logfile="/var/log/dnscache.file" - -dns_caching="$(uci -q get turboacc.config.dns_caching)" -dns_caching_mode="$(uci -q get turboacc.config.dns_caching_mode)" - -clean_log() { - logrow="$(grep -c "" "${logfile}")" - [ "${logrow}" -lt "500" ] || echo "${curtime} Log 条数超限,清空处理!" > "${logfile}" -} - -while [ "${dns_caching}" -eq "1" ]; -do - curtime="$(date "+%H:%M:%S")" - - clean_log - - if pidof dnscache > "/dev/null"; then - echo -e "${curtime} online!" >> "${logfile}" - else - if [ "${dns_caching_mode}" = "1" ]; then - ${dnsprogram} -c "${dnsconf}" > "${logfile}" 2>&1 & - elif [ "${dns_caching_mode}" = "2" ]; then - ${dnsprogram} -f "${dnsconf}" > "${logfile}" 2>&1 & - elif [ "${dns_caching_mode}" = "3" ]; then - ${dnsprogram} -o "${logfile}" -l "127.0.0.1" -p "5333" -b "tls://9.9.9.9" -f "tls://8.8.8.8" -u "${dnsconf}" --all-servers --cache --cache-min-ttl=3600 > "${logfile}" 2>&1 & - fi - echo "${curtime} 重启服务!" >> ${logfile} - fi - - sleep "${sleeptime}" - continue -done diff --git a/luci-app-turboacc/root/usr/share/luci/menu.d/luci-app-turboacc.json b/luci-app-turboacc/root/usr/share/luci/menu.d/luci-app-turboacc.json new file mode 100644 index 00000000..167b628a --- /dev/null +++ b/luci-app-turboacc/root/usr/share/luci/menu.d/luci-app-turboacc.json @@ -0,0 +1,13 @@ +{ + "admin/network/turboacc": { + "title": "TurboACC", + "action": { + "type": "view", + "path": "turboacc" + }, + "depends": { + "acl": [ "luci-app-turboacc" ], + "uci": { "turboacc": true } + } + } +} diff --git a/luci-app-turboacc/root/usr/share/rpcd/acl.d/luci-app-turboacc.json b/luci-app-turboacc/root/usr/share/rpcd/acl.d/luci-app-turboacc.json index 5b2e313a..47143888 100644 --- a/luci-app-turboacc/root/usr/share/rpcd/acl.d/luci-app-turboacc.json +++ b/luci-app-turboacc/root/usr/share/rpcd/acl.d/luci-app-turboacc.json @@ -2,9 +2,19 @@ "luci-app-turboacc": { "description": "Grant UCI access for luci-app-turboacc", "read": { + "ubus": { + "file": [ "stat" ], + "luci.turboacc": [ "getSystemFeatures", "getFastPathStat", "getFullConeStat", "getTCPCCAStat" ] + }, + "file": { + "/etc/init.d/qca-nss-ecm": [ "read" ] + }, "uci": [ "turboacc" ] }, "write": { + "ubus": { + "luci": [ "setInitAction" ] + }, "uci": [ "turboacc" ] } } diff --git a/luci-app-turboacc/root/usr/share/ucitrack/luci-app-turboacc.json b/luci-app-turboacc/root/usr/share/ucitrack/luci-app-turboacc.json deleted file mode 100644 index a83f9cd7..00000000 --- a/luci-app-turboacc/root/usr/share/ucitrack/luci-app-turboacc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "config": "turboacc", - "init": "turboacc" -} diff --git a/luci-theme-lightblue/luasrc/view/themes/lightblue/footer.htm b/luci-theme-lightblue/luasrc/view/themes/lightblue/footer.htm index 437bb270..3c73877d 100644 --- a/luci-theme-lightblue/luasrc/view/themes/lightblue/footer.htm +++ b/luci-theme-lightblue/luasrc/view/themes/lightblue/footer.htm @@ -8,7 +8,7 @@ <% local ver = require "luci.version" %>
-
<%= ver.distversion %> © 132lan.ru 2022 
+
<%= ver.distversion %> © 132lan.ru ;<%= os.date("%Y") %> 
diff --git a/luci-theme-merona/luasrc/view/themes/merona/footer.htm b/luci-theme-merona/luasrc/view/themes/merona/footer.htm index c9b1846d..365a21fc 100644 --- a/luci-theme-merona/luasrc/view/themes/merona/footer.htm +++ b/luci-theme-merona/luasrc/view/themes/merona/footer.htm @@ -8,7 +8,7 @@ <% local ver = require "luci.version" %> diff --git a/openwrt-fastfetch/Makefile b/openwrt-fastfetch/Makefile index 6492037b..7569eaef 100644 --- a/openwrt-fastfetch/Makefile +++ b/openwrt-fastfetch/Makefile @@ -5,8 +5,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fastfetch -PKG_VERSION:=2.61.0 -PKG_RELEASE:=3 +PKG_VERSION:=2.62.0 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/fastfetch-cli/fastfetch/tar.gz/$(PKG_VERSION)? diff --git a/sing-box/Makefile b/sing-box/Makefile index 5ca2e921..10c0954b 100644 --- a/sing-box/Makefile +++ b/sing-box/Makefile @@ -5,8 +5,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=sing-box -PKG_VERSION:=1.13.9 -PKG_RELEASE:=13 +PKG_VERSION:=1.13.10 +PKG_RELEASE:=14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/SagerNet/sing-box/tar.gz/v$(PKG_VERSION)?