mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-11 22:00:25 +08:00
优化iptables+firewall-cmd找不到时的提示
This commit is contained in:
@@ -20,6 +20,8 @@ type FirewalldAction struct {
|
||||
BaseAction
|
||||
|
||||
config *firewallconfigs.FirewallActionFirewalldConfig
|
||||
|
||||
firewalldNotFound bool
|
||||
}
|
||||
|
||||
func NewFirewalldAction() *FirewalldAction {
|
||||
@@ -82,6 +84,10 @@ func (this *FirewalldAction) runActionSingleIP(action string, listType IPListTyp
|
||||
if len(path) == 0 {
|
||||
path, err = exec.LookPath("firewall-cmd")
|
||||
if err != nil {
|
||||
if this.firewalldNotFound {
|
||||
return nil
|
||||
}
|
||||
this.firewalldNotFound = true
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ type IPTablesAction struct {
|
||||
BaseAction
|
||||
|
||||
config *firewallconfigs.FirewallActionIPTablesConfig
|
||||
|
||||
iptablesNotFound bool
|
||||
}
|
||||
|
||||
func NewIPTablesAction() *IPTablesAction {
|
||||
@@ -77,6 +79,10 @@ func (this *IPTablesAction) runActionSingleIP(action string, listType IPListType
|
||||
if len(path) == 0 {
|
||||
path, err = exec.LookPath("iptables")
|
||||
if err != nil {
|
||||
if this.iptablesNotFound {
|
||||
return nil
|
||||
}
|
||||
this.iptablesNotFound = true
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user