server

package
v0.0.0-...-73c6ec5 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package server defines a rate limit server. The server has the following HTTP methods:

POST /acquire/:API_KEY/:REGION
	 Returns a unique string token that can be used to finalize or cancel
	 the quota request. If this method returns HTTP OK, then the token must
	 be marked either done or cancelled within one minute, or it is
	 considered timed out. The method supports the following form fields:

    method: relative HTTP path to the Riot method. If omitted, then
    	 the request refers to the application-level quota.
    uniquifier: token that, if provided, signifies a distinct quota bucket,
      even if the method is the same.
    noappquota: if set to T or t, indicates that the request should count
      towards (possibly uniquified) method-level quota, but not application
      quota.

POST /done/:TOKEN
  Marks the request with the given token as complete, so that all
  relevant quota can be returned after a delay. This request may
  optionally include HTTP headers returned by the Riot API. If
  available, the server will parse the headers and update internally
  tracked quota availability.

POST /cancel/:TOKEN
	 Marks the request with the given token as cancelled, so that all
	 relevant quota can be returned immediately.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() http.Handler

New returns an HTTP handler that implements the rate limit service. The return value can be used via code like:

		r := New()
   http.Handle("/", r)

Types

This section is empty.

Directories

Path Synopsis
Launches a ratelimit server on the specified port.
Launches a ratelimit server on the specified port.

Jump to

Keyboard shortcuts

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