tokens

package
v0.0.0-...-157c9c8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tokens

type Tokens struct {
	// contains filtered or unexported fields
}

Tokens can be used to create temporary callbacks.

func New

func New(timeout time.Duration) *Tokens

New initilizes an instance of Tokens with given duration.

func (Tokens) Call

func (t Tokens) Call(token string, w http.ResponseWriter, r *http.Request)

Call the http.HandlerFunc associated with the provided token.

func (Tokens) Get

func (t Tokens) Get(w http.ResponseWriter, r *http.Request)

Get assumes the last portion of a url is the token

func (Tokens) Post

func (t Tokens) Post(w http.ResponseWriter, r *http.Request)

Post reads the body of the request as a token and invoke Tokens.Call.

func (Tokens) Register

func (t Tokens) Register(fn http.HandlerFunc) (string, toq.Token)

Register an http.HandlerFunc. The string is the token. The toq.Token provides control over the timeout operation.

Jump to

Keyboard shortcuts

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