Documentation
¶
Overview ¶
Package gocq 程序的主体部分
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 ¶
PasswordHashDecrypt 使用key解密给定passwordHash
func PasswordHashEncrypt ¶
PasswordHashEncrypt 使用key加密给定passwordHash
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) 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 ¶
func (m *SignServerManager) Get() *config.SignServer
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.