MCPcopy
hub / github.com/moby/moby / Contains

Method Contains

daemon/libnetwork/network.go:111–122  ·  view source on GitHub ↗

Contains checks whether the ipam master address pool contains [addr].

(addr netip.Addr)

Source from the content-addressed store, hash-verified

109
110// Contains checks whether the ipam master address pool contains [addr].
111func (c *IpamConf) Contains(addr netip.Addr) bool {
112 if c == nil {
113 return false
114 }
115 if c.PreferredPool == "" {
116 return false
117 }
118
119 allowedRange, _ := netiputil.ParseCIDR(c.PreferredPool)
120
121 return allowedRange.Contains(addr)
122}
123
124// IsStatic checks whether the subnet was statically allocated (ie. user-defined).
125func (c *IpamConf) IsStatic() bool {

Callers 15

TestServiceLogsFunction · 0.45
TestContainerLogsFunction · 0.45
doRequestMethod · 0.45
TestVolumeUpdateFunction · 0.45
TestNetworkInspectFunction · 0.45
TestPingHeadFallbackFunction · 0.45
GetTimestampFunction · 0.45
TestExecSocketDeniedFunction · 0.45
TestExecWithCloseStdinFunction · 0.45
TestExecFunction · 0.45

Calls 1

ParseCIDRFunction · 0.92

Tested by 15

TestServiceLogsFunction · 0.36
TestContainerLogsFunction · 0.36
TestVolumeUpdateFunction · 0.36
TestNetworkInspectFunction · 0.36
TestPingHeadFallbackFunction · 0.36
TestExecSocketDeniedFunction · 0.36
TestExecWithCloseStdinFunction · 0.36
TestExecFunction · 0.36
TestExecUserFunction · 0.36
TestDaemonHostGatewayIPFunction · 0.36