boltdb

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2018 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Whitelist

type Whitelist struct {
	*bolt.DB
}

func NewWhitelist

func NewWhitelist(boltFile string) *Whitelist

NewWhitelist opens the bolt database file and returns an implementation for monban.Whitelist. The bolt database file will be created if it does not exist.

func (*Whitelist) Close

func (db *Whitelist) Close() error

func (*Whitelist) GetToken

func (db *Whitelist) GetToken(tokenID string) (*jwt.Token, error)

func (*Whitelist) PutToken

func (db *Whitelist) PutToken(tokenID string, tok *jwt.Token) error

func (Whitelist) Reap

func (db Whitelist) Reap(duration time.Duration) error

Reap removes sessions older than a given duration. This function assumes that all session data is stored in a "sessions" bucket and the data is organized so the key is the session id and the value is laid out as:

-8 bytes-   --n bytes--
timestamp + sessiondata

As written by Ben Johnson: https://gist.github.com/benbjohnson/a3e9e35f73dae8d15c49

Reap should run every second to clean up expired refresh tokens. Reap is meant to be called manually, only once and on a separate goroutine at the start of the program.

Jump to

Keyboard shortcuts

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