1function getIp(callback) {
2 fetch('https://ipinfo.io/json?token=<your token>', { headers: { 'Accept': 'application/json' }})
3 .then((resp) => resp.json())
4 .catch(() => {
5 return {
6 country: 'us',
7 };
8 })
9 .then((resp) => callback(resp.country));
10}
11