#/bin/bash

# 国内
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="120.232.213.0/24" port port="1066" protocol="tcp" accept'
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="120.232.214.0/24" port port="1066" protocol="tcp" accept'
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="120.233.15.0/24" port port="1066" protocol="tcp" accept'
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="120.233.71.0/24" port port="1066" protocol="tcp" accept'
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="120.240.163.0/24" port port="1066" protocol="tcp" accept'

# 香港
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="103.8.215.0/24" port port="1066" protocol="tcp" accept'
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="206.238.224.0/24" port port="1066" protocol="tcp" accept'
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="206.238.226.0/24" port port="1066" protocol="tcp" accept'
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="156.230.62.0/24" port port="1066" protocol="tcp" accept'
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="154.89.0.0/24" port port="1066" protocol="tcp" accept'

# 台湾
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="38.123.161.0/24" port port="1066" protocol="tcp" accept'

# 新加坡
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="206.238.154.0/24" port port="1066" protocol="tcp" accept'
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="38.110.230.0/24" port port="1066" protocol="tcp" accept'

# 日本
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="38.110.231.0/24" port port="1066" protocol="tcp" accept'

# 德国
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="38.123.160.0/24" port port="1066" protocol="tcp" accept'

# 美国
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="206.238.225.0/24" port port="1066" protocol="tcp" accept'
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="206.238.229.0/24" port port="1066" protocol="tcp" accept'
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="38.83.16.0/24" port port="1066" protocol="tcp" accept'

# 私网
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.0.0/16" port port="1066" protocol="tcp" accept'
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="172.16.0.0/16" port port="1066" protocol="tcp" accept'
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.0.0.0/8" port port="1066" protocol="tcp" accept'

# 重新加载防火墙规则
firewall-cmd --permanent --remove-service=ssh
firewall-cmd --permanent --remove-port=1066/tcp
firewall-cmd --reload
