Goratio

command module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2019 License: MIT Imports: 12 Imported by: 0

README

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": "john.doe@example.com",
    "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": "john.doe@example.com",
        "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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL