🐶 Sync 2026-04-18 02:04:09

This commit is contained in:
github-actions[bot] committed 2026-04-18 02:04:09 +08:00
1 parent 411261cf2a
commit 50677d77a8
207 files changed
+3148 -3426

No files matched your search

+5 -3
View File
@@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk
LUCI_TITLE:=luci for haproxy and shadowsocks
LUCI_DEPENDS:=+haproxy
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-haproxy-tcp
PKG_VERSION=1.4
PKG_RELEASE:=1
PKG_MAINTAINER:=Alex Zhuo <1886090@gmail.com>
PKG_RELEASE:=2
include $(TOPDIR)/feeds/luci/luci.mk
PKG_MAINTAINER:=Alex Zhuo <1886090@gmail.com>
define Package/$(PKG_NAME)/postinst
#!/bin/sh
@@ -24,4 +24,6 @@ echo stopping haproxy
echo haproxy disabled
endef
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
@@ -1,9 +1,9 @@
module("luci.controller.haproxy", package.seeall)
function index()
if not nixio.fs.access("/etc/config/haproxy") then
return
end
local page = entry({"admin", "services", "haproxy"}, cbi("haproxy"), _("HAProxy"))
page.dependent = true
page.acl_depends = { "luci-app-haproxy-tcp" }
end
if not nixio.fs.access("/etc/config/haproxy") then
return
end
entry({"admin", "services", "haproxy"}, cbi("haproxy"), _("HAProxy")).dependent = true
end
@@ -16,11 +16,11 @@ if haproxy_on then
else
state_msg = "<b><font color=\"red\">" .. translate("Not running") .. "</font></b>"
end
m=Map("haproxy",translate("HAProxy"),translate("HAProxy能够检测Shadowsocks服务器的连通情况,从而实现负载均衡和高可用的功能,支持主备用服务器宕机自动切换,并且可以设置多个主服务器用于分流,规定每个分流节点的流量比例等。前提条件是你的所有Shadowsocks服务器的【加密方式】和【密码】一致。<br><br>使用方法:配置好你的Shadowsocks服务器ip地址和端口,然后开启Shadowsocks服务,将服务器地址填写为【127.0.0.1】,端口【2222】,其他参数和之前一样即可,你可以通过访问【路由器的IP:1111/haproxy】输入用户名admin,密码root来观察各节点健康状况,红色为宕机,绿色正常,使用说明请<a href='http://www.right.com.cn/forum/thread-198649-1-1.html'>点击这里</a>") .. "<br><br>后台监控页面:<a href='http://" .. router_ip .. ":1111/haproxy'>" .. router_ip .. ":1111/haproxy</a> 用户名admin,密码root" .. "<br><br>状态 - " .. state_msg)
s=m:section(TypedSection,"arguments","")
s.addremove=false
s.anonymous=true
view_enable = s:option(Flag,"enabled",translate("Enable"))
m = Map("haproxy", translate("HAProxy"), translate("HAProxy能够检测Shadowsocks服务器的连通情况,从而实现负载均衡和高可用的功能,支持主备用服务器宕机自动切换,并且可以设置多个主服务器用于分流,规定每个分流节点的流量比例等。前提条件是你的所有Shadowsocks服务器的【加密方式】和【密码】一致。<br><br>使用方法:配置好你的Shadowsocks服务器ip地址和端口,然后开启Shadowsocks服务,将服务器地址填写为【127.0.0.1】,端口【2222】,其他参数和之前一样即可,你可以通过访问【路由器的IP:1111/haproxy】输入用户名admin,密码root来观察各节点健康状况,红色为宕机,绿色正常,使用说明请<a href='http://www.right.com.cn/forum/thread-198649-1-1.html'>点击这里</a>") .. "<br><br>后台监控页面:<a href='http://" .. router_ip .. ":1111/haproxy'>" .. router_ip .. ":1111/haproxy</a> 用户名admin,密码root" .. "<br><br>状态 - " .. state_msg)
s = m:section(TypedSection,"arguments","")
s.addremove = false
s.anonymous = true
view_enable = s:option(Flag, "enabled", translate("Enable"))
--通过读写配置文件控制HAProxy这种方式已经弃用
--view_cfg = s:option(TextValue, "1", nil)
--view_cfg.rmempty = false
@@ -32,36 +32,37 @@ s=m:section(TypedSection,"arguments","")
--function view_cfg.write(self, section, value)
-- sync_value_to_file(value, "/etc/haproxy.cfg")
--end
s=m:section(TypedSection,"main_server","<b>" .. translate("Main Server List") .. "<b>")
s.anonymous=true
s.addremove=true
o=s:option(Value,"server_name",translate("Display Name"),translate("Only English Characters,No spaces"))
s = m:section(TypedSection, "main_server","<b>" .. translate("Main Server List") .. "<b>")
s.anonymous = true
s.addremove = true
o = s:option(Value, "server_name", translate("Display Name"), translate("Only English Characters,No spaces"))
o.rmempty = false
o=s:option(Flag,"validate",translate("validate"))
o = s:option(Flag,"validate",translate("validate"))
o=s:option(Value,"server_ip",translate("Proxy Server IP"))
o = s:option(Value, "server_ip", translate("Proxy Server IP"))
o=s:option(Value,"server_port",translate("Proxy Server Port"))
o.datatype="uinteger"
o=s:option(Value,"server_weight",translate("Weight"))
o.datatype="uinteger"
o = s:option(Value, "server_port", translate("Proxy Server Port"))
o.datatype = "uinteger"
o = s:option(Value, "server_weight", translate("Weight"))
o.datatype = "uinteger"
s=m:section(TypedSection,"backup_server","<b>" .. translate("Backup Server List") .. "<b>")
s.anonymous=true
s.addremove=true
o=s:option(Value,"server_name",translate("Display Name"),translate("Only English Characters,No spaces"))
s = m:section(TypedSection,"backup_server","<b>" .. translate("Backup Server List") .. "<b>")
s.anonymous = true
s.addremove = true
o = s:option(Value, "server_name", translate("Display Name"), translate("Only English Characters,No spaces"))
o.rmempty = false
o=s:option(Flag,"validate",translate("validate"))
o = s:option(Flag, "validate", translate("validate"))
o=s:option(Value,"server_ip",translate("Proxy Server IP"))
o = s:option(Value, "server_ip", translate("Proxy Server IP"))
o=s:option(Value,"server_port",translate("Proxy Server Port"))
o.datatype="uinteger"
o = s:option(Value, "server_port", translate("Proxy Server Port"))
o.datatype = "uinteger"
-- ---------------------------------------------------
local apply = luci.http.formvalue("cbi.apply")
if apply then
os.execute("/etc/haproxy_init.sh restart >/dev/null 2>&1 &")
end
return m
-1
View File
@@ -1 +0,0 @@
zh_Hans
@@ -0,0 +1,34 @@
msgid "Running"
msgstr "运行中"
msgid "Not running"
msgstr "未运行"
msgid "Main Server List"
msgstr "主服务器列表"
msgid "Display Name"
msgstr "服务器名称"
msgid "Only English Characters,No spaces"
msgstr "仅限英文字母,不要有空格"
msgid "Proxy Server IP"
msgstr "代理服务器IP或域名"
msgid "Proxy Server Port"
msgstr "代理服务器端口"
msgid "Weight"
msgstr "分流权重"
msgid "Backup Server List"
msgstr "备用服务器列表"
msgid "validate"
msgstr "生效"
+1
View File
@@ -0,0 +1 @@
zh-cn
@@ -1,69 +0,0 @@
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"
#: luasrc/model/cbi/haproxy.lua:50
msgid "Backup Server List"
msgstr "备用服务器列表"
#: luasrc/model/cbi/haproxy.lua:38 luasrc/model/cbi/haproxy.lua:53
msgid "Display Name"
msgstr "服务器名称"
#: luasrc/model/cbi/haproxy.lua:23
msgid "Enable"
msgstr ""
#: luasrc/controller/haproxy.lua:6 luasrc/model/cbi/haproxy.lua:19
msgid "HAProxy"
msgstr ""
#: luasrc/model/cbi/haproxy.lua:19
msgid ""
"HAProxy能够检测Shadowsocks服务器的连通情况,从而实现负载均衡和高可用的功能,"
"支持主备用服务器宕机自动切换,并且可以设置多个主服务器用于分流,规定每个分流"
"节点的流量比例等。前提条件是你的所有Shadowsocks服务器的【加密方式】和【密码】"
"一致。<br><br>使用方法:配置好你的Shadowsocks服务器ip地址和端口,然后开启"
"Shadowsocks服务,将服务器地址填写为【127.0.0.1】,端口【2222】,其他参数和之"
"前一样即可,你可以通过访问【路由器的IP:1111/haproxy】输入用户名admin,密码"
"root来观察各节点健康状况,红色为宕机,绿色正常,使用说明请<a href='http://www."
"right.com.cn/forum/thread-198649-1-1.html'>点击这里</a>"
msgstr ""
#: luasrc/model/cbi/haproxy.lua:35
msgid "Main Server List"
msgstr "主服务器列表"
#: luasrc/model/cbi/haproxy.lua:17
msgid "Not running"
msgstr "未运行"
#: luasrc/model/cbi/haproxy.lua:38 luasrc/model/cbi/haproxy.lua:53
msgid "Only English Characters,No spaces"
msgstr "仅限英文字母,不要有空格"
#: luasrc/model/cbi/haproxy.lua:43 luasrc/model/cbi/haproxy.lua:58
msgid "Proxy Server IP"
msgstr "代理服务器IP或域名"
#: luasrc/model/cbi/haproxy.lua:45 luasrc/model/cbi/haproxy.lua:60
msgid "Proxy Server Port"
msgstr "代理服务器端口"
#: luasrc/model/cbi/haproxy.lua:15
msgid "Running"
msgstr "运行中"
#: luasrc/model/cbi/haproxy.lua:47
msgid "Weight"
msgstr "分流权重"
#: luasrc/model/cbi/haproxy.lua:41 luasrc/model/cbi/haproxy.lua:56
msgid "validate"
msgstr "生效"
@@ -22,10 +22,10 @@ start(){
log 127.0.0.1 local0 #[日志输出配置,所有日志都记录在本机,通过local0输出]
log 127.0.0.1 local1 notice #定义haproxy 日志级别[error warringinfo debug]
daemon #以后台形式运行harpoxy
nbproc 1 #设置进程数量
#nbproc 1 #设置进程数量
pidfile /var/run/haproxy.pid
ulimit-n 1024 #ulimit 的数量限制
maxconn 1024 #默认最大连接数,需考虑ulimit-n限制
#ulimit-n 1024 #ulimit 的数量限制
#maxconn 2048 #默认最大连接数,需考虑ulimit-n限制
#chroot /usr/local/haproxy
defaults
log global
@@ -130,4 +130,4 @@ restart(){
else
stop;
fi
}
}