Documentation ¶
Overview ¶
Package session implements session storage.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("session storage: not found")
ErrNotFound means that session is not found in storage.
Functions ¶
This section is empty.
Types ¶
type FileStorage ¶
type FileStorage struct {
Path string
}
FileStorage implements SessionStorage for file system as file stored in Path.
func (*FileStorage) LoadSession ¶
func (f *FileStorage) LoadSession(_ context.Context) ([]byte, error)
LoadSession loads session from file.
func (*FileStorage) StoreSession ¶
func (f *FileStorage) StoreSession(_ context.Context, data []byte) error
StoreSession stores session to file.
type Loader ¶
type Loader struct {
Storage Storage
}
Loader wraps Storage implementing Data (un-)marshaling.
type Storage ¶
type Storage interface { LoadSession(ctx context.Context) ([]byte, error) StoreSession(ctx context.Context, data []byte) error }
Storage is secure persistent storage for client session.
NB: Implementation security is important, attacker can use not only for connecting as authenticated user or bot, but even decrypting previous messages in some situations.
type StorageMemory ¶
type StorageMemory struct {
// contains filtered or unexported fields
}
StorageMemory implements in-memory session storage. Goroutine-safe.
func (*StorageMemory) LoadSession ¶
func (s *StorageMemory) LoadSession(ctx context.Context) ([]byte, error)
LoadSession loads session from memory.
func (*StorageMemory) StoreSession ¶
func (s *StorageMemory) StoreSession(ctx context.Context, data []byte) error
StoreSession stores session to memory.