Skip to content

ClickAndMortar/Goratio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Go location (zipcode, phone, email, vat, IP) validation microservice

Resources

License

Stars

Watchers

Forks

Packages

No packages published