feat: Add exclusion list // act by cline(gpt-4o)

This commit is contained in:
sang 2025-02-10 15:23:23 +08:00
parent 3cf711596a
commit ce88d1d012
2 changed files with 20 additions and 0 deletions

View File

@ -96,6 +96,12 @@ fw_net_interface_changed() {
update_lxc_iptags() {
vmid_list=$(pct list 2>/dev/null | grep -v VMID | awk '{print $1}')
for vmid in ${vmid_list}; do
# Check if the container ID is in the exclusion list
if [[ " ${EXCLUSION_LIST[*]} " == *" ${vmid} "* ]]; then
echo "Skipping ${vmid} as it is in the exclusion list"
continue
fi
last_tagged_ips=()
current_valid_ips=()
next_tags=()
@ -113,6 +119,12 @@ update_lxc_iptags() {
# Get current IPs
current_ips_full=$(lxc-info -n "${vmid}" -i | awk '{print $2}')
for ip in ${current_ips_full}; do
# Check if the IP is in the exclusion list
if [[ " ${EXCLUSION_LIST[*]} " == *" ${ip} "* ]]; then
echo "Skipping IP ${ip} for container ${vmid} as it is in the exclusion list"
continue
fi
if is_valid_ipv4 "${ip}" && ip_in_cidrs "${ip}" "${CIDR_LIST[*]}"; then
current_valid_ips+=("${ip}")
next_tags+=("${ip}")

View File

@ -7,3 +7,11 @@ LOOP_INTERVAL=60
FW_NET_INTERFACE_CHECK_INTERVAL=60
LXC_STATUS_CHECK_INTERVAL=-1
FORCE_UPDATE_INTERVAL=1800
# Exclusion list for IPs or container IDs
EXCLUSION_LIST=(
# Add IPs or container IDs here
# Example:
# 192.168.1.100
# container_id_1
)