mediocre-api

module
v0.0.0-...-589bc69 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2018 License: Apache-2.0

README

mediocre-api

This package is no longer maintained

This is a collection of packages, each independent of the other, but which together can be used to form the skeleton of an api. It is presumed to be backed by redis, and allows for redis cluster.

Parts

There are multiple parts to this package, each of which can be used more or less independently (although most assume you are using the auth package for user authentication). Each part has its own README explaining how to use it

  • auth - Wrapper around net/http providing rate limiting and user auth on arbitrary requests (in leu of sessions)

  • user - User creation/modification/authentication. Also provides a basic REST api which can be used and built on

  • xff - Middleware for correctly handling X-Forwarded-For headers transparently

  • fwd - Middleware for forwarding requests to other HTTP endpoints

Directories

Path Synopsis
Package auth wraps around an http.Handler, providing automatic rate-limiting and user authentication.
Package auth wraps around an http.Handler, providing automatic rate-limiting and user authentication.
apitok
Package apitok implements rate limiting api calls based on tokens/ips
Package apitok implements rate limiting api calls based on tokens/ips
sig
Package sig is a package for creating and verifying signed arbitrary data
Package sig is a package for creating and verifying signed arbitrary data
usertok
Package usertok creates tokens which authenticate and identify users in a stateless way
Package usertok creates tokens which authenticate and identify users in a stateless way
Package common is used to hold things that multiple packags within the mediocre-api toolkit will need to use or reference
Package common is used to hold things that multiple packags within the mediocre-api toolkit will need to use or reference
apihelper
Package apihelper contains some methods which make working with the http package a bit nicer
Package apihelper contains some methods which make working with the http package a bit nicer
commontest
Package commontest holds methods which are helpful when writing tests within mediocre-api
Package commontest holds methods which are helpful when writing tests within mediocre-api
resphelper
Package resphelper provides a number of methods for working with radix.v2 Resp structs
Package resphelper provides a number of methods for working with radix.v2 Resp structs
Package fwd implements forwarding requests from one http endpoint to another.
Package fwd implements forwarding requests from one http endpoint to another.
Package pickyjson is useful for extracting simple json types with certain constraints.
Package pickyjson is useful for extracting simple json types with certain constraints.
prefab
Package room implements an abstraction for a basic room system.
Package room implements an abstraction for a basic room system.
broadcast
Package broadcast implements a generic system where a user can generate content which can then be consumed by multiple other users.
Package broadcast implements a generic system where a user can generate content which can then be consumed by multiple other users.
Package user implements an abstraction for a basic user system.
Package user implements an abstraction for a basic user system.
Package xff implements a middleware http.Handler which parses any X-Forwarded-For headers it sees in the *http.Request and sets the RemoteAddr to the correct value based on them s := http.NewServeMux() // Set Handle and HandleFuncs here x := xff.NewXFF(s) // All *http.Request instances in the handlers for s will have the correct // RemoteAddr field value now http.ListenAndServe(":8080", x)
Package xff implements a middleware http.Handler which parses any X-Forwarded-For headers it sees in the *http.Request and sets the RemoteAddr to the correct value based on them s := http.NewServeMux() // Set Handle and HandleFuncs here x := xff.NewXFF(s) // All *http.Request instances in the handlers for s will have the correct // RemoteAddr field value now http.ListenAndServe(":8080", x)

Jump to

Keyboard shortcuts

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