session

package
v0.0.0-...-0eaabd3 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionAESKey = "1234567890123456"
)

Variables

View Source
var (
	ErrSessionNotFound = errors.New("session not found")
	ErrPathNotFound    = "file not found"
	ErrFileNotExists   = "no such file or directory"
)
View Source
var (
	ErrInvalidSession = errors.New("the session string is invalid/has been tampered with")
)

Functions

This section is empty.

Types

type Session

type Session struct {
	Key      []byte
	Hash     []byte
	Salt     int64
	Hostname string
	AppID    int32
}

Session is a basic data of specific session. Typically, session stores default hostname of mtproto server (cause all accounts ties to specific server after sign in), session key, server hash and salt.

type SessionLoader

type SessionLoader interface {
	Load() (*Session, error)
	Store(*Session) error
	Path() string
	Delete() error
}

SessionLoader is the interface which allows you to access sessions from different storages (like filesystem, database, s3 storage, etc.)

func NewFromFile

func NewFromFile(path string) SessionLoader

func NewInMemory

func NewInMemory() SessionLoader

type StringSession

type StringSession struct {
	// contains filtered or unexported fields
}

func NewEmptyStringSession

func NewEmptyStringSession() *StringSession

func NewStringSession

func NewStringSession(authKey, authKeyHash []byte, dcID int, ipAddr string, appID int32) *StringSession

func (StringSession) AppID

func (s StringSession) AppID() int32

func (StringSession) AuthKey

func (s StringSession) AuthKey() []byte

func (StringSession) AuthKeyHash

func (s StringSession) AuthKeyHash() []byte

func (StringSession) DcID

func (s StringSession) DcID() int

func (*StringSession) Decode

func (s *StringSession) Decode(encoded string) error

func (*StringSession) Encode

func (s *StringSession) Encode() string

func (StringSession) IpAddr

func (s StringSession) IpAddr() string

Jump to

Keyboard shortcuts

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