Is the provided IP in one of the provided CIDRs? Returns the CIDR that matches
(self, ip, cidrs)
| 251 | return False |
| 252 | |
| 253 | def find_cidr(self, ip, cidrs): |
| 254 | """ |
| 255 | Is the provided IP in one of the provided CIDRs? |
| 256 | Returns the CIDR that matches |
| 257 | """ |
| 258 | try: |
| 259 | if isinstance(ip, str): |
| 260 | local_ip = IPAddress(ip) |
| 261 | else: |
| 262 | local_ip = ip |
| 263 | |
| 264 | for network in cidrs: |
| 265 | if local_ip in network: |
| 266 | return network |
| 267 | except: |
| 268 | return None |
| 269 | |
| 270 | return None |
| 271 | |
| 272 | def is_aws_ip(self, ip): |
| 273 | """ |