utils

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DcList = DCOptions{
	DCS: map[int][]DC{
		1: {{"149.154.175.58:443", false}},
		2: {{"149.154.167.50:443", false}},
		3: {{"149.154.175.100:443", false}},
		4: {{"149.154.167.91:443", false},
			{"[2001:067c:04e8:f002::a]:443", true}},
		5: {{"91.108.56.151:443", false}},
	},
	TestDCs: map[int]string{
		1: "149.154.175.10:443",
		2: "149.154.167.40:443",
		3: "149.154.175.117:443",
	},
	CdnDCs: map[int][]DC{
		201: {{"91.108.23.100:443", false}},
		203: {{"91.105.192.100:443", false},
			{"[2a0a:f280:0203:000a:5000:0000:0000:0100]:443", true}},
	},
}

Functions

func AskForConfirmation

func AskForConfirmation() bool

func AuthKeyHash

func AuthKeyHash(key []byte) []byte

func CloseChannelWithoutPanic

func CloseChannelWithoutPanic(c chan tl.Object)

func FmtIp added in v1.4.1

func FmtIp(ipv6WithPort string) string

func FmtMethod added in v1.6.3

func FmtMethod(data tl.Object) string

func FullStack

func FullStack()

func GenerateSessionID

func GenerateSessionID() int64

func GetDefaultHostIp added in v1.6.1

func GetDefaultHostIp(dc int, test bool, ipv6 bool) string

func NewMsgIDGenerator

func NewMsgIDGenerator() func(timeOffset int64) int64

func RandomBytes

func RandomBytes(size int) []byte

func Sha1

func Sha1(input string) []byte

func Sha1Byte

func Sha1Byte(input []byte) []byte

func Vtcp added in v1.4.1

func Vtcp(isV6 bool) string

func Xor

func Xor(dst, src []byte)

Types

type AudioInfo added in v1.6.3

type AudioInfo struct {
	Duration   int64
	Bitrate    uint32
	Channels   uint32
	SampleRate uint32
}

func ParseFLAC added in v1.6.3

func ParseFLAC(filename string) (*AudioInfo, error)

func ParseM4A added in v1.6.3

func ParseM4A(filename string) (*AudioInfo, error)

func ParseMP3 added in v1.6.3

func ParseMP3(filename string) (*AudioInfo, error)

func ParseWAV added in v1.6.3

func ParseWAV(filename string) (*AudioInfo, error)

type DC added in v1.4.0

type DC struct {
	Addr string
	V    bool
}

type DCOptions

type DCOptions struct {
	DCS     map[int][]DC
	TestDCs map[int]string
	CdnDCs  map[int][]DC
}

func NewDCOptions added in v1.6.1

func NewDCOptions() *DCOptions

func (*DCOptions) GetCdnAddr added in v1.6.1

func (opt *DCOptions) GetCdnAddr(dc int) (string, bool)

func (*DCOptions) GetHostIp added in v1.6.1

func (opt *DCOptions) GetHostIp(dc int, test bool, ipv6 bool) string

func (*DCOptions) SearchAddr added in v1.6.1

func (opt *DCOptions) SearchAddr(addr string) int

func (*DCOptions) SetDCs added in v1.6.1

func (opt *DCOptions) SetDCs(dcs map[int][]DC, cdnDcs map[int][]DC)

type LogLevel added in v1.4.3

type LogLevel int
const (
	// DebugLevel is the lowest level of logging
	DebugLevel LogLevel = iota + 1
	// InfoLevel is the second lowest level of logging (default)
	InfoLevel
	// WarnLevel is the third highest level of logging
	WarnLevel
	// ErrorLevel is the highest level of logging
	ErrorLevel
	// NoLevel disables all logging
	NoLevel
	// TraceLevel is the highest level of logging
	TraceLevel
)

type Logger

type Logger struct {
	Level  LogLevel
	Prefix string
	// contains filtered or unexported fields
}

Logger is the logging struct.

func NewLogger

func NewLogger(prefix string) *Logger

NewLogger returns a new Logger instance.

func (*Logger) Color added in v1.4.2

func (l *Logger) Color() bool

Color enables colorized output. (default)

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() LogLevel

func (*Logger) NoColor added in v1.4.2

func (l *Logger) NoColor(nocolor ...bool) *Logger

NoColor disables colorized output.

func (*Logger) Panic

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

func (*Logger) SetLevel

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

SetLevelString sets the level string

func (*Logger) SetPrefix added in v1.4.5

func (l *Logger) SetPrefix(prefix string) *Logger

func (*Logger) Trace

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

func (*Logger) Warn

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

type MKVInfo added in v1.6.3

type MKVInfo struct {
	Duration float64
	Width    uint32
	Height   uint32
}

func ParseMKV added in v1.6.3

func ParseMKV(filename string) (*MKVInfo, error)

func ParseWebM added in v1.6.3

func ParseWebM(filename string) (*MKVInfo, error)

type MP4Info added in v1.6.3

type MP4Info struct {
	Duration  int64
	Width     uint32
	Height    uint32
	Timescale uint32
}

func ParseMP4 added in v1.6.3

func ParseMP4(filename string) (*MP4Info, error)

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 SyncSet

type SyncSet[T comparable] struct {
	// contains filtered or unexported fields
}

func NewSyncSet

func NewSyncSet[T comparable]() *SyncSet[T]

func (*SyncSet[T]) Add

func (s *SyncSet[T]) Add(key T) bool

func (*SyncSet[T]) Clear

func (s *SyncSet[T]) Clear()

func (*SyncSet[T]) Clone

func (s *SyncSet[T]) Clone() *SyncSet[T]

func (*SyncSet[T]) Delete

func (s *SyncSet[T]) Delete(key T)

func (*SyncSet[T]) ForEach

func (s *SyncSet[T]) ForEach(fn func(key T) bool)

func (*SyncSet[T]) Has

func (s *SyncSet[T]) Has(key T) bool

func (*SyncSet[T]) Keys

func (s *SyncSet[T]) Keys() []T

func (*SyncSet[T]) Len

func (s *SyncSet[T]) Len() int

func (*SyncSet[T]) Pop

func (s *SyncSet[T]) Pop(key T) bool

type UpdatesGetStateParams

type UpdatesGetStateParams struct{}

Jump to

Keyboard shortcuts

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