utils

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: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DebugLevel is the lowest level of logging
	DebugLevel = iota
	// InfoLevel is the second lowest level of logging
	InfoLevel
	// WarnLevel is the third highest level of logging
	WarnLevel
	// ErrorLevel is the highest level of logging
	ErrorLevel
	// NoLevel disables all logging
	NoLevel
)

Variables

View Source
var (
	DcList = map[int]string{
		1: "149.154.175.58:443",
		2: "149.154.167.50:443",
		3: "149.154.175.100:443",
		4: "149.154.167.91:443",
		5: "91.108.56.151:443",
	}
)

Functions

func AuthKeyHash

func AuthKeyHash(key []byte) []byte

func CloseChannelWithoutPanic

func CloseChannelWithoutPanic(c chan tl.Object)

func FullStack

func FullStack()

func GenerateMessageId

func GenerateMessageId(prevID int64) int64

func GenerateSessionID

func GenerateSessionID() int64

func RandomBytes

func RandomBytes(size int) []byte

func Sha1

func Sha1(input string) []byte

func Sha1Byte

func Sha1Byte(input []byte) []byte

func Xor

func Xor(dst, src []byte)

Types

type Logger

type Logger struct {
	Level  int
	Prefix string
}

Logger is the logging struct.

func NewLogger

func NewLogger(prefix string) *Logger

NewLogger returns a new Logger instance.

func (*Logger) Debug

func (l *Logger) Debug(v ...any)

func (*Logger) Error

func (l *Logger) Error(v ...any)

Log logs a message at the given level.

func (*Logger) Info

func (l *Logger) Info(v ...any)

func (*Logger) Lev

func (l *Logger) Lev() string

func (*Logger) SetLevel

func (l *Logger) SetLevel(level string) *Logger

SetLevelString sets the level string

func (*Logger) Warn

func (l *Logger) Warn(v ...any)

type PingParams

type PingParams struct {
	PingID int64
}

func (*PingParams) CRC

func (*PingParams) CRC() uint32

type SyncIntObjectChan

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

func NewSyncIntObjectChan

func NewSyncIntObjectChan() *SyncIntObjectChan

func (*SyncIntObjectChan) Add

func (s *SyncIntObjectChan) Add(key int, value chan tl.Object)

func (*SyncIntObjectChan) Close

func (s *SyncIntObjectChan) Close()

func (*SyncIntObjectChan) Delete

func (s *SyncIntObjectChan) Delete(key int) bool

func (*SyncIntObjectChan) Get

func (s *SyncIntObjectChan) Get(key int) (chan tl.Object, bool)

func (*SyncIntObjectChan) Has

func (s *SyncIntObjectChan) Has(key int) bool

func (*SyncIntObjectChan) Keys

func (s *SyncIntObjectChan) Keys() []int

func (*SyncIntObjectChan) Reset

func (s *SyncIntObjectChan) Reset()

type SyncIntReflectTypes

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

func NewSyncIntReflectTypes

func NewSyncIntReflectTypes() *SyncIntReflectTypes

func (*SyncIntReflectTypes) Add

func (s *SyncIntReflectTypes) Add(key int, value []reflect.Type)

func (*SyncIntReflectTypes) Delete

func (s *SyncIntReflectTypes) Delete(key int) bool

func (*SyncIntReflectTypes) Get

func (s *SyncIntReflectTypes) Get(key int) ([]reflect.Type, bool)

func (*SyncIntReflectTypes) Has

func (s *SyncIntReflectTypes) Has(key int) bool

func (*SyncIntReflectTypes) Keys

func (s *SyncIntReflectTypes) Keys() []int

func (*SyncIntReflectTypes) Reset

func (s *SyncIntReflectTypes) Reset()

type SyncSetInt

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

func NewSyncSetInt

func NewSyncSetInt() *SyncSetInt

func (*SyncSetInt) Add

func (s *SyncSetInt) Add(key int) bool

func (*SyncSetInt) Delete

func (s *SyncSetInt) Delete(key int) bool

func (*SyncSetInt) Has

func (s *SyncSetInt) Has(key int) bool

func (*SyncSetInt) Reset

func (s *SyncSetInt) Reset()

Jump to

Keyboard shortcuts

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