MCPcopy
hub / github.com/Hackl0us/GeoIP2-CN / parseCIDRs

Function parseCIDRs

ip2cidr.go:8–20  ·  view source on GitHub ↗
(txtList []string)

Source from the content-addressed store, hash-verified

6)
7
8func parseCIDRs(txtList []string) []*net.IPNet {
9 var networkList = make([]*net.IPNet,0, 50)
10 for _, cidrTxt := range txtList {
11 _,network, err := net.ParseCIDR(cidrTxt)
12 if err != nil || network == nil {
13 log.Printf("%s fail to parse to CIDR\n", cidrTxt)
14 continue
15 }
16 networkList = append(networkList, network)
17 }
18
19 return networkList
20}

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected