Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
tbblgm119
lede
提交
8bef369d
L
lede
项目概览
tbblgm119
/
lede
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
lede
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8bef369d
编写于
5月 31, 2019
作者:
L
LEAN-ESX
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
luci-app-accesscontrol: add strict mode support
上级
c3a80af0
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
44 addition
and
2 deletion
+44
-2
package/lean/luci-app-accesscontrol/Makefile
package/lean/luci-app-accesscontrol/Makefile
+1
-1
package/lean/luci-app-accesscontrol/luasrc/controller/mia.lua
...age/lean/luci-app-accesscontrol/luasrc/controller/mia.lua
+7
-1
package/lean/luci-app-accesscontrol/luasrc/model/cbi/mia.lua
package/lean/luci-app-accesscontrol/luasrc/model/cbi/mia.lua
+5
-0
package/lean/luci-app-accesscontrol/luasrc/view/mia/mia_status.htm
...ean/luci-app-accesscontrol/luasrc/view/mia/mia_status.htm
+22
-0
package/lean/luci-app-accesscontrol/po/zh-cn/mia.po
package/lean/luci-app-accesscontrol/po/zh-cn/mia.po
+6
-0
package/lean/luci-app-accesscontrol/root/etc/init.d/mia
package/lean/luci-app-accesscontrol/root/etc/init.d/mia
+3
-0
未找到文件。
package/lean/luci-app-accesscontrol/Makefile
浏览文件 @
8bef369d
...
...
@@ -11,7 +11,7 @@ LUCI_DEPENDS:=
LUCI_PKGARCH
:=
all
PKG_NAME
:=
luci-app-accesscontrol
PKG_VERSION
:=
1
PKG_RELEASE
:=
9
PKG_RELEASE
:=
11
include
$(TOPDIR)/feeds/luci/luci.mk
...
...
package/lean/luci-app-accesscontrol/luasrc/controller/mia.lua
浏览文件 @
8bef369d
...
...
@@ -6,7 +6,13 @@ function index()
end
entry
({
"admin"
,
"services"
,
"mia"
},
cbi
(
"mia"
),
_
(
"Internet Access Schedule Control"
),
30
).
dependent
=
true
entry
({
"admin"
,
"services"
,
"mia"
,
"status"
},
call
(
"act_status"
)).
leaf
=
true
end
function
act_status
()
local
e
=
{}
e
.
running
=
luci
.
sys
.
call
(
"iptables -L INPUT |grep MIA >/dev/null"
)
==
0
luci
.
http
.
prepare_content
(
"application/json"
)
luci
.
http
.
write_json
(
e
)
end
package/lean/luci-app-accesscontrol/luasrc/model/cbi/mia.lua
浏览文件 @
8bef369d
a
=
Map
(
"mia"
,
translate
(
"Internet Access Schedule Control"
),
translate
(
"Access Schedule Control Settins"
))
a
:
section
(
SimpleSection
).
template
=
"mia/mia_status"
t
=
a
:
section
(
TypedSection
,
"basic"
)
t
.
anonymous
=
true
...
...
@@ -7,6 +8,10 @@ t.anonymous=true
e
=
t
:
option
(
Flag
,
"enable"
,
translate
(
"Enabled"
))
e
.
rmempty
=
false
e
=
t
:
option
(
Flag
,
"strict"
,
translate
(
"Strict Mode"
))
e
.
rmempty
=
false
e
.
description
=
translate
(
"Strict Mode will degrade CPU performance, but it can achieve better results"
)
t
=
a
:
section
(
TypedSection
,
"macbind"
,
translate
(
"Client Rules"
))
t
.
template
=
"cbi/tblsection"
t
.
anonymous
=
true
...
...
package/lean/luci-app-accesscontrol/luasrc/view/mia/mia_status.htm
0 → 100644
浏览文件 @
8bef369d
<script
type=
"text/javascript"
>
//
<!
[
CDATA
[
XHR
.
poll
(
3
,
'
<%=url([[admin]], [[services]], [[mia]], [[status]])%>
'
,
null
,
function
(
x
,
data
)
{
var
tb
=
document
.
getElementById
(
'
mia_status
'
);
if
(
data
&&
tb
)
{
if
(
data
.
running
)
{
var
links
=
'
<em><b><font color=green><%:Internet Access Schedule Control%> <%:RUNNING%></font></b></em>
'
;
tb
.
innerHTML
=
links
;
}
else
{
tb
.
innerHTML
=
'
<em><b><font color=red><%:Internet Access Schedule Control%> <%:NOT RUNNING%></font></b></em>
'
;
}
}
}
);
//]]>
</script>
<style>
.mar-10
{
margin-left
:
50px
;
margin-right
:
10px
;}
</style>
<fieldset
class=
"cbi-section"
>
<p
id=
"mia_status"
>
<em><
%
:Collecting
data...
%
></em>
</p>
</fieldset>
package/lean/luci-app-accesscontrol/po/zh-cn/mia.po
浏览文件 @
8bef369d
...
...
@@ -7,6 +7,12 @@ msgstr "设置客户端禁止访问互联网的时间"
msgid "General switch"
msgstr "开启/关闭"
msgid "Strict Mode"
msgstr "严格模式"
msgid "Strict Mode will degrade CPU performance, but it can achieve better results"
msgstr "严格模式会损耗部分CPU资源,但可以按照时间规则立即拦截数据包,效果更好"
msgid "Client Rules"
msgstr "客户端规则"
...
...
package/lean/luci-app-accesscontrol/root/etc/init.d/mia
浏览文件 @
8bef369d
...
...
@@ -73,9 +73,12 @@ start(){
iptables
-I
INPUT
-p
tcp
--dport
53
-m
comment
--comment
"Rule For Control"
-j
MIA
iptables
-t
nat
-A
PREROUTING
-p
udp
--dport
53
-j
REDIRECT
--to-ports
53
-m
comment
--comment
"Rule For Control"
iptables
-t
nat
-A
PREROUTING
-p
tcp
--dport
53
-j
REDIRECT
--to-ports
53
-m
comment
--comment
"Rule For Control"
strict
=
$(
uci get mia.@basic[0].strict
)
[
$strict
-eq
1
]
&&
iptables
-t
filter
-I
FORWARD
-m
comment
--comment
"Rule For Control"
-j
MIA
add_rule
}
stop
(){
iptables
-t
filter
-D
FORWARD
-m
comment
--comment
"Rule For Control"
-j
MIA 2>/dev/null
iptables
-D
INPUT
-p
udp
--dport
53
-m
comment
--comment
"Rule For Control"
-j
MIA 2>/dev/null
iptables
-D
INPUT
-p
tcp
--dport
53
-m
comment
--comment
"Rule For Control"
-j
MIA 2>/dev/null
iptables
-t
nat
-D
PREROUTING
-p
udp
--dport
53
-j
REDIRECT
--to-ports
53
-m
comment
--comment
"Rule For Control"
2>/dev/null
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录