dtoken

package
v0.13.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2022 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package token represents the decoded form of a "session" token.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DToken

type DToken struct {
	Expiry int64 // Unix time UTC (seconds since 1970)
	IP     net.IP
	Values [][]byte
}

func FromCtx

func FromCtx(r *http.Request) (DToken, error)

FromCtx gets the decoded token from the request context.

func (DToken) Bool

func (dt DToken) Bool(i int) (bool, error)

func (DToken) CompareExpiry

func (dt DToken) CompareExpiry() int

func (DToken) ExpiryTime

func (dt DToken) ExpiryTime() time.Time

func (DToken) PutInCtx

func (dt DToken) PutInCtx(r *http.Request) *http.Request

PutInCtx stores the decoded token in the request context.

func (*DToken) SetBool

func (dt *DToken) SetBool(i int, value bool) error

func (*DToken) SetExpiry

func (dt *DToken) SetExpiry(d time.Duration)

func (*DToken) SetRemoteIP

func (dt *DToken) SetRemoteIP(r *http.Request) error

func (*DToken) SetString

func (dt *DToken) SetString(i int, s string) error

func (*DToken) SetUint64

func (dt *DToken) SetUint64(i int, v uint64) error

func (*DToken) ShortenIP

func (dt *DToken) ShortenIP()

func (DToken) String

func (dt DToken) String(i int) (string, error)

func (DToken) Uint64

func (dt DToken) Uint64(i int) (uint64, error)

func (DToken) Valid

func (dt DToken) Valid(r *http.Request) error

func (DToken) ValidExpiry

func (dt DToken) ValidExpiry() bool

func (DToken) ValidIP

func (dt DToken) ValidIP(r *http.Request) error

Jump to

Keyboard shortcuts

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