mirror of https://gitgud.io/fatchan/jschan.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
984 B
29 lines
984 B
'use strict';
|
|
|
|
const countries = require('i18n-iso-countries')
|
|
, countryNamesMap = countries.getNames('en')
|
|
, extraCountryCodes = ['EU', 'XX', 'T1']
|
|
, anonymizerCountryCodes = ['TOR', 'LOKI']
|
|
, anonymizerCountryCodesSet = new Set(anonymizerCountryCodes)
|
|
, countryCodes = Object.keys(countryNamesMap)
|
|
.concat(extraCountryCodes, anonymizerCountryCodes);
|
|
|
|
//this dumb library conveniently includes 2 names for some countries...
|
|
Object.entries(countryNamesMap)
|
|
.filter(e => Array.isArray(e[1])) //for any country with an array of names,
|
|
.forEach(c => countryNamesMap[c[0]] = c[1][0]) //use the first name
|
|
|
|
countryNamesMap['EU'] = 'Europe';
|
|
countryNamesMap['XX'] = 'Unknown';
|
|
countryNamesMap['T1'] = 'Tor Exit Node';
|
|
countryNamesMap['TOR'] = 'Tor Hidden Service';
|
|
countryNamesMap['LOKI'] = 'Lokinet SNApp';
|
|
|
|
module.exports = {
|
|
countryNamesMap,
|
|
countryCodes,
|
|
countryCodesSet: new Set(countryCodes),
|
|
isAnonymizer: (code) => {
|
|
return anonymizerCountryCodesSet.has(code);
|
|
},
|
|
}
|
|
|