parseNetworkSubnets extracts and parses subnet configurations from IPAM config
(ipamConfigs []IPAMConfig)
| 1092 | |
| 1093 | // parseNetworkSubnets extracts and parses subnet configurations from IPAM config |
| 1094 | func parseNetworkSubnets(ipamConfigs []IPAMConfig) []*net.IPNet { |
| 1095 | var subnets []*net.IPNet |
| 1096 | for _, config := range ipamConfigs { |
| 1097 | if config.Subnet != "" { |
| 1098 | _, subnet, err := net.ParseCIDR(config.Subnet) |
| 1099 | if err != nil { |
| 1100 | log.L.WithError(err).Warnf("failed to parse subnet %q", config.Subnet) |
| 1101 | continue |
| 1102 | } |
| 1103 | subnets = append(subnets, subnet) |
| 1104 | } |
| 1105 | } |
| 1106 | return subnets |
| 1107 | } |
| 1108 | |
| 1109 | // isUsableInterface checks if a network interface is usable (not loopback and interface is up) |
| 1110 | func isUsableInterface(iface *native.NetInterface) bool { |
no outgoing calls
no test coverage detected
searching dependent graphs…