gocq

package
v1.3.1-pre-2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2025 License: AGPL-3.0 Imports: 48 Imported by: 0

Documentation

Overview

Package gocq 程序的主体部分

Index

Constants

This section is empty.

Variables

View Source
var ErrSMSRequestError = errors.New("sms request error")

ErrSMSRequestError SMS请求出错

Functions

func InitBase

func InitBase()

InitBase 解析参数并检测

如果在 windows 下双击打开了程序,程序将在此函数释出脚本后终止;
如果传入 -h 参数,程序将打印帮助后终止;
如果传入 -d 参数,程序将在启动 daemon 后终止。

func LoginInteract

func LoginInteract()

LoginInteract 登录交互, 可能需要键盘输入, 必须在 InitBase, PrepareData 之后执行

func PasswordHashDecrypt

func PasswordHashDecrypt(encryptedPasswordHash string, key []byte) ([]byte, error)

PasswordHashDecrypt 使用key解密给定passwordHash

func PasswordHashEncrypt

func PasswordHashEncrypt(passwordHash []byte, key []byte) string

PasswordHashEncrypt 使用key加密给定passwordHash

func PrepareData

func PrepareData()

PrepareData 准备 log, 缓存, 数据库, 必须在 InitBase 之后执行

func WaitSignal

func WaitSignal()

WaitSignal 在新线程检查更新和网络并等待信号, 必须在 InitBase, PrepareData, LoginInteract 之后执行

  • 直接返回: os.Interrupt, syscall.SIGTERM
  • dump stack: syscall.SIGQUIT, syscall.SIGUSR1

Types

type SignClient

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

SignClient handles requests to the sign server.

func NewSignClient

func NewSignClient(c *client.QQClient) *SignClient

NewSignClient creates a new SignClient instance.

func (*SignClient) Energy

func (c *SignClient) Energy(id string, sdkVersion string, salt []byte) ([]byte, error)

Energy requests energy data from the sign server.

func (*SignClient) Sign

func (c *SignClient) Sign(seq uint64, uin string, cmd string, buff []byte) (sign []byte, extra []byte, token []byte, err error)

Sign sends a sign request and returns the sign, extra, and token data.

func (*SignClient) SignWhiteList

func (c *SignClient) SignWhiteList() (whitelist []string, err error)

SignWhiteList retrieves the sign whitelist.

type SignServerManager

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

SignServerManager manages the current sign server and handles server selection.

func NewSignServerManager

func NewSignServerManager(client *SignClient) *SignServerManager

NewSignServerManager creates a new SignServerManager instance.

func (*SignServerManager) Get

Get returns the current sign server.

func (*SignServerManager) GetAvailableSignServer

func (m *SignServerManager) GetAvailableSignServer() (*config.SignServer, error)

GetAvailableSignServer retrieves an available sign server or returns an error if none are available.

func (*SignServerManager) HasOver

func (m *SignServerManager) HasOver(count uintptr) bool

HasOver checks if the error count exceeds the specified value.

func (*SignServerManager) IncrementErrorCount

func (m *SignServerManager) IncrementErrorCount()

IncrementErrorCount increases the error count by one.

func (*SignServerManager) Set

func (m *SignServerManager) Set(server *config.SignServer)

Set updates the current sign server.

Jump to

Keyboard shortcuts

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