<commit_before>Meteor.methods({
  'phoneformat.getCountryForIp': function () {
    var response = null;

    if (Phoneformat.token) {
      response = HTTP.get('https://ipinfo.io?token=' + Phoneformat.token);
    } else {
      response = HTTP.get('http://ipinfo.io');
    }

    return response.data && response.data.country;
  }
});

Phoneformat = {};

Phoneformat.configure = function (options) {
  options = options || {};

  Phoneformat.token = options.token;
};<commit_msg>Lookup info for the client's IP address, not the server's<commit_after>Meteor.methods({
  'phoneformat.getCountryForIp': function () {
    var response = null;

    // Lookup info for the client's IP address, not the server's
    var clientIP = this.connection.clientAddress;

    // If phoneformat is configured with a token, do the look up over https
    if (Phoneformat.token) {
      response = HTTP.get('https://ipinfo.io/' + clientIP + '?token=' + Phoneformat.token);
    } else {
      response = HTTP.get('http://ipinfo.io/' + clientIP);
    }

    return response.data && response.data.country;
  }
});

Phoneformat = {};

// Configure phoneformat to use https with a token
Phoneformat.configure = function (options) {
  options = options || {};

  Phoneformat.token = options.token;
};
{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.0, 'mean_word_length': 3.3220338983050848, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6660192', 'n_tokens_mistral': 388, 'n_tokens_neox': 374, 'n_words': 96}