cygses

package module
v0.0.0-...-6a68dc3 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2018 License: MIT Imports: 6 Imported by: 0

README

#Get started

Cygses is a simplistic session management library written for Go. Cygses sets out to correct the pain points of web development in Go. Though other libraries do exist, Cygses is mean to be simplistic and familiar to web developers by using influences for popular back-end web languages. There will likely be dramatic and code breaking changes in version 0. Do not use this in production code unless you plan on adapting to these changes.

##Installation

$ go get bitbucket.org/cygnini/cygses/

##Documentation For documentation, visit https://godoc.org/bitbucket.org/cygnini/cygses

##Information

Let me know how you guys like this, what I can do to improve it or add to it. You can contact me at giovanni.panaro@cygnini.org. Feel free to send donations on Google Pay to giovanni.panaro@cygnini.org. Currently I'm a full time college student and a full time worker and this is a major time commitment. Anything helps.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOverseerRunning = errors.New("the overseer is already running")

Returned if overseer is running and it is called again.

View Source
var ErrValueNotSet = errors.New("this session variable was not set")

Returned if a session value is accessed but not set

Functions

func RunOverseer

func RunOverseer() error

Runs overseer 1 time if AutoOverseer is disabled and infinitely if it is enabled. This option can be changed at any point.

Types

type Session

type Session sesTable

Used for users wanting to interact with sessions.

func GetSession

func GetSession(w http.ResponseWriter, r *http.Request) *Session

GetSession returns a Session for the current user. If a session does not exist, one will be created and returned.

func (*Session) ExpandShortSession

func (ses *Session) ExpandShortSession()

Refresh the expiration of a short lifespan session. You only need to use this if Settings.AutoExpandShortSes = false.

func (*Session) Get

func (ses *Session) Get(s string) (error, string)

Returns specified session value

func (*Session) Kill

func (ses *Session) Kill()

Kills a session. On the next GetSession(), a new session will be generated for the user.

func (*Session) Set

func (ses *Session) Set(string, value string)

Sets a session value

type SettingsStruct

type SettingsStruct struct {
	SessionLength      time.Duration //The length of a session.
	UseShortAuth       bool          //Enable short lifespan session authentication.
	ShortLength        time.Duration //The length of the short lifespan session
	AutoExpandShortSes bool          //Expands short session every time getSession is called.
	AutoOverseer       bool          //Specify if overseer should run automatically. Note that if you disable thing, you will have to call RunOverseer() again.
	OverseerInterval   time.Duration //Specify the interval in which overseer is run if AutoOverseer is true
	ValidateRemoteAddr bool          //Validates sessions by using the Remote Address.
	VerboseErrors      bool          //Logs internal errors for invalid sessions.
}

SettingsStruct is a struct used to set the settings of cygses.

var Settings SettingsStruct

Stores settings for the entire library to interact with

Jump to

Keyboard shortcuts

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