Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                

core

package
v0.0.202 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SessionName string

SessionName is the cookie name used for storing session data.

Store holds the session store implementation.

Functions

func GetSession

func GetSession(r *http.Request) (*sessions.Session, error)

GetSession returns the session from the request context if present, otherwise it retrieves the session from the session store.

func GetSessionOrFail

func GetSessionOrFail(w http.ResponseWriter, r *http.Request) (*sessions.Session, bool)

GetSessionOrFail wraps GetSession and writes a 500 response if retrieving the session fails. It returns the session and a boolean indicating success.

func SessionError

func SessionError(w http.ResponseWriter, r *http.Request, err error)

SessionError logs the error and clears the session cookie.

func SessionErrorRedirect

func SessionErrorRedirect(w http.ResponseWriter, r *http.Request, err error)

SessionErrorRedirect clears the session and redirects to the login page when an error occurs retrieving the session.

Types

type ContextValues

type ContextValues string

ContextValues represents context key names used across the application.

type DirFS

type DirFS interface {
	FileSystem
	MkdirAll(path string, perm fs.FileMode) error
	Stat(name string) (fs.FileInfo, error)
	Remove(name string) error
}

DirFS extends FileSystem with directory operations used by startup checks.

type FileSystem

type FileSystem interface {
	ReadFile(name string) ([]byte, error)
	WriteFile(name string, data []byte, perm fs.FileMode) error
}

FileSystem abstracts basic file operations so tests can use an in-memory implementation.

func UseMemFS

func UseMemFS(t *testing.T) FileSystem

UseMemFS returns an in-memory FileSystem for tests.

type OSDirFS

type OSDirFS struct{ OSFS }

OSDirFS implements DirFS using the os package.

func (OSDirFS) MkdirAll

func (OSDirFS) MkdirAll(path string, perm fs.FileMode) error

func (OSDirFS) Remove

func (OSDirFS) Remove(name string) error

func (OSDirFS) Stat

func (OSDirFS) Stat(name string) (fs.FileInfo, error)

type OSFS

type OSFS struct{}

OSFS implements FileSystem using the os package.

func (OSFS) ReadFile

func (OSFS) ReadFile(name string) ([]byte, error)

func (OSFS) WriteFile

func (OSFS) WriteFile(name string, data []byte, perm fs.FileMode) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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