MCPcopy Index your code
hub / github.com/docker/cli / subnetMatches

Function subnetMatches

cli/command/network/create.go:254–272  ·  view source on GitHub ↗
(subnet, data string)

Source from the content-addressed store, hash-verified

252}
253
254func subnetMatches(subnet, data string) (bool, error) {
255 var ip net.IP
256
257 _, s, err := net.ParseCIDR(subnet)
258 if err != nil {
259 return false, fmt.Errorf("invalid subnet: %w", err)
260 }
261
262 if strings.Contains(data, "/") {
263 ip, _, err = net.ParseCIDR(data)
264 if err != nil {
265 return false, err
266 }
267 } else {
268 ip = net.ParseIP(data)
269 }
270
271 return s.Contains(ip), nil
272}

Callers 1

createIPAMConfigFunction · 0.85

Calls 1

ContainsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…