web

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCookie

func GetCookie(r *http.Request, name string) (*sessions.Session, error)

Get returns a session for the given name after adding it to the registry.

It returns a new session if the sessions doesn't exist. Access IsNew on the session to check if it is an existing session or a new one.

It returns a new session and an error if the session exists but could not be decoded.

func GetCookieKeyPairs

func GetCookieKeyPairs() (keyPairs string)

func GetCookieStore

func GetCookieStore() *sessions.CookieStore

func GetUserIp

func GetUserIp(r *http.Request) string

NOT tested in ipv6 environment

func NewCookie

func NewCookie(r *http.Request, name string) (*sessions.Session, error)

New returns a session for the given name without adding it to the registry.

The difference between New() and Get() is that calling New() twice will decode the session data twice, while Get() registers and reuses the same decoded session after the first call.

func SaveCookie

func SaveCookie(r *http.Request, w http.ResponseWriter, s *sessions.Session) error

Save adds a single session to the response.

func SetCookieKeyPairs

func SetCookieKeyPairs(keyPairs string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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