session

package
v0.0.0-...-a9a08a4 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package session provides session management utilities for the 3x-ui web panel. It handles user authentication state, login sessions, and session storage using Gin sessions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearSession

func ClearSession(c *gin.Context)

ClearSession removes all session data and invalidates the session. This effectively logs out the user and clears any stored session information.

func GetLoginUser

func GetLoginUser(c *gin.Context) *model.User

GetLoginUser retrieves the authenticated user from the session. Returns nil if no user is logged in or if the session data is invalid.

func IsLogin

func IsLogin(c *gin.Context) bool

IsLogin checks if a user is currently authenticated in the session. Returns true if a valid user session exists, false otherwise.

func SetLoginUser

func SetLoginUser(c *gin.Context, user *model.User)

SetLoginUser stores the authenticated user in the session. The user object is serialized and stored for subsequent requests.

func SetMaxAge

func SetMaxAge(c *gin.Context, maxAge int)

SetMaxAge configures the session cookie maximum age in seconds. This controls how long the session remains valid before requiring re-authentication.

Types

This section is empty.

Jump to

Keyboard shortcuts

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