remove merging new ips and old ones in ip log

This commit is contained in:
Hossin Asaadi
2022-10-30 14:24:33 -04:00
parent e0abaf5044
commit beacad3168

View File

@@ -179,11 +179,7 @@ func addInboundClientIps(clientEmail string,ips []string) error {
}
func updateInboundClientIps(inboundClientIps *model.InboundClientIps,clientEmail string,ips []string) error {
var oldIps []string
err := json.Unmarshal([]byte(inboundClientIps.Ips), &oldIps)
mergedIps := Unique(append(oldIps, ips...))
jsonIps, err := json.Marshal(mergedIps)
jsonIps, err := json.Marshal(ips)
checkError(err)
inboundClientIps.ClientEmail = clientEmail
@@ -199,7 +195,7 @@ func updateInboundClientIps(inboundClientIps *model.InboundClientIps,clientEmail
limitIp, err := strconv.Atoi(limitIpMactch)
if(limitIp < len(mergedIps) && limitIp != 0 && inbound.Enable) {
if(limitIp < len(ips) && limitIp != 0 && inbound.Enable) {
DisableInbound(inbound.Id)
}