sbng / mrt2mmdb

Convert a mrt file into a maxmind database file
1 stars 0 forks source link

Make database type user-specifiable #6

Closed johnhtodd closed 4 months ago

johnhtodd commented 4 months ago

The "DatabaseType" component (part of mmdb_writer library) should be specifiable on the command line. Currently, it seems to default to "GeoIP" and that is static or a default value.

The reason for this is that Vector now treats "GeoIP" data in a specific way, and we need to manually change the database type name to be flexible.

sbng commented 4 months ago

added this feature. fix c035cb8 under rename_attribute branch. Please verify. Thanks.

sbng commented 4 months ago
$ ./make_mmdb.py --database_type my_new_name --prefix 100                                     [!rename_attribute]
 Making ASN table for description lookup   : 625093 prefixes [00:08, 76905.36 prefixes/s]
 Loading mrt data into dictionary          : 100 prefixes [00:00, 5291.16 prefixes/s]
 Converting mrt into mmda                  : 99 prefixes [00:00, 3173.30 prefixes/s]
 Prefixes without description              : 0  prefixes
 ASN without description                   : 0  prefixes
$ ./lookup.py --show_db_type --mmdb out.mmdb                                                  [!rename_attribute]
"my_new_name"
johnhtodd commented 4 months ago

Checked! Works great. Some other minor formatting nits (I will start another ticket) but this is working now as expected.

sbng commented 4 months ago

merge into main