Contains checks whether the ipam master address pool contains [addr].
(addr netip.Addr)
| 109 | |
| 110 | // Contains checks whether the ipam master address pool contains [addr]. |
| 111 | func (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). |
| 125 | func (c *IpamConf) IsStatic() bool { |