openwisp-controller
openwisp-controller copied to clipboard
[feature] Add Whois model and basic functionality
This involves:
- Creating WHOIS model with required fields. The fields which are being stored right now are : Organization name, Country, ASN, Timezone, Address, CIDR, Device, last_ip (of device).
- Setting up Maxmind account and database/service for geoip2
As per discussion, we can modify the WhoIs model by creating relation using Device.last_ip - Whois.ip_address:
Benefit:
- Multiple devices can use the same Whois record - fewer API calls.
For deleting orphan records on device deletion, we can use the idea proposed by @pandafy with a slight modification:
- Whenever a device is deleted, check if that ip is not used by other devices or if the data is outdated (X days threshold). If any of the above is True then delete. If both turns out false then do not delete.
- The other devices linked to it will then automatically trigger the lookup again for new details