Giter Site home page Giter Site logo

goratio's Introduction

Goratio

Go Report Card gopherbadger-tag-do-not-edit

Goratio is a location validation microservice for:

Usage

See OpenAPI specification for full API doc.

With the application running, post your query to the /validate endpoint:

{
    "phone": {
        "number": "0612345678",
        "country": "FR"
    },
    "zip": {
        "code": "06000",
        "country": "FR"
    },
    "email": "[email protected]",
    "ip": "3.3.3.3"
}

Will output the following result:

{
    "phone": {
        "number": "0612345678",
        "country": "FR",
        "valid": true,
        "formatted": {
            "E164": "+33612345678",
            "national": "06 12 34 56 78",
            "international": "+33 6 12 34 56 78"
        }
    },
    "zip": {
        "code": "06000",
        "country": "FR",
        "valid": true
    },
    "email": {
        "address": "[email protected]",
        "valid": true
    },
    "ip": {
        "address": "3.3.3.3",
        "valid": true,
        "geo": {
            "country_code": "US",
            "country_name": "United States",
            "city": "Seattle"
        }
    }
}

GeoIP

Path to a GeoLite2 DB (.mmdb format) defaults to /var/GeoLite2.mmdb.

It's path may be defined explicitely using GEOIP_DB_PATH environment variable.

If the file at the given path does not exist or is not valid, GeoIP feature is disabled.

ℹī¸ Note that GeoLite2 Country database might be slightly faster than the City DB. Consider using it if you don't need a city-level accuracy.

Downloading the DB

wget https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz -O GeoLite2.tgz
tar --strip-components=1 -zxf GeoLite2.tar.gz *.mmdb

Testing

make test

goratio's People

Contributors

michael-bouvy avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.