mirror of
https://gitee.com/fit2cloud-feizhiyun/1Panel.git
synced 2024-12-05 21:38:26 +08:00
fix: 解决防火墙筛选失效的问题 (#5677)
This commit is contained in:
parent
08125b150a
commit
9a38dcd2a7
@ -96,7 +96,10 @@ func (u *FirewallService) SearchWithPage(req dto.RuleSearch) (int64, interface{}
|
||||
|
||||
if len(req.Info) != 0 {
|
||||
for _, addr := range rules {
|
||||
if strings.Contains(addr.Address, req.Info) {
|
||||
if strings.Contains(addr.Address, req.Info) ||
|
||||
strings.Contains(addr.Port, req.Info) ||
|
||||
strings.Contains(addr.TargetPort, req.Info) ||
|
||||
strings.Contains(addr.TargetIP, req.Info) {
|
||||
datas = append(datas, addr)
|
||||
}
|
||||
}
|
||||
|
@ -129,6 +129,12 @@ func (f *Firewall) ListForward() ([]FireInfo, error) {
|
||||
})
|
||||
if ForwardListRegex.MatchString(line) {
|
||||
match := ForwardListRegex.FindStringSubmatch(line)
|
||||
if len(match) < 4 {
|
||||
continue
|
||||
}
|
||||
if len(match[4]) == 0 {
|
||||
match[4] = "127.0.0.1"
|
||||
}
|
||||
datas = append(datas, FireInfo{
|
||||
Port: match[1],
|
||||
Protocol: match[2],
|
||||
|
@ -115,7 +115,13 @@ func (f *Ufw) ListForward() ([]FireInfo, error) {
|
||||
|
||||
var list []FireInfo
|
||||
for _, rule := range rules {
|
||||
dest := strings.SplitN(rule.DestPort, ":", 2)
|
||||
dest := strings.Split(rule.DestPort, ":")
|
||||
if len(dest) < 2 {
|
||||
continue
|
||||
}
|
||||
if len(dest[0]) == 0 {
|
||||
dest[0] = "127.0.0.1"
|
||||
}
|
||||
list = append(list, FireInfo{
|
||||
Num: rule.Num,
|
||||
Protocol: rule.Protocol,
|
||||
|
@ -44,12 +44,7 @@
|
||||
<el-table-column type="selection" fix />
|
||||
<el-table-column :label="$t('commons.table.protocol')" :min-width="70" prop="protocol" />
|
||||
<el-table-column :label="$t('firewall.sourcePort')" :min-width="70" prop="port" />
|
||||
<el-table-column :min-width="80" :label="$t('firewall.targetIP')" prop="targetIP">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.targetIP">{{ row.targetIP }}</span>
|
||||
<span v-else>127.0.0.1</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :min-width="80" :label="$t('firewall.targetIP')" prop="targetIP" />
|
||||
<el-table-column :label="$t('firewall.targetPort')" :min-width="70" prop="targetPort" />
|
||||
<fu-table-operations
|
||||
width="200px"
|
||||
|
Loading…
Reference in New Issue
Block a user