sess

package
v0.0.0-...-2c97fc3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package sess manages user registrations, records, and sessions. Copyright © 2018 Zelenko. All rights reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SManager

type SManager string

SManager exported type is used by methods

func NewManager

func NewManager() *SManager

NewManager creates new session Manager

func (*SManager) Close

func (sm *SManager) Close()

Close method saves all user and session records into text file. These saved records are loaded into memory next time server runs.

func (*SManager) LoginSession

func (sm *SManager) LoginSession(un, br, ipAddr string) string

LoginSession return session id

func (*SManager) RandomSession

func (sm *SManager) RandomSession() string

RandomSession generates new random session ID

func (*SManager) RegisterUser

func (sm *SManager) RegisterUser(un, pw string)

RegisterUser creates a new user

func (*SManager) ShowSessions

func (sm *SManager) ShowSessions(userID string) []string

ShowSessions returns slice of sessions

func (*SManager) ShowUsers

func (sm *SManager) ShowUsers() []string

ShowUsers returns slice of users

func (*SManager) UpdateSession

func (sm *SManager) UpdateSession(id string)

UpdateSession sets lastActive date and time

func (*SManager) ValidateUser

func (sm *SManager) ValidateUser(id string) bool

ValidateUser checks if user is registered

Jump to

Keyboard shortcuts

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