You can maintain database for mapping of IP address to country and check on each request to determine the country associated with IP address.
As IP address's are always assigned country-wise so you wont face any problems following this approach,make sure you update this database from time to time.