Documentation ¶
Index ¶
- Variables
- func ConvertNTHighwayNetWork(ipv4s []*oidb2.IPv4) []*highway.NTHighwayIPv4
- func ParseNtloginResponse(response []byte, sig *auth.SigInfo) (loginState.State, error)
- type ClientDisconnectedEvent
- type ConnectionQualityInfo
- type EventHandle
- type QQClient
- func (c *QQClient) Device() *auth.DeviceInfo
- func (c *QQClient) Disconnect()
- func (c *QQClient) FecthQRCode() ([]byte, string, error)
- func (c *QQClient) FetchFriends() ([]*entity.Friend, error)
- func (c *QQClient) FetchGroupMember(groupID uint32, token string) ([]*entity.GroupMember, string, error)
- func (c *QQClient) FetchGroups() ([]*entity.Group, error)
- func (c *QQClient) FriendPoke(uin uint32) error
- func (c *QQClient) GetAllGroupsInfo() (map[uint32]*entity.Group, error)
- func (c *QQClient) GetAllGroupsMembersData() (map[uint32]map[uint32]*entity.GroupMember, error)
- func (c *QQClient) GetCachedAllGroupsInfo() (map[uint32]*entity.Group, error)
- func (c *QQClient) GetCachedFriendInfo(uin uint32) (*entity.Friend, error)
- func (c *QQClient) GetCachedGroupInfo(groupUin uint32) (*entity.Group, error)
- func (c *QQClient) GetCachedMemberInfo(uin, groupUin uint32) (*entity.GroupMember, error)
- func (c *QQClient) GetCachedMembersInfo(groupUin uint32) (map[uint32]*entity.GroupMember, error)
- func (c *QQClient) GetFriendsData() (map[uint32]*entity.Friend, error)
- func (c *QQClient) GetGroupMembersData(groupUin uint32) (map[uint32]*entity.GroupMember, error)
- func (c *QQClient) GetQRCodeResult() (qrcodeState.State, error)
- func (c *QQClient) GetStatistics() *Statistics
- func (c *QQClient) GetUid(uin uint32, groupUin ...uint32) string
- func (c *QQClient) GetUin(uid string, groupUin ...uint32) uint32
- func (c *QQClient) GroupKickMember(groupID, uin uint32, rejectAddRequest bool) error
- func (c *QQClient) GroupLeave(groupID uint32) error
- func (c *QQClient) GroupMuteGlobal(groupID uint32, isMute bool) error
- func (c *QQClient) GroupMuteMember(groupID, duration, uin uint32) error
- func (c *QQClient) GroupPoke(groupID, uin uint32) error
- func (c *QQClient) GroupRemark(groupID uint32, remark string) error
- func (c *QQClient) GroupRename(groupID uint32, name string) error
- func (c *QQClient) GroupRenameMember(groupID, uin uint32, name string) error
- func (c *QQClient) GroupSetAdmin(groupID, uin uint32, isAdmin bool) error
- func (c *QQClient) GroupSetSpecialTitle(groupUin, uin uint32, title string) error
- func (c *QQClient) ImageUploadGroup(groupUin uint32, element message.IMessageElement) (*message.GroupImageElement, error)
- func (c *QQClient) ImageUploadPrivate(targetUid string, element message.IMessageElement) (*message.FriendImageElement, error)
- func (c *QQClient) Login(password, qrcodePath string) error
- func (c *QQClient) NickName() string
- func (c *QQClient) PasswordLogin(password string) (loginState.State, error)
- func (c *QQClient) QRCodeConfirmed() error
- func (c *QQClient) QRCodeLogin(refreshInterval int) error
- func (c *QQClient) RecallGroupMessage(GrpUin, seq uint32) error
- func (c *QQClient) RefreshAllGroupMembersCache() error
- func (c *QQClient) RefreshAllGroupsInfo() error
- func (c *QQClient) RefreshFriendCache() error
- func (c *QQClient) RefreshGroupMembersCache(groupUin uint32) error
- func (c *QQClient) Release()
- func (c *QQClient) SendGroupMessage(groupUin uint32, elements []message2.IMessageElement) (resp *action.SendMessageResponse, err error)
- func (c *QQClient) SendPrivateMessage(uin uint32, elements []message2.IMessageElement) (resp *action.SendMessageResponse, err error)
- func (c *QQClient) SendRawMessage(route *message.RoutingHead, body *message.MessageBody) (resp *action.SendMessageResponse, err error)
- func (c *QQClient) SendSsoPacket(cmd string, body []byte) ([]byte, error)
- func (c *QQClient) SendTempMessage(groupID uint32, uin uint32, elements []message2.IMessageElement) (resp *action.SendMessageResponse, err error)
- func (c *QQClient) Sig() *auth.SigInfo
- func (c *QQClient) SubscribeEventHandler(handler any)
- func (c *QQClient) TokenLogin() (loginState.State, error)
- func (c *QQClient) UseDevice(d *auth.DeviceInfo)
- func (c *QQClient) UseSig(s auth.SigInfo)
- type Statistics
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ConvertNTHighwayNetWork ¶
func ConvertNTHighwayNetWork(ipv4s []*oidb2.IPv4) []*highway.NTHighwayIPv4
func ParseNtloginResponse ¶
Types ¶
type ClientDisconnectedEvent ¶
type ClientDisconnectedEvent struct {
Message string
}
type ConnectionQualityInfo ¶
type ConnectionQualityInfo struct { // ChatServerLatency 聊天服务器延迟 ChatServerLatency int64 // ChatServerPacketLoss 聊天服务器ICMP丢包数 ChatServerPacketLoss int // LongMessageServerLatency 长消息服务器延迟. 涉及长消息以及合并转发消息下载 LongMessageServerLatency int64 // LongMessageServerResponseLatency 长消息服务器返回延迟 LongMessageServerResponseLatency int64 // SrvServerLatency Highway服务器延迟. 涉及媒体以及群文件上传 SrvServerLatency int64 // SrvServerPacketLoss Highway服务器ICMP丢包数. SrvServerPacketLoss int }
ConnectionQualityInfo 客户端连接质量测试结果 延迟单位为 ms 如为 9999 则测试失败 测试方法为 TCP 连接测试 丢包测试方法为 ICMP. 总共发送 10 个包, 记录丢包数
type EventHandle ¶
type EventHandle[T any] struct { // contains filtered or unexported fields }
func (*EventHandle[T]) Subscribe ¶
func (handle *EventHandle[T]) Subscribe(handler func(client *QQClient, event T))
type QQClient ¶
type QQClient struct { Uin uint32 Online atomic.Bool TCP network.TCPClient // todo: combine other protocol state into one struct ConnectTime time.Time // event handles GroupMessageEvent EventHandle[*message.GroupMessage] PrivateMessageEvent EventHandle[*message.PrivateMessage] TempMessageEvent EventHandle[*message.TempMessage] GroupInvitedEvent EventHandle[*event.GroupInvite] // 邀请入群 GroupMemberJoinRequestEvent EventHandle[*event.GroupMemberJoinRequest] // 加群申请 GroupMemberJoinEvent EventHandle[*event.GroupMemberIncrease] // 成员入群 GroupMemberLeaveEvent EventHandle[*event.GroupMemberDecrease] // 成员退群 GroupMuteEvent EventHandle[*event.GroupMute] GroupRecallEvent EventHandle[*event.GroupRecall] FriendRequestEvent EventHandle[*event.FriendRequest] // 好友申请 FriendRecallEvent EventHandle[*event.FriendRecall] RenameEvent EventHandle[*event.Rename] DisconnectedEvent EventHandle[*ClientDisconnectedEvent] // contains filtered or unexported fields }
func (*QQClient) Device ¶
func (c *QQClient) Device() *auth.DeviceInfo
func (*QQClient) FetchFriends ¶
FetchFriends 获取好友列表信息
func (*QQClient) FetchGroupMember ¶
func (c *QQClient) FetchGroupMember(groupID uint32, token string) ([]*entity.GroupMember, string, error)
FetchGroupMember 获取对应群的群成员信息,使用token可以获取下一页的群成员信息
func (*QQClient) FetchGroups ¶
FetchGroups 获取所有已加入的群的信息
func (*QQClient) FriendPoke ¶
func (*QQClient) GetAllGroupsInfo ¶
func (*QQClient) GetAllGroupsMembersData ¶
GetAllGroupsMembersData 获取所有群的群成员信息
func (*QQClient) GetCachedAllGroupsInfo ¶
GetCachedAllGroupsInfo 获取所有群信息(缓存)
func (*QQClient) GetCachedFriendInfo ¶
GetCachedFriendInfo 获取好友信息(缓存)
func (*QQClient) GetCachedGroupInfo ¶
GetCachedGroupInfo 获取群信息(缓存)
func (*QQClient) GetCachedMemberInfo ¶
func (c *QQClient) GetCachedMemberInfo(uin, groupUin uint32) (*entity.GroupMember, error)
GetCachedMemberInfo 获取群成员信息(缓存)
func (*QQClient) GetCachedMembersInfo ¶
GetCachedMembersInfo 获取指定群所有群成员信息(缓存)
func (*QQClient) GetFriendsData ¶
GetFriendsData 获取好友列表数据
func (*QQClient) GetGroupMembersData ¶
GetGroupMembersData 获取指定群所有成员信息
func (*QQClient) GetQRCodeResult ¶
func (c *QQClient) GetQRCodeResult() (qrcodeState.State, error)
func (*QQClient) GetStatistics ¶
func (c *QQClient) GetStatistics() *Statistics
func (*QQClient) GroupKickMember ¶
func (*QQClient) GroupLeave ¶
func (*QQClient) GroupMuteGlobal ¶
func (*QQClient) GroupMuteMember ¶
func (*QQClient) GroupRenameMember ¶
func (*QQClient) GroupSetAdmin ¶
func (*QQClient) GroupSetSpecialTitle ¶
func (*QQClient) ImageUploadGroup ¶
func (c *QQClient) ImageUploadGroup(groupUin uint32, element message.IMessageElement) (*message.GroupImageElement, error)
func (*QQClient) ImageUploadPrivate ¶
func (c *QQClient) ImageUploadPrivate(targetUid string, element message.IMessageElement) (*message.FriendImageElement, error)
func (*QQClient) PasswordLogin ¶
func (c *QQClient) PasswordLogin(password string) (loginState.State, error)
func (*QQClient) QRCodeConfirmed ¶
func (*QQClient) QRCodeLogin ¶
func (*QQClient) RecallGroupMessage ¶
func (*QQClient) RefreshAllGroupMembersCache ¶
RefreshAllGroupMembersCache 刷新所有群的群成员缓存
func (*QQClient) RefreshAllGroupsInfo ¶
RefreshAllGroupsInfo 刷新所有群信息缓存
func (*QQClient) RefreshFriendCache ¶
RefreshFriendCache 刷新好友缓存
func (*QQClient) RefreshGroupMembersCache ¶
RefreshGroupMembersCache 刷新指定群的群成员员缓存
func (*QQClient) SendGroupMessage ¶
func (c *QQClient) SendGroupMessage(groupUin uint32, elements []message2.IMessageElement) (resp *action.SendMessageResponse, err error)
func (*QQClient) SendPrivateMessage ¶
func (c *QQClient) SendPrivateMessage(uin uint32, elements []message2.IMessageElement) (resp *action.SendMessageResponse, err error)
func (*QQClient) SendRawMessage ¶
func (c *QQClient) SendRawMessage(route *message.RoutingHead, body *message.MessageBody) (resp *action.SendMessageResponse, err error)
func (*QQClient) SendSsoPacket ¶
SendSsoPacket 发送签名回调包给服务器并获取返回结果供提交
func (*QQClient) SendTempMessage ¶
func (c *QQClient) SendTempMessage(groupID uint32, uin uint32, elements []message2.IMessageElement) (resp *action.SendMessageResponse, err error)
func (*QQClient) SubscribeEventHandler ¶
func (*QQClient) TokenLogin ¶
func (c *QQClient) TokenLogin() (loginState.State, error)
func (*QQClient) UseDevice ¶
func (c *QQClient) UseDevice(d *auth.DeviceInfo)
type Statistics ¶
type Statistics struct { PacketReceived atomic.Uint64 PacketSent atomic.Uint64 PacketLost atomic.Uint64 MessageReceived atomic.Uint64 MessageSent atomic.Uint64 LastMessageTime atomic.Int64 DisconnectTimes atomic.Uint32 LostTimes atomic.Uint32 }
func (*Statistics) MarshalJSON ¶
func (m *Statistics) MarshalJSON() ([]byte, error)
MarshalJSON encodes the wrapped statistics into JSON.