session

package
v0.0.0-...-721115d Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Prefix = "1Bv"
)
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"
)

Functions

This section is empty.

Types

type Session

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

Sesion 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 {
	AuthKey     []byte
	AuthKeyHash []byte
	DCID        int
	IpAddr      string
	AppID       int32
	Encoded     string
}

func (StringSession) AppendAllValues

func (s StringSession) AppendAllValues() string

func (StringSession) Decode

func (s StringSession) Decode() (AuthKey, AuthKeyHash []byte, DcID int, IpAddr string, AppID int32, err error)

func (StringSession) Encode

func (s StringSession) Encode() []byte

func (StringSession) EncodeToString

func (s StringSession) EncodeToString() string

func (StringSession) GetAuthKey

func (s StringSession) GetAuthKey() string

func (StringSession) GetAuthKeyHash

func (s StringSession) GetAuthKeyHash() string

func (StringSession) GetDCID

func (s StringSession) GetDCID() int

func (StringSession) SplitValues

func (s StringSession) SplitValues(DecodedString string) (AuthKey, AuthKeyHash []byte, IpAddr string, DcID int, AppID int32)

Jump to

Keyboard shortcuts

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