{"action":"created","issue":{"url":"https://api.github.com/repos/maxmind/MaxMind-DB-Writer-perl/issues/44","repository_url":"https://api.github.com/repos/maxmind/MaxMind-DB-Writer-perl","labels_url":"https://api.github.com/repos/maxmind/MaxMind-DB-Writer-perl/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/maxmind/MaxMind-DB-Writer-perl/issues/44/comments","events_url":"https://api.github.com/repos/maxmind/MaxMind-DB-Writer-perl/issues/44/events","html_url":"https://github.com/maxmind/MaxMind-DB-Writer-perl/issues/44","id":104736785,"node_id":"MDU6SXNzdWUxMDQ3MzY3ODU=","number":44,"title":"How to support both IPv4 and IPv6 inside the same MMDB file?","user":{"login":"thias","id":787766,"node_id":"MDQ6VXNlcjc4Nzc2Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/787766?v=4","gravatar_id":"","url":"https://api.github.com/users/thias","html_url":"https://github.com/thias","followers_url":"https://api.github.com/users/thias/followers","following_url":"https://api.github.com/users/thias/following{/other_user}","gists_url":"https://api.github.com/users/thias/gists{/gist_id}","starred_url":"https://api.github.com/users/thias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thias/subscriptions","organizations_url":"https://api.github.com/users/thias/orgs","repos_url":"https://api.github.com/users/thias/repos","events_url":"https://api.github.com/users/thias/events{/privacy}","received_events_url":"https://api.github.com/users/thias/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2015-09-03T16:43:34Z","updated_at":"2018-10-11T20:05:00Z","closed_at":"2015-09-03T16:51:54Z","author_association":"NONE","body":"Hi,\n\nThe current example contains the following : \n\n``` perl\nmy $tree = MaxMind::DB::Writer::Tree->new(\n    ip_version            => 6,\n    record_size           => 24,\n    database_type         => 'My-IP-Data',\n    languages             => ['en'],\n    description           => { en => 'My database of IP data' },\n    map_key_type_callback => sub { $types{ $_[0] } },\n);\n\nmy $network\n    = Net::Works::Network->new_from_string( string => '8.23.0.0/16' );\n\n$tree->insert_network(\n    $network,\n    {\n        color => 'blue',\n        dogs  => [ 'Fido', 'Ms. Pretty Paws' ],\n        size  => 42,\n    },\n);\n```\n\nThis doesn't seem to work, as it tries to add an IPv4 network into an `ip_version => 6` tree.\n\nWhat is the proper and working way to create a single MMDB file which would work for both IPv4 and IPv6 address lookups (like the official GeoIP2 files from MaxMind)? Should the example also be fixed? Writing two different trees to the same file, one 4 and one 6, doesn't seem to work.\n"},"comment":{"url":"https://api.github.com/repos/maxmind/MaxMind-DB-Writer-perl/issues/comments/429099409","html_url":"https://github.com/maxmind/MaxMind-DB-Writer-perl/issues/44#issuecomment-429099409","issue_url":"https://api.github.com/repos/maxmind/MaxMind-DB-Writer-perl/issues/44","id":429099409,"node_id":"MDEyOklzc3VlQ29tbWVudDQyOTA5OTQwOQ==","user":{"login":"oschwald","id":278835,"node_id":"MDQ6VXNlcjI3ODgzNQ==","avatar_url":"https://avatars3.githubusercontent.com/u/278835?v=4","gravatar_id":"","url":"https://api.github.com/users/oschwald","html_url":"https://github.com/oschwald","followers_url":"https://api.github.com/users/oschwald/followers","following_url":"https://api.github.com/users/oschwald/following{/other_user}","gists_url":"https://api.github.com/users/oschwald/gists{/gist_id}","starred_url":"https://api.github.com/users/oschwald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oschwald/subscriptions","organizations_url":"https://api.github.com/users/oschwald/orgs","repos_url":"https://api.github.com/users/oschwald/repos","events_url":"https://api.github.com/users/oschwald/events{/privacy}","received_events_url":"https://api.github.com/users/oschwald/received_events","type":"User","site_admin":false},"created_at":"2018-10-11T20:05:00Z","updated_at":"2018-10-11T20:05:00Z","author_association":"MEMBER","body":"The example as written now works. It is no longer necessary to map an IPv4 address to an IPv6 address manually when inserting it into an IPv6 database.\r\n\r\nThe `ip_version` attribute essentially specifies the search tree depth, 32 bits for 4 and 128 bits for 6.\r\n\r\nWhen you specify an `ip_version` of 6, the writer will store IPv4 addresses at `::/96`. The database readers know to look here for IPv4 lookups. The resulting database will support both IPv6 and IPv4 addresses.\r\n\r\nYou can see the [database specification](https://github.com/maxmind/MaxMind-DB/blob/master/MaxMind-DB-spec.md) for more details."}}
{"actor":{"display_login":"oschwald"}}