https://github.com/fischerscode/dart-maxminddb
This dart library is capable of searching IP addresses in MAXMINDs mmdb databases.
https://github.com/fischerscode/dart-maxminddb
dart dartlang geoip2 maxmind
Last synced: 6 months ago
JSON representation
This dart library is capable of searching IP addresses in MAXMINDs mmdb databases.
- Host: GitHub
- URL: https://github.com/fischerscode/dart-maxminddb
- Owner: fischerscode
- License: gpl-3.0
- Created: 2021-10-05T01:15:42.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-09-04T15:41:30.000Z (about 2 years ago)
- Last Synced: 2025-03-27T03:34:44.210Z (7 months ago)
- Topics: dart, dartlang, geoip2, maxmind
- Language: Dart
- Homepage:
- Size: 43 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pub.dev/packages/maxminddb)
[](https://github.com/fischerscode/dart-maxmindDB/actions/workflows/ci.yaml)# dart-maxmindDB
This dart library is capable of searching ip addresses in [MAXMINDs mmdb databases](https://maxmind.github.io/MaxMind-DB/).
As its main use case, this library can be used to get the geo location of an IP address by using the [GeoLite2 Database](https://dev.maxmind.com/geoip/geolite2-free-geolocation-data).
## Usage in command line:
- `dart pub global activate maxminddb`
- `maxminddb search 1.2.3.4`
- Usage documentation: `maxminddb -h`## Usage in a dart program:
1. Initialize the database:
```dart
var database = await MaxMindDatabase.memory(
File('GeoLite2-City.mmdb').readAsBytesSync());// OR
var database = await MaxMindDatabase.file(File('GeoLite2-City.mmdb'));
```
2. Search the database:
```dart
print(await database.search('8.8.8.8'));
```
The result might vary depending on the database you are using.The database can either be loaded in memory or queried from a file system.
Depending on the compute power and **disk speed**, loading the database in memory should be roughly 20 times faster.The library can be benchmarked using the [benchmark example](example/benchmark.dart).