You can take a look at https://github.com/M-itch/libcod/blo...libcod.cpp#L52
Mostly self-explaining, you get a reference to the cvar and can just compare the current IP with the list of cvar ips. I don't see a huge performance issue, but if needed, you could of course optimize it (mostly overcomplicating here).