判断某个ip是否属于某个网段

``` package main import ( "fmt" "strconv" "strings" ) func main() { fmt.Println(isBelong(`10.187.102.8`, `10.187.102.0/24`)) } func isBelong(ip, cidr string) bool { ipAddr := strings.Split(ip, `.`) if len(ipAddr) < 4 { re...阅读全文

2017-11-08 09:11:50