move getIP func where it can be used globally