api

package
v0.0.0-...-d18e8cf Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Ip_Country_Mapping = make(map[netaddr.IP]string)

Functions

This section is empty.

Types

type App

type App struct {
	Router   *gin.Engine
	Outbound *Outbound
}

App structured as standalone object to better facilitate testing

func (*App) CheckGeoLocation

func (a *App) CheckGeoLocation(c *gin.Context)

CheckGeoLocation is our main endpoint We expect a POST from an outside endpoint with basic auth header and a json payload format:

{
    "ip_address": "X.X.X.X",
    "country_names": [
	"Mexico",
	"Canada",

] } This endpoint will return a 302 if the IP was mapped to a country in the country_names list or a 404 if the IP lookup fails Other error codes are 400 if the json payload is malformed or the IP does not conform to IPv4 or IPv6 standards

func (*App) Initialize

func (a *App) Initialize(testing bool)

func (*App) Run

func (a *App) Run(address string)

type Outbound

type Outbound struct {
	UserId     string
	LicenseKey string
	Client     *http.Client
}

Jump to

Keyboard shortcuts

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