Documentation ¶
Index ¶
- Constants
- Variables
- func IsUserValid(userID uint64) bool
- type Session
- func (s *Session) CreateSession(ctx context.Context, userID uint64, remoteAddr string, duration time.Duration) (SessionID, error)
- func (s *Session) ExtendSession(ctx context.Context, remoteAddr string, sessionID SessionID, ...) (uint64, error)
- func (s *Session) InvalidateSession(ctx context.Context, sessionID SessionID) error
- func (s *Session) IsSessionValid(ctx context.Context, sessionID SessionID) bool
- func (s *Session) UserSession(ctx context.Context, sessionID SessionID) uint64
- type SessionID
- type SessionInfo
Constants ¶
View Source
const (
KeySessions = "Api.Sessions"
)
Variables ¶
View Source
var ( ErrInvalidDuration = errors.New("Invalid Duration") ErrInvalidUserID = errors.New("Invalid UserID") ErrInvalidRemoteAddr = errors.New("Invalid RemoteAddr") ErrRemoteAddrChanged = errors.New("RemoteAddr Changed") ErrInvalidSessionID = errors.New("Invalid SessionID") ErrSessionExpired = errors.New("Session Expired") ErrEncode = errors.New("Encode Error") ErrDecode = errors.New("Decode Error") ErrCache = errors.New("Cache Error") )
Functions ¶
func IsUserValid ¶
Types ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func NewSession ¶
func (*Session) CreateSession ¶
func (*Session) ExtendSession ¶
func (*Session) InvalidateSession ¶
func (*Session) IsSessionValid ¶
type SessionInfo ¶
type SessionInfo struct { UserID uint64 RemoteAddr string SessionID SessionID Expiration time.Time }
func (*SessionInfo) Decode ¶
func (s *SessionInfo) Decode(data []byte) error
Decode return SessionInfo from bytes. Decoded with gob
func (*SessionInfo) Encode ¶
func (s *SessionInfo) Encode() ([]byte, error)
Encode return bytes from Message. Encoded with gob
func (*SessionInfo) Expired ¶
func (s *SessionInfo) Expired() bool
Click to show internal directories.
Click to hide internal directories.