There are few ip quality service providers. Use their API and u r good to go. Im no coder so i cant be more specific. But before i knew that it is called cloaking (years and years ago and before Shadowmaster came around) i built first cloaker on simple htaccess (but it was for google and doorway pages).Where do you get the ips?
Also updating them.