mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 08:19:15 +08:00
parent
bca9777a43
commit
6b1cc1088e
@ -233,6 +233,7 @@ func (u *FirewallService) OperatePortRule(req dto.PortRuleOperate, reload bool)
|
|||||||
}(req)
|
}(req)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
wg.Wait()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if req.Protocol == "tcp/udp" {
|
if req.Protocol == "tcp/udp" {
|
||||||
@ -314,20 +315,20 @@ func (u *FirewallService) OperateAddressRule(req dto.AddrRuleOperate, reload boo
|
|||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
addressList := strings.Split(req.Address, ",")
|
addressList := strings.Split(req.Address, ",")
|
||||||
for _, addr := range addressList {
|
for i := 0; i < len(addressList); i++ {
|
||||||
if len(addr) == 0 {
|
if len(addressList[i]) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fireInfo.Address = addr
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(req dto.AddrRuleOperate) {
|
go func(addr string) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
fireInfo.Address = addr
|
||||||
if err := client.RichRules(fireInfo, req.Operation); err != nil {
|
if err := client.RichRules(fireInfo, req.Operation); err != nil {
|
||||||
global.LOG.Errorf("%s address %s failed (strategy: %s), err: %v", req.Operation, req.Address, req.Strategy, err)
|
global.LOG.Errorf("%s address %s failed (strategy: %s), err: %v", req.Operation, addr, req.Strategy, err)
|
||||||
}
|
}
|
||||||
req.Address = fireInfo.Address
|
req.Address = addr
|
||||||
_ = u.addAddressRecord(req)
|
_ = u.addAddressRecord(req)
|
||||||
}(req)
|
}(addressList[i])
|
||||||
}
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
if reload {
|
if reload {
|
||||||
@ -397,6 +398,7 @@ func (u *FirewallService) BatchOperateRule(req dto.BatchRuleOperate) error {
|
|||||||
_ = u.OperateAddressRule(item, false)
|
_ = u.OperateAddressRule(item, false)
|
||||||
}(itemRule)
|
}(itemRule)
|
||||||
}
|
}
|
||||||
|
wgBatch.Wait()
|
||||||
return client.Reload()
|
return client.Reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user