{"id":15762456,"url":"https://github.com/williamvenner/gm_maxminddb_geoip","last_synced_at":"2025-04-21T03:32:21.188Z","repository":{"id":109206194,"uuid":"445530481","full_name":"WilliamVenner/gm_maxminddb_geoip","owner":"WilliamVenner","description":"🌍 MaxMindDB GeoIP database querying module for Garry's Mod","archived":false,"fork":false,"pushed_at":"2022-01-07T14:37:35.000Z","size":16,"stargazers_count":18,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-11T11:35:27.245Z","etag":null,"topics":["binary-module","garrys-mod","garrysmod","geoip","geoip2","gmod","maxminddb","module","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WilliamVenner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-07T13:29:05.000Z","updated_at":"2024-09-06T18:33:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"2a5019ee-d669-4c1b-bd56-b12d30321351","html_url":"https://github.com/WilliamVenner/gm_maxminddb_geoip","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"d17c4d8c97383dac4b15ce0a1aebba15b191e69a"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WilliamVenner%2Fgm_maxminddb_geoip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WilliamVenner%2Fgm_maxminddb_geoip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WilliamVenner%2Fgm_maxminddb_geoip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WilliamVenner%2Fgm_maxminddb_geoip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WilliamVenner","download_url":"https://codeload.github.com/WilliamVenner/gm_maxminddb_geoip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223849432,"owners_count":17213640,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary-module","garrys-mod","garrysmod","geoip","geoip2","gmod","maxminddb","module","rust"],"created_at":"2024-10-04T11:09:17.098Z","updated_at":"2024-11-09T16:01:28.256Z","avatar_url":"https://github.com/WilliamVenner.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌍 gm_maxminddb_geoip\n\nThis module reads, queries and serializes to Lua tables data from the [MaxMindDB GeoIP](https://www.maxmind.com/en/geoip2-services-and-databases) database.\n\nIn other words, IP address goes in, GeoIP data comes out.\n\n# Installation\n\n## Downloading the module\n\nFirst, run this in your server's console and it will tell you which module you need to download from the [releases page](https://github.com/WilliamVenner/gm_maxminddb_geoip/releases)\n\n```lua\nlua_run print(\"gmsv_maxminddb_geoip_\" .. ((system.IsLinux() and \"linux\" .. (jit.arch == \"x86\" and \"\" or \"64\")) or (system.IsWindows() and \"win\" .. (jit.arch == \"x86\" and \"32\" or \"64\")) or \"UNSUPPORTED\") .. \".dll\")\n```\n\nThen, put the downloaded `dll` file in `garrysmod/lua/bin`, if that folder doesn't exist, create it.\n\n## Downloading the MaxMindDB GeoIP database\n\n[Click here to download the MaxMindDB GeoIP database](https://www.maxmind.com/en/accounts/current/geoip/downloads)\n\nYou'll need to create an account unfortunately. Alternatively, you could always [download a sketchy one from GitHub](https://github.com/search?l=\u0026q=extension%3Ammdb\u0026type=code) if you are lazy.\n\nOne you've created an account, log in and go to \"Download Files\" or \"Download Databases\" and download the database you need.\n\nOnce downloaded, copy it to `garrysmod/maxminddb.mmdb` on your server.\n\n### Which MaxMindDB GeoIP database do I need?\n\nIf you only need country information, download \"GeoLite2 Country\" (NOT the CSV one)\n\n\u003cbr\u003e\n\n# Developers\n\nAll data available in the [`maxminddb` crate documentation](https://docs.rs/maxminddb/0.21.0/maxminddb/geoip2) is serialized and available.\n\nIf you want to automate the downloading of the database in some way, the module will also accept a MaxMindDB stored in `garrysmod/data/maxminddb.dat` which can be written to using [`file.Write`](https://wiki.facepunch.com/gmod/file.Write)\n\n\u003cbr\u003e\n\n## Rust -\u003e Lua Type Conversions\n\nNot all servers will have the full databases installed, and the free database contains limited data, which most servers will install. Therefore, do note that every field can be `nil`.\n\n|        Rust       |           Lua           | English                     |\n|:-----------------:|:-----------------------:|-----------------------------|\n| `BTreeMap\u003cK, V\u003e`  | `{ [K] = V, ... }`      | A key-value table           |\n| `Vec\u003cT\u003e`          | `{ T, ... }`            | A sequential table          |\n| `Option\u003cT\u003e`       | `T \\| nil`              | Something that can be `nil` |\n| `\u0026str`            | `string`                | Text                        |\n| `f64`             | `number`                | A decimal number            |\n| `u32` `u16`       | `integer`               | A positive integer          |\n\n\u003cbr\u003e\n\n## Loading the module\n\n```lua\nrequire(\"maxminddb_geoip\")\n\n-- Prints the version of the module\nprint(maxminddb.VERSION)\n\n-- This will reread the database from the disk, useful if you've just written to garrysmod/data/maxminddb.dat\n-- You don't need to call this function after require()ing the module, it will load automatically\n-- maxminddb.refresh() -\u003e (success: bool, error: [string | nil])\nmaxminddb.refresh()\n```\n\n\u003cbr\u003e\n\n## Simple Querying\n\n```lua\n-- Provided for convenience\n-- maxminddb.country(ipAddress: string, lang: string = \"en\") -\u003e [(country: string, nil) | (nil, error: string)]\nlocal country, err = maxminddb.country(\"1.1.1.1\", \"en\")\nif err then\n    error(err)\nelse\n    print(country) -- \"Australia\"\nend\n```\n\n\u003cbr\u003e\n\n## Advanced Querying\n\n```lua\n-- Advanced querying\n-- Records can be found here: https://docs.rs/maxminddb/latest/maxminddb/0.21.0\n-- maxminddb.query(ipAddress: string, record) -\u003e [(data: table, nil) | (nil, error: string)]\nlocal data, err = maxminddb.query(\"1.1.1.1\", maxminddb.records.Country)\nif err then\n    error(err)\nelse\n    PrintTable(data) -- see below\nend\n```\n\n```lua\n-- Database used for example: GeoLite2-Country\n\ncontinent:\n    code        =       \"OC\"\n    geoname_id  =       6255151\n    names:\n        de      =       \"Ozeanien\"\n        en      =       \"Oceania\"\n        es      =       \"Oceanía\"\n        fr      =       \"Océanie\"\n        ja      =       \"オセアニア\"\n        pt-BR   =       \"Oceania\"\n        ru      =       \"Океания\"\n        zh-CN   =       \"大洋洲\"\n\ncountry:\n    geoname_id  =       2077456\n    iso_code    =       \"AU\"\n    names:\n        de      =       \"Australien\"\n        en      =       \"Australia\"\n        es      =       \"Australia\"\n        fr      =       \"Australie\"\n        ja      =       \"オーストラリア\"\n        pt-BR   =       \"Austrália\"\n        ru      =       \"Австралия\"\n        zh-CN   =       \"澳大利亚\"\n\nregistered_country:\n    geoname_id  =       2077456\n    iso_code    =       \"AU\"\n    names:\n        de      =       \"Australien\"\n        en      =       \"Australia\"\n        es      =       \"Australia\"\n        fr      =       \"Australie\"\n        ja      =       \"オーストラリア\"\n        pt-BR   =       \"Austrália\"\n        ru      =       \"Австралия\"\n        zh-CN   =       \"澳大利亚\"\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliamvenner%2Fgm_maxminddb_geoip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilliamvenner%2Fgm_maxminddb_geoip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliamvenner%2Fgm_maxminddb_geoip/lists"}