Skip to content

Instantly share code, notes, and snippets.

@leozhang2018
Last active June 4, 2016 03:59
Show Gist options
  • Save leozhang2018/6327e0deecce0154740cf6745892efbf to your computer and use it in GitHub Desktop.
Save leozhang2018/6327e0deecce0154740cf6745892efbf to your computer and use it in GitHub Desktop.
Get CN_IPv4 from APNIC
# Get CN_IPv4 from APNIC
function CurlIptable(){
## 指定作用域分隔符为 '|',同时计算子网掩码位数之后进行拼接(http://www.cnblogs.com/ggjucheng/archive/2013/01/13/2858470.html)
curl $Delegated_apnic_latest_URL | grep 'apnic|CN|ipv4' | awk -F '|' '/CN/&&/ipv4/ {print "iptables -t nat -I SHADOWSOCKS -d " $4 "/" 32-log($5)/log(2) " -j RETURN" }'|cat > $save_to_file
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment