session

package
v0.0.0-...-e749f68 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const SessionCookieName string = "session"
View Source
const SessionLifeTime = time.Minute * 15

Variables

View Source
var CommitHash = func() string {
	if info, ok := debug.ReadBuildInfo(); ok {
		for _, setting := range info.Settings {
			if setting.Key == "vcs.revision" {
				return setting.Value
			}
		}
	}
	return "asd"
}()

Functions

func CleanupSessions

func CleanupSessions(stop chan struct{})

func ExtendSession

func ExtendSession(s *Session)

func GenerateSession

func GenerateSession(w http.ResponseWriter, username string)

func GetCookie

func GetCookie(value string, expires time.Time) *http.Cookie

Types

type Session

type Session struct {
	Username string
	Expires  time.Time
}

func GetSession

func GetSession(r *http.Request) (string, *Session)

type SessionKeyType

type SessionKeyType string
const SessionKey SessionKeyType = "session"

type SessionResponse

type SessionResponse struct {
	CommitHash string `json:"commit_hash"`
}

Jump to

Keyboard shortcuts

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