{"analyzedAt":"2022-12-19T06:29:19.369Z","collected":{"metadata":{"name":"ac-geoip","scope":"unscoped","version":"3.0.0","description":"Lookup IP addresses at Maxmind GEOIP services or local Maxmind (Geolite) database and prepare the response with custom field mapping. Optionally, you can store the response in Redis to improve performance (of your app).","date":"2022-12-18T09:59:40.165Z","author":{"name":"Mark Poepping","url":"https://www.admiralcloud.com"},"publisher":{"username":"admiralcloud","email":"hostmaster@admiralcloud.com"},"maintainers":[{"username":"admiralcloud","email":"hostmaster@admiralcloud.com"}],"repository":{"type":"git","url":"git+https://github.com/admiralcloud/ac-geoip.git"},"links":{"npm":"https://www.npmjs.com/package/ac-geoip","homepage":"https://github.com/admiralcloud/ac-geoip#readme","repository":"https://github.com/admiralcloud/ac-geoip","bugs":"https://github.com/admiralcloud/ac-geoip/issues"},"license":"MIT","dependencies":{"@maxmind/geoip2-node":"^3.5.0","ip":"^1.1.8","lodash":"^4.17.21","node-cache":"^5.1.2"},"devDependencies":{"ac-semantic-release":"^0.3.4","chai":"^4.3.7","eslint":"^8.30.0","ioredis":"^5.2.4","mocha":"^10.2.0"},"releases":[{"from":"2022-11-19T00:00:00.000Z","to":"2022-12-19T00:00:00.000Z","count":2},{"from":"2022-09-20T00:00:00.000Z","to":"2022-12-19T00:00:00.000Z","count":2},{"from":"2022-06-22T00:00:00.000Z","to":"2022-12-19T00:00:00.000Z","count":2},{"from":"2021-12-19T00:00:00.000Z","to":"2022-12-19T00:00:00.000Z","count":3},{"from":"2020-12-19T00:00:00.000Z","to":"2022-12-19T00:00:00.000Z","count":9}],"hasTestScript":true,"readme":"# AC GEOIP\nLookup IP addresses at Maxmind GEOIP services or local Maxmind (Geolite) database and prepare the response with custom field mapping. Optionally, you can store the response in Redis to improve performance (of your app).\n\nGEOIP web service requires an account at Maxmind.\n\nYou can also use the Geolite2 database from Maxmind: https://dev.maxmind.com/geoip/geoip2/geolite2/\n\n## Usage\n\n### Using Webservice\n```\nconst acgeoip = require('./index')\n\nlet geoip = {\n  userId: 123456778,\n  licenseKey: 'abc-licensekey'\n}\nacgeoip.init(geoip)\n\n// ASYNC/AWAIT\nasync() {\n  let response = await acgeoip.lookup({ ip: '1.2.3.4' })\n}\n```\n\n### Using local (Geolite) database\n```\nconst acgeoip = require('./index')\n\nlet geoip = {\n  geolite: { \n    enabled: true,\n    path: '/path/to/GeoLite2-City.mmdb'\n  }\n}\nacgeoip.init(geoip)\n\n// ASYNC/AWAIT\nasync() {\n  let response = await acgeoip.lookupLocal({ ip: '1.2.3.4' })\n}\n```\n\n### Combined usage\n```\nconst acgeoip = require('./index')\n\nlet geoip = {\n  userId: 123456778,\n  licenseKey: 'abc-licensekey',\n  geolite: {\n    enabled: true,\n    path: '/path/to/GeoLite2-City.mmdb'\n  }\n}\nacgeoip.init(geoip)\n\n// lookup using web service\nasync() {\n  let response = await acgeoip.lookup({ ip: '1.2.3.4' })\n}\n\n// lookup using local database\nasync() {\n  let response = await acgeoip.lookupLocal({ ip: '1.2.3.4' })\n}\n```\n\n### Using callbacks\nWe recommend using modern async/await approach, but you can also use classic callbacks.\n```\n// TRADITONAL CALLBACK is available for lookup and lookupLocal \nacgeoip.lookup({\n  ip: '8.8.8.8'\n}, (err, response) => {\n  console.log(response)\n})\n\n```\n\n## Init Parameters\n**Required**   \nInitiate the function with the required \"userId\" and \"licenseKey\" if you want to use the webservice. If you want to use local database, make sure to set geolite.enabled to true and provide the location of the database.\n\n**Mapping**   \nDefine how your response looks like using a mapping array. The array contains objects with properties \"response\" which is the property name in the response and \"geoIP\" which is the path to the GeoIP response. \n\nSee this default setup as example\n```\n mapping: [\n      { response: 'iso2', geoIP: 'country.iso_code' },\n      { response: 'city', geoIP: 'city.names.en' },\n      { response: 'region', geoIP: 'subdivisions[0].names.en' },\n      // the following properties are only available using the paid webservice\n      { response: 'isp', geoIP: 'traits.isp' },\n      { response: 'organization', geoIP: 'traits.organization' },\n      { response: 'domain', geoIP: 'traits.domain' },\n      { response: 'location', geoIP: 'location' },\n    ]\n```\n\n**Caching**   \nIn order to cache the data, you need to provide:\n+ redis - a redis instance (from ioredis)\n+ environment - prefix (default development) for the redisKey (e.g development:geoip:8.8.8.8)\n+ cacheTime - seconds to cache the GeoIP response (default 7 days)\n\n\n## Links\n- [Website](https://www.admiralcloud.com/)\n- [Twitter (@admiralcloud)](https://twitter.com/admiralcloud)\n- [Facebook](https://www.facebook.com/MediaAssetManagement/)\n\n## Thanks\nThanks to https://github.com/maxmind/GeoIP2-node\n\n## License\n[MIT License](https://opensource.org/licenses/MIT) Copyright © 2009-present, AdmiralCloud AG, Mark Poepping"},"npm":{"downloads":[{"from":"2022-12-18T00:00:00.000Z","to":"2022-12-19T00:00:00.000Z","count":67},{"from":"2022-12-12T00:00:00.000Z","to":"2022-12-19T00:00:00.000Z","count":70},{"from":"2022-11-19T00:00:00.000Z","to":"2022-12-19T00:00:00.000Z","count":98},{"from":"2022-09-20T00:00:00.000Z","to":"2022-12-19T00:00:00.000Z","count":251},{"from":"2022-06-22T00:00:00.000Z","to":"2022-12-19T00:00:00.000Z","count":422},{"from":"2021-12-19T00:00:00.000Z","to":"2022-12-19T00:00:00.000Z","count":731}],"starsCount":0},"github":{"starsCount":0,"forksCount":0,"subscribersCount":4,"issues":{"count":13,"openCount":0,"distribution":{"3600":0,"10800":0,"32400":0,"97200":1,"291600":1,"874800":0,"2624400":0,"7873200":1,"23619600":10,"70858800":0,"212576400":0},"isDisabled":false},"contributors":[{"username":"markBerlin","commitsCount":41},{"username":"MrGutis","commitsCount":4}],"commits":[{"from":"2022-12-12T00:00:00.000Z","to":"2022-12-19T00:00:00.000Z","count":4},{"from":"2022-11-19T00:00:00.000Z","to":"2022-12-19T00:00:00.000Z","count":4},{"from":"2022-09-20T00:00:00.000Z","to":"2022-12-19T00:00:00.000Z","count":4},{"from":"2022-06-22T00:00:00.000Z","to":"2022-12-19T00:00:00.000Z","count":4},{"from":"2021-12-19T00:00:00.000Z","to":"2022-12-19T00:00:00.000Z","count":10}]},"source":{"files":{"readmeSize":3251,"testsSize":3325,"hasChangelog":true},"linters":["eslint"]}},"evaluation":{"quality":{"carefulness":0.9199999999999999,"tests":0.6,"health":1,"branding":0},"popularity":{"communityInterest":6,"downloadsCount":83.66666666666667,"downloadsAcceleration":0.4014079147640791,"dependentsCount":0},"maintenance":{"releasesFrequency":1,"commitsFrequency":0.9,"openIssues":1,"issuesDistribution":0.9}},"score":{"final":0.6134329074957048,"detail":{"quality":0.8364556389013833,"popularity":0.03579709047902724,"maintenance":0.9999063833075152}}}