function for getting ip