session

package
v0.0.0-...-5bdf5b5 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KillSession

func KillSession(cookie string) error

KillSession logs out the session with the provided cookie

func RandomString

func RandomString() (str string, err error)

RandomString returns a pseudo-random string of 32 bits

Types

type Controller

type Controller interface {
	client.Controller
	GetCreatedAt() time.Time
	GetTouchAt() time.Time
	GetDeadline() time.Time
	MatchCookie(string) bool
	GetCookie() string
	SessionStatus() pb.Status
}

A Controller represents the session of some client

func FindSessionByClient

func FindSessionByClient(id int64) (ctrl Controller, err error)

FindSessionByClient returns the session with the provided cookie, if exists

func FindSessionByCookie

func FindSessionByCookie(cookie string) (ctrl Controller, err error)

FindSessionByCookie returns the session with the provided cookie, if exists

func NewSession

func NewSession(client client.Controller, timeout time.Duration) (ctrl Controller, err error)

NewSession returns a brand new session for the provided client

Jump to

Keyboard shortcuts

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