Documentation
¶
Index ¶
- func BoolEnv(b *bool, key string)
- func GetEnv(key string, defaultValue string) string
- func GetEnvBool(key string, defaultValue bool) bool
- func GetEnvFloat64(key string, defaultValue float64) float64
- func GetEnvInt(key string, defaultValue int) int
- func GetEnvInt64(key string, defaultValue int64) int64
- func StringEnv(v *string, key string)
- type APNSPush
- type AliyunInternationalSMSConfig
- type AliyunSMSConfig
- type AsyncTask
- func (a *AsyncTask) LaunchWorker(consumerTag string, concurrency int) error
- func (a *AsyncTask) RegisterTask(name string, taskFunc interface{}) error
- func (a *AsyncTask) RegisterTasks(namedTaskFuncs map[string]interface{}) error
- func (a *AsyncTask) SendTask(task *tasks.Signature) (*result.AsyncResult, error)
- func (a *AsyncTask) SendTaskWithContext(ctx context.Context, task *tasks.Signature) (*result.AsyncResult, error)
- type CMDGroupAvatarUpdateReq
- type CMDResp
- type COSConfig
- type Channel
- type ChannelBlacklistReq
- type ChannelCreateReq
- type ChannelDeleteReq
- type ChannelInfoCreateReq
- type ChannelMaxSeqResp
- type ChannelReq
- type ChannelWhitelistReq
- type ClearConversationUnreadReq
- type Config
- func (c *Config) ComposeCustomerServiceChannelID(vid string, channelID string) string
- func (c *Config) ConfigFileUsed() string
- func (c *Config) ConfigureWithViper(vp *viper.Viper)
- func (c *Config) GetAvatarPath(uid string) string
- func (c *Config) GetCommunityAvatarFilePath(communityNo string, version ...int64) string
- func (c *Config) GetCommunityCoverFilePath(communityNo string, version ...int64) string
- func (c *Config) GetCustomerServiceChannelID(channelID string) (string, bool)
- func (c *Config) GetCustomerServiceVisitorUID(channelID string) (string, bool)
- func (c *Config) GetGroupAvatarFilePath(groupNo string, version ...int64) string
- func (c *Config) GetOrganizationLogoFilePath(orgId string) string
- func (c *Config) IsVisitor(uid string) bool
- func (c *Config) IsVisitorChannel(uid string) bool
- func (c *Config) WuKongIMManagerTokenHeaderMap() map[string]string
- type Context
- func (c *Context) AddEventListener(event string, listener EventListener)
- func (c *Context) AddMessagesListener(listener MessagesListener)
- func (c *Context) AddOnlineStatusListener(listener OnlineStatusListener)
- func (c *Context) AsyncTask() *AsyncTask
- func (c *Context) AuthMiddleware(r *wkhttp.WKHttp) wkhttp.HandlerFunc
- func (c *Context) Cache() cache.Cache
- func (c *Context) DB() *dbr.Session
- func (c *Context) EventBegin(data *wkevent.Data, tx *dbr.Tx) (int64, error)
- func (c *Context) EventCommit(eventID int64)
- func (c *Context) GenSeq(flag string) (int64, error)
- func (c *Context) GetAllOnlineStatusListeners() []OnlineStatusListener
- func (c *Context) GetConfig() *Config
- func (c *Context) GetElasticsearch() *elastic.Client
- func (c *Context) GetEventListeners(event string) []EventListener
- func (c *Context) GetHttpRoute() *wkhttp.WKHttp
- func (c *Context) GetRedisConn() *redis.Conn
- func (c *Context) IMAddSubscriber(req *SubscriberAddReq) error
- func (c *Context) IMBlacklistAdd(req ChannelBlacklistReq) error
- func (c *Context) IMBlacklistRemove(req ChannelBlacklistReq) error
- func (c *Context) IMBlacklistSet(req ChannelBlacklistReq) error
- func (c *Context) IMClearConversationUnread(req ClearConversationUnreadReq) error
- func (c *Context) IMCreateOrUpdateChannel(req *ChannelCreateReq) error
- func (c *Context) IMCreateOrUpdateChannelInfo(req *ChannelInfoCreateReq) error
- func (c *Context) IMDelChannel(req *ChannelDeleteReq) error
- func (c *Context) IMDeleteConversation(req DeleteConversationReq) error
- func (c *Context) IMGetChannelMaxSeq(channelID string, channelType uint8) (*ChannelMaxSeqResp, error)
- func (c *Context) IMGetConversations(uid string) ([]*ConversationResp, error)
- func (c *Context) IMGetWithChannelAndSeqs(channelID string, channelType uint8, loginUID string, seqs []uint32) (*SyncChannelMessageResp, error)
- func (c *Context) IMRemoveSubscriber(req *SubscriberRemoveReq) error
- func (c *Context) IMRevokeMessage(req *MessageRevokeReq) error
- func (c *Context) IMSOnlineStatus(uids []string) ([]*OnlinestatusResp, error)
- func (c *Context) IMSearchMessages(req *MsgSearchReq) (*SyncChannelMessageResp, error)
- func (c *Context) IMSearchUserMessages(req *SearchUserMessageReq) (*SearchUserMessageResp, error)
- func (c *Context) IMStreamEnd(req MessageStreamEndReq) error
- func (c *Context) IMStreamStart(req MessageStreamStartReq) (string, error)
- func (c *Context) IMSyncChannelMessage(req SyncChannelMessageReq) (*SyncChannelMessageResp, error)
- func (c *Context) IMSyncMessage(req *MsgSyncReq) ([]*MessageResp, error)
- func (c *Context) IMSyncMessageAck(req *SyncackReq) error
- func (c *Context) IMSyncUserConversation(uid string, version int64, msgCount int64, lastMsgSeqs string, ...) ([]*SyncUserConversationResp, error)
- func (c *Context) IMWhitelistAdd(req ChannelWhitelistReq) error
- func (c *Context) IMWhitelistRemove(req ChannelWhitelistReq) error
- func (c *Context) IMWhitelistSet(req ChannelWhitelistReq) error
- func (c *Context) NewMemoryCache() cache.Cache
- func (c *Context) NewMySQL() *dbr.Session
- func (c *Context) NewRedisCache() *common.RedisCache
- func (c *Context) NotifyMessagesListeners(messages []*MessageResp)
- func (c *Context) QuitUserDevice(uid string, deviceFlag int) error
- func (c *Context) Schedule(interval time.Duration, f func()) *timingwheel.Timer
- func (c *Context) SendCMD(req MsgCMDReq) error
- func (c *Context) SendChannelUpdate(channel ChannelReq, updateChannel ChannelReq) error
- func (c *Context) SendChannelUpdateToGroup(groupNo string) error
- func (c *Context) SendChannelUpdateToUser(uid string, channel ChannelReq) error
- func (c *Context) SendChannelUpdateWithFromUID(channel ChannelReq, updateChannel ChannelReq, fromUID string) error
- func (c *Context) SendFriendApply(req *MsgFriendApplyReq) error
- func (c *Context) SendFriendDelete(req *MsgFriendDeleteReq) error
- func (c *Context) SendFriendSure(req *MsgFriendSureReq) error
- func (c *Context) SendGroupCreate(req *MsgGroupCreateReq) error
- func (c *Context) SendGroupExit(groupNo string, uid string, name string, visibleUids []string) error
- func (c *Context) SendGroupMemberAdd(req *MsgGroupMemberAddReq) error
- func (c *Context) SendGroupMemberBeRemove(req *MsgGroupMemberRemoveReq) error
- func (c *Context) SendGroupMemberInviteReq(req MsgGroupMemberInviteReq) error
- func (c *Context) SendGroupMemberRemove(req *MsgGroupMemberRemoveReq) error
- func (c *Context) SendGroupMemberScanJoin(req MsgGroupMemberScanJoin) error
- func (c *Context) SendGroupMemberUpdate(groupNo string) error
- func (c *Context) SendGroupTransferGrouper(req MsgGroupTransferGrouper) error
- func (c *Context) SendGroupUpdate(req *MsgGroupUpdateReq) error
- func (c *Context) SendGroupUpgrade(groupNo string) error
- func (c *Context) SendMessage(req *MsgSendReq) error
- func (c *Context) SendMessageBatch(req *MsgSendBatch) error
- func (c *Context) SendMessageWithResult(req *MsgSendReq) (*MsgSendResp, error)
- func (c *Context) SendRTCCallResult(req P2pRtcMessageReq) error
- func (c *Context) SendRevoke(req *MsgRevokeReq) error
- func (c *Context) SendTyping(channelID string, channelType uint8, fromUID string) error
- func (c *Context) SendUnableAddDestoryAccountInGroup(req *MsgGroupCreateReq) error
- func (c *Context) SetHttpRoute(r *wkhttp.WKHttp)
- func (c *Context) SetValue(value interface{}, key string)
- func (c *Context) Tracer() *Tracer
- func (c *Context) UpdateIMToken(req UpdateIMTokenReq) (*UpdateIMTokenResp, error)
- func (c *Context) Value(key string) any
- type ConversationResp
- type DeleteConversationReq
- type DeviceFlag
- type DeviceLevel
- type EmptySpan
- func (e *EmptySpan) BaggageItem(restrictedKey string) string
- func (e *EmptySpan) Context() opentracing.SpanContext
- func (e *EmptySpan) Finish()
- func (e *EmptySpan) FinishWithOptions(opts opentracing.FinishOptions)
- func (e *EmptySpan) Log(data opentracing.LogData)
- func (e *EmptySpan) LogEvent(event string)
- func (e *EmptySpan) LogEventWithPayload(event string, payload interface{})
- func (e *EmptySpan) LogFields(fields ...log.Field)
- func (e *EmptySpan) LogKV(alternatingKeyValues ...interface{})
- func (e *EmptySpan) SetBaggageItem(restrictedKey, value string) opentracing.Span
- func (e *EmptySpan) SetOperationName(operationName string) opentracing.Span
- func (e *EmptySpan) SetTag(key string, value interface{}) opentracing.Span
- func (e *EmptySpan) Tracer() opentracing.Tracer
- type EmptySpanContext
- type EventCommit
- type EventListener
- type FIREBASEPush
- type FileService
- type HMSPush
- type MIPush
- type MessageDeleteReq
- type MessageResp
- type MessageRevokeReq
- type MessageStreamEndReq
- type MessageStreamStartReq
- type MessagesListener
- type MinioConfig
- type Mode
- type MsgCMDReq
- type MsgFriendApplyReq
- type MsgFriendDeleteReq
- type MsgFriendSureReq
- type MsgGroupCreateReq
- type MsgGroupDisband
- type MsgGroupMemberAddReq
- type MsgGroupMemberInviteReq
- type MsgGroupMemberRemoveReq
- type MsgGroupMemberScanJoin
- type MsgGroupTransferGrouper
- type MsgGroupUpdateReq
- type MsgHeader
- type MsgOrgOrDeptCreateReq
- type MsgOrgOrDeptEmployeeAddReq
- type MsgOrgOrDeptEmployeeUpdateReq
- type MsgRevokeReq
- type MsgSearchReq
- type MsgSendBatch
- type MsgSendReq
- type MsgSendResp
- type MsgSyncReq
- type OPPOPush
- type OSSConfig
- type OnlineStatus
- type OnlineStatusListener
- type OnlinestatusResp
- type OrgEmployeeExitReq
- type OrgOrDeptEmployeeVO
- type P2pRtcMessageReq
- type PersonalMsgOptions
- type PullMode
- type QiniuConfig
- type ReactionResp
- type S3Config
- type SMSProvider
- type SearchUserMessageReq
- type SearchUserMessageResp
- type SeaweedConfig
- type Seq
- type Setting
- type SmsbaoConfig
- type StreamItemResp
- type SubscriberAddReq
- type SubscriberRemoveReq
- type SyncChannelMessageReq
- type SyncChannelMessageResp
- type SyncUserConversationResp
- type SyncUserConversationRespWrap
- type SyncackReq
- type TablePartitionConfig
- type Tracer
- func (t *Tracer) Close() error
- func (t *Tracer) ContextWithSpan(ctx context.Context, span opentracing.Span) context.Context
- func (t *Tracer) Extract(format interface{}, carrier interface{}) (opentracing.SpanContext, error)
- func (t *Tracer) ExtractHTTPHeader(header http.Header) (opentracing.SpanContext, error)
- func (t *Tracer) GinMiddle() gin.HandlerFunc
- func (t *Tracer) Inject(sm opentracing.SpanContext, format interface{}, carrier interface{}) error
- func (t *Tracer) InjectHTTPHeader(sm opentracing.SpanContext, header http.Header) error
- func (t *Tracer) StartSpan(operationName string, opts ...opentracing.StartSpanOption) opentracing.Span
- func (t *Tracer) StartSpanFromContext(ctx context.Context, operationName string, opts ...opentracing.StartSpanOption) (opentracing.Span, context.Context)
- type UnismsConfig
- type UpdateIMTokenReq
- type UpdateIMTokenResp
- type UpdateSearchMessageReq
- type UpdateTokenStatus
- type UserBaseVo
- type UserResp
- type VIVOPush
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetEnvFloat64 ¶
GetEnvFloat64 环境变量获取
Types ¶
type AliyunInternationalSMSConfig ¶
type AliyunInternationalSMSConfig struct {
AccessKeyID string // aliyun的AccessKeyID
AccessSecret string // aliyun的AccessSecret
SignName string // 签名
}
AliyunInternationalSMSConfig 阿里云短信
type AliyunSMSConfig ¶
type AliyunSMSConfig struct {
AccessKeyID string // aliyun的AccessKeyID
AccessSecret string // aliyun的AccessSecret
TemplateCode string // aliyun的短信模版
SignName string // 签名
}
AliyunSMSConfig 阿里云短信
type AsyncTask ¶
AsyncTask 异步任务
func (*AsyncTask) LaunchWorker ¶
LaunchWorker 启动消费worker [concurrency]并发数
func (*AsyncTask) RegisterTask ¶
RegisterTask 注册任务
func (*AsyncTask) RegisterTasks ¶
RegisterTasks 注册任务
func (*AsyncTask) SendTaskWithContext ¶
func (a *AsyncTask) SendTaskWithContext(ctx context.Context, task *tasks.Signature) (*result.AsyncResult, error)
SendTaskWithContext 发送任务
type CMDGroupAvatarUpdateReq ¶
type CMDGroupAvatarUpdateReq struct {
GroupNo string `json:"group_no"` // 群编号
Members []string `json:"members"` // 成员uids
}
CMDGroupAvatarUpdateReq 群头像更新请求
type CMDResp ¶
type CMDResp struct {
CMD string `json:"cmd"`
Param interface{} `json:"param"`
}
CMDResp CMDResp
type COSConfig ¶
type COSConfig struct {
SecretID string // 腾讯云 SecretId
SecretKey string // 腾讯云 SecretKey
Bucket string // 存储桶名(如 my-bucket-12345678)
Region string // 地域(如 ap-beijing)
BucketURL string // 访问域名(如 https://my-bucket-12345678.cos.example.com)
Prefix string // 环境前缀,多环境共用 bucket 时隔离路径(如 "dev")
}
COSConfig 腾讯云COS配置
type ChannelBlacklistReq ¶
type ChannelBlacklistReq struct {
ChannelReq
UIDs []string `json:"uids"` // 黑名单用户
}
ChannelBlacklistReq 黑名单
type ChannelCreateReq ¶
type ChannelCreateReq struct {
ChannelID string `json:"channel_id"` // 频道ID
ChannelType uint8 `json:"channel_type"` // 频道类型
Ban int `json:"ban"` // 是否被封禁(被封后 任何人都不能发消息,包括创建者)
Large int `json:"large"` // 是否是超大群(一般建议500或1000成员以上设置为超大群,超大群,注意:超大群不会维护最近会话数据)
Subscribers []string `json:"subscribers"` // 订阅者
}
ChannelCreateReq 频道创建请求
type ChannelDeleteReq ¶
type ChannelDeleteReq struct {
ChannelID string `json:"channel_id"` // 频道ID
ChannelType uint8 `json:"channel_type"` // 频道类型
}
ChannelDeleteReq 删除频道请求
type ChannelInfoCreateReq ¶
type ChannelInfoCreateReq struct {
ChannelID string `json:"channel_id"` // 频道ID
ChannelType uint8 `json:"channel_type"` // 频道类型
Ban int `json:"ban"` // 是否封禁
Large int `json:"large"` // 是否大群
Disband int `json:"disband"` // 是否解散(1.已解散,WuKongIM 在发送权限检查最前面拒绝所有发送者,含群主)
}
ChannelInfoCreateReq
type ChannelMaxSeqResp ¶
type ChannelMaxSeqResp struct {
MessageSeq uint32 `json:"message_seq"` // 最大序列号
}
ChannelMaxSeqResp 频道最大序列号返回
type ChannelReq ¶
type ChannelReq struct {
ChannelID string `json:"channel_id"` // 频道ID
ChannelType uint8 `json:"channel_type"` // 频道类型
}
ChannelReq ChannelReq
type ChannelWhitelistReq ¶
type ChannelWhitelistReq struct {
ChannelReq
UIDs []string `json:"uids"` // 白名单用户
}
ChannelWhitelistReq 白名单
type ClearConversationUnreadReq ¶
type ClearConversationUnreadReq struct {
UID string `json:"uid"`
ChannelID string `json:"channel_id"`
ChannelType uint8 `json:"channel_type"`
Unread int `json:"unread"`
MessageSeq uint32 `json:"message_seq"`
}
ClearConversationUnreadReq 清除用户某个频道未读数请求
type Config ¶
type Config struct {
// ---------- 基础配置 ----------
Mode Mode // 模式 debug 测试 release 正式 bench 压力测试
AppID string // APP ID
AppName string // APP名称
Version string // 版本
RootDir string // 数据根目录
Addr string // 服务监听地址 x.x.x.x:8080
GRPCAddr string // grpc的通信地址 (建议内网通信)
SSLAddr string // ssl 监听地址
MessageSaveAcrossDevice bool // 消息是否跨设备保存(换设备登录消息是否还能同步到老消息)
WelcomeMessage string // 登录注册欢迎语
PhoneSearchOff bool // 是否关闭手机号搜索
OnlineStatusOn bool // 是否开启在线状态显示
GroupUpgradeWhenMemberCount int // 当成员数量大于此配置时 自动升级为超级群 默认为 1000
EventPoolSize int64 // 事件任务池大小
AdminPwd string // 后台管理默认密码
// ---------- 外网配置 ----------
External struct {
IP string // 外网IP
BaseURL string // 本服务的对外的基础地址
H5BaseURL string // h5页面的基地址 如果没有配置默认未 BaseURL + /web
APIBaseURL string // api的基地址 如果没有配置默认未 BaseURL + /v1
WebLoginURL string // web登录地址
}
// ---------- 日志配置 ----------
Logger struct {
Dir string // 日志存储目录
Level zapcore.Level
LineNum bool // 是否显示代码行数
}
// ---------- db相关配置 ----------
DB struct {
MySQLAddr string // mysql的连接信息
MySQLMaxOpenConns int // 最大连接数
MySQLMaxIdleConns int // 最大空闲连接数
MySQLConnMaxLifetime time.Duration // 连接最大生命周期
Migration bool // 是否合并数据库
RedisAddr string // redis地址
RedisPass string // redis密码
RedisTLS bool // 是否启用 TLS 连接 Redis(rediss://),用于 AWS ElastiCache / Azure Cache 等托管服务
RedisTLSInsecureSkipVerify bool // 是否跳过 TLS 证书校验(仅用于测试 / 自签名证书场景)
RedisTLSCAFile string // 自定义 CA 证书文件路径(可选)
AsynctaskRedisAddr string // 异步任务的redis地址 不写默认为RedisAddr的地址
}
// ---------- 分布式配置 ----------
Cluster struct {
NodeID int // 节点ID 节点ID需要小于1024
}
// ---------- 缓存配置 ----------
Cache struct {
TokenCachePrefix string // token缓存前缀
LoginDeviceCachePrefix string // 登录设备缓存前缀
LoginDeviceCacheExpire time.Duration // 登录设备缓存过期时间
UIDTokenCachePrefix string // uidtoken缓存前缀
FriendApplyTokenCachePrefix string // 申请好友的token的前缀
FriendApplyExpire time.Duration // 好友申请过期时间
TokenExpire time.Duration // token失效时间
NameCacheExpire time.Duration // 名字缓存过期时间
}
// ---------- 系统账户设置 ----------
Account struct {
SystemUID string //系统账号uid
FileHelperUID string // 文件助手uid
SystemGroupID string //系统群ID 需求在app_config表里设置new_user_join_system_group为1才有效
SystemGroupName string // 系统群的名字
AdminUID string //系统管理员账号
}
FileService FileService // 文件服务
OSS OSSConfig // 阿里云oss配置
Minio MinioConfig // minio配置
Seaweed SeaweedConfig // seaweedfs配置
Qiniu QiniuConfig // 七牛云配置
COS COSConfig // 腾讯云COS配置
S3 S3Config // S3 / S3兼容存储配置(AWS S3、Cloudflare R2、Backblaze B2、Wasabi 等)
// ---------- 短信运营商 ----------
SMSCode string // 模拟的短信验证码
SMSProvider SMSProvider
UniSMS UnismsConfig // unisms https://unisms.apistd.com/
AliyunSMS AliyunSMSConfig // aliyun sms
AliyunInternationalSMS AliyunInternationalSMSConfig // 阿里云国际短信
Smsbao SmsbaoConfig // 短信宝
// ---------- 悟空IM ----------
WuKongIM struct {
APIURL string // im基地址
ManagerToken string // im的管理者token wukongim配置了就需要填写,没配置就不需要
}
// ---------- 头像 ----------
Avatar struct {
Default string // 默认头像
DefaultCount int // 默认头像数量
Partition int // 头像分区数量
DefaultBaseURL string // 默认头像的基地址
}
// ---------- 短编号 ----------
ShortNo struct {
NumOn bool // 是否开启数字短编号
NumLen int // 数字短编号长度
EditOff bool // 是否关闭短编号编辑
}
// ---------- robot ----------
Robot struct {
MessageExpire time.Duration // 消息过期时间
InlineQueryTimeout time.Duration // inlineQuery事件过期时间
EventPoolSize int64 // 机器人事件池大小
}
// ---------- gitee ----------
Gitee struct {
OAuthURL string // gitee oauth url
ClientID string // gitee client id
ClientSecret string // gitee client secret
}
// ---------- github ----------
Github struct {
OAuthURL string // github oauth url
ClientID string // github client id
ClientSecret string // github client secret
}
// ---------- owt ----------
OWT struct {
URL string // owt api地址 例如: https://xx.xx.xx.xx:3000/v1
ServiceID string // owt的服务ID
ServiceKey string // owt的服务key (用户访问后台的api)
RoomMaxCount int // 房间最大参与人数
}
// ---------- livekit ----------
Livekit struct {
Off bool // 是否关闭livekit功能
URL string // livekit连接地址 wss://xx.xx.xx.xx:7880
APIKey string // livekit api key
APISecret string // livekit api secret
InviteTimeoutSeconds int // 邀请超时时间(单位秒)
RoomMaxCount int // 房间最大参与人数
}
// ---------- 注册 ----------
Register struct {
Off bool // 是否关闭注册
OnlyChina bool // 是否仅仅中国手机号可以注册
StickerAddOff bool // 是否关闭注册添加表情
UsernameOn bool // 是否开启用户名注册
EmailOn bool // 是否开启邮箱注册/登录
}
Organization struct {
ImportOn bool // 是否开启导入组织信息
}
// ---------- 好友 ----------
Friend struct {
AddedTipsText string // 成为好友系统提示消息
}
// ---------- 消息搜索 ----------
ZincSearch struct {
SearchOn bool // 是否开启消息搜索
APIURL string // ZincSearch 请求地址
ZincUsername string // ZincSearch 登录用户名
ZincPassword string // ZincSearch 登录密码
SyncIntervalSecond int // 同步消息间隔时间(单位秒)
SyncCount int // 每张表每次同步数量 默认100条
}
// ---------- 消息检索读侧后端切换(YUJ-4530 ETL→Kafka→ES indexer) ----------
// ReadBackend 选择检索读路径走哪个后端:"zinc"(ZincSearch,默认/现状)或 "es"(OpenSearch + 查询侧 join)。
// 双写灰度期保持 ZincSearch 写入开启,仅切读;稳定后才下线 Zinc 写。
Search struct {
ReadBackend string // "zinc" | "es",默认 "zinc"
}
// ---------- es-indexer 的 OpenSearch 写入(独立镜像 binary 用,不复用 ElasticsearchURL/olivere v6) ----------
ESIndex struct {
On bool // 是否开启 OpenSearch bulk 写入
Addrs []string // OpenSearch 节点地址列表,如 ["https://opensearch:9200"]
Username string // 基础认证用户名
Password string // 基础认证密码
Index string // 索引名(写读同名/或读用别名),默认 octo-message
}
// ---------- 群 ----------
Group struct {
SameDayCreateMaxCount int // 同一天创建群的最大数量
CreateGroupVerifyFriendOn bool // 建群是否开启好友验证
}
// ---------- push ----------
Push struct {
ContentDetailOn bool // 推送是否显示正文详情(如果为false,则只显示“您有一条新的消息” 默认为true)
PushPoolSize int64 // 推送任务池大小
APNS APNSPush // 苹果推送
MI MIPush // 小米推送
HMS HMSPush // 华为推送
VIVO VIVOPush // vivo推送
OPPO OPPOPush // oppo推送
FIREBASE FIREBASEPush // FIREBASE推送
}
// ---------- message ----------
Message struct {
SendMessageOn bool // 是否开启接口发送发送消息
SyncReadedCountIntervalSecond int // 同步消息已读数量间隔时间(单位秒)
}
// ---------- wechat ----------
Wechat struct {
AppID string // 微信appid 在开放平台内
AppSecret string
}
// ---------- tracing ----------
Tracing struct {
On bool // 是否开启tracing
Addr string // tracer的地址
}
// ---------- support ----------
Support struct {
Email string // 技术支持的邮箱地址
EmailSmtp string // 技术支持的邮箱的smtp
EmailPwd string // 邮箱密码
}
Test bool // 是否是测试模式
QRCodeInfoURL string // 获取二维码信息的URL
VisitorUIDPrefix string // 访客uid的前缀
TimingWheelTick duration // The time-round training interval must be 1ms or more
TimingWheelSize int64 // Time wheel size
ElasticsearchURL string // elasticsearch 地址
TablePartitionConfig TablePartitionConfig
// ---------- 系统配置 由系统生成,无需用户配置 ----------
AppRSAPrivateKey string
AppRSAPubKey string
// contains filtered or unexported fields
}
Config 配置信息
func (*Config) ComposeCustomerServiceChannelID ¶
组合客服ID
func (*Config) ConfigFileUsed ¶
func (*Config) ConfigureWithViper ¶
func (*Config) GetAvatarPath ¶
GetAvatarPath 获取用户头像path
func (*Config) GetCommunityAvatarFilePath ¶
GetCommunityAvatarFilePath 获取社区头像上传路径。 不传 version 或 version <= 0 时返回旧版稳定路径;version > 0 时返回带版本的路径。
func (*Config) GetCommunityCoverFilePath ¶
GetCommunityCoverFilePath 获取社区封面上传路径。 不传 version 或 version <= 0 时返回旧版稳定路径;version > 0 时返回带版本的路径, 版本路径形态避免与旧版 community/<partition>/<community_no>_cover.png 冲突。
func (*Config) GetCustomerServiceChannelID ¶
获取客服频道真实ID
func (*Config) GetCustomerServiceVisitorUID ¶
获取客服频道的访客id
func (*Config) GetGroupAvatarFilePath ¶
GetGroupAvatarFilePath 获取群头像上传路径。 不传 version 或 version <= 0 时返回旧版稳定路径;version > 0 时返回带版本的路径, 使对象键随每次上传变化,以规避忽略 query string 的 CDN 缓存。
func (*Config) GetOrganizationLogoFilePath ¶
GetOrganizationLogoFilePath 获取组织logo上传路径
func (*Config) IsVisitorChannel ¶
IsVisitorChannel 是访客频道
func (*Config) WuKongIMManagerTokenHeaderMap ¶
WuKongIMManagerTokenHeaderMap 返回 WuKongIM 管理 API 的认证 header (公共方法供外部模块使用)
type Context ¶
type Context struct {
log.Log
EventPool pool.Collector
PushPool pool.Collector // 离线push
RobotEventPool pool.Collector // 机器人事件pool
Event wkevent.Event
UserIDGen *snowflake.Node // 消息ID生成器
SetupTask bool // 是否安装task
// contains filtered or unexported fields
}
Context 配置上下文
func (*Context) AddEventListener ¶
func (c *Context) AddEventListener(event string, listener EventListener)
AddEventListener 添加事件监听
func (*Context) AddMessagesListener ¶
func (c *Context) AddMessagesListener(listener MessagesListener)
AddMessagesListener 添加消息监听者
func (*Context) AddOnlineStatusListener ¶
func (c *Context) AddOnlineStatusListener(listener OnlineStatusListener)
AddOnlineStatusListener 添加在线状态监听
func (*Context) AuthMiddleware ¶
func (c *Context) AuthMiddleware(r *wkhttp.WKHttp) wkhttp.HandlerFunc
认证中间件
func (*Context) EventBegin ¶
EventBegin 开启事件
func (*Context) GenSeq ¶
GenSeq generates a monotonically increasing sequence number for the given flag. It is safe for concurrent use.
func (*Context) GetAllOnlineStatusListeners ¶
func (c *Context) GetAllOnlineStatusListeners() []OnlineStatusListener
GetAllOnlineStatusListeners 获取所有在线监听者
func (*Context) GetElasticsearch ¶
GetElasticsearch 获取Elasticsearch客户端
func (*Context) GetEventListeners ¶
func (c *Context) GetEventListeners(event string) []EventListener
GetEventListeners 获取某个事件
func (*Context) GetHttpRoute ¶
func (*Context) GetRedisConn ¶
GetRedisConn GetRedisConn
func (*Context) IMAddSubscriber ¶
func (c *Context) IMAddSubscriber(req *SubscriberAddReq) error
IMAddSubscriber 请求IM创建频道
func (*Context) IMBlacklistAdd ¶
func (c *Context) IMBlacklistAdd(req ChannelBlacklistReq) error
IMBlacklistAdd 添加黑名单
func (*Context) IMBlacklistRemove ¶
func (c *Context) IMBlacklistRemove(req ChannelBlacklistReq) error
IMBlacklistRemove 移除黑名单
func (*Context) IMBlacklistSet ¶
func (c *Context) IMBlacklistSet(req ChannelBlacklistReq) error
IMBlacklistSet 设置黑名单
func (*Context) IMClearConversationUnread ¶
func (c *Context) IMClearConversationUnread(req ClearConversationUnreadReq) error
IMClearConversationUnread 清除用户某个频道的未读数
func (*Context) IMCreateOrUpdateChannel ¶
func (c *Context) IMCreateOrUpdateChannel(req *ChannelCreateReq) error
IMCreateOrUpdateChannel 请求IM创建或更新频道
func (*Context) IMCreateOrUpdateChannelInfo ¶
func (c *Context) IMCreateOrUpdateChannelInfo(req *ChannelInfoCreateReq) error
IMCreateOrUpdateChannelInfo 修改或创建channel信息
func (*Context) IMDelChannel ¶
func (c *Context) IMDelChannel(req *ChannelDeleteReq) error
IMDelChannel 删除频道
func (*Context) IMDeleteConversation ¶
func (c *Context) IMDeleteConversation(req DeleteConversationReq) error
IMDeleteConversation 删除最近会话
func (*Context) IMGetChannelMaxSeq ¶
func (c *Context) IMGetChannelMaxSeq(channelID string, channelType uint8) (*ChannelMaxSeqResp, error)
IMGetChannelMaxSeq
func (*Context) IMGetConversations ¶
func (c *Context) IMGetConversations(uid string) ([]*ConversationResp, error)
IMGetConversations 获取用户最近会话列表
func (*Context) IMGetWithChannelAndSeqs ¶
func (c *Context) IMGetWithChannelAndSeqs(channelID string, channelType uint8, loginUID string, seqs []uint32) (*SyncChannelMessageResp, error)
IMGetWithChannelAndSeqs
func (*Context) IMRemoveSubscriber ¶
func (c *Context) IMRemoveSubscriber(req *SubscriberRemoveReq) error
IMRemoveSubscriber 请求IM创建频道
func (*Context) IMRevokeMessage ¶
func (c *Context) IMRevokeMessage(req *MessageRevokeReq) error
IMRevokeMessage 撤回IM消息
func (*Context) IMSOnlineStatus ¶
func (c *Context) IMSOnlineStatus(uids []string) ([]*OnlinestatusResp, error)
IMSOnlineStatus 获取指定用户的在线状态
func (*Context) IMSearchMessages ¶
func (c *Context) IMSearchMessages(req *MsgSearchReq) (*SyncChannelMessageResp, error)
IMGetWithMessageID 根据消息ID获取消息详情
func (*Context) IMSearchUserMessages ¶
func (c *Context) IMSearchUserMessages(req *SearchUserMessageReq) (*SearchUserMessageResp, error)
IMSearchUserMessages 搜索用户消息
func (*Context) IMStreamEnd ¶
func (c *Context) IMStreamEnd(req MessageStreamEndReq) error
func (*Context) IMStreamStart ¶
func (c *Context) IMStreamStart(req MessageStreamStartReq) (string, error)
IMStreamStart 消息流开始 返回流编号
func (*Context) IMSyncChannelMessage ¶
func (c *Context) IMSyncChannelMessage(req SyncChannelMessageReq) (*SyncChannelMessageResp, error)
IMSyncChannelMessage 同步频道消息
func (*Context) IMSyncMessage ¶
func (c *Context) IMSyncMessage(req *MsgSyncReq) ([]*MessageResp, error)
IMSyncMessage 同步IM消息
func (*Context) IMSyncMessageAck ¶
func (c *Context) IMSyncMessageAck(req *SyncackReq) error
IMSyncMessageAck 同步IM消息回执
func (*Context) IMSyncUserConversation ¶
func (c *Context) IMSyncUserConversation(uid string, version int64, msgCount int64, lastMsgSeqs string, larges []*Channel) ([]*SyncUserConversationResp, error)
IMSyncUserConversation 同步用户会话数据
func (*Context) IMWhitelistAdd ¶
func (c *Context) IMWhitelistAdd(req ChannelWhitelistReq) error
IMWhitelistAdd 添加白名单
func (*Context) IMWhitelistRemove ¶
func (c *Context) IMWhitelistRemove(req ChannelWhitelistReq) error
IMWhitelistRemove 移除白名单
func (*Context) IMWhitelistSet ¶
func (c *Context) IMWhitelistSet(req ChannelWhitelistReq) error
IMWhitelistSet 白名单设置(覆盖旧的数据)
func (*Context) NewMemoryCache ¶
NewMemoryCache 创建一个内存缓存
func (*Context) NewRedisCache ¶
func (c *Context) NewRedisCache() *common.RedisCache
NewRedisCache 创建一个redis缓存
func (*Context) NotifyMessagesListeners ¶
func (c *Context) NotifyMessagesListeners(messages []*MessageResp)
NotifyMessagesListeners 通知消息监听者
func (*Context) QuitUserDevice ¶
退出用户指定的设备 deviceFlag -1 表示退出用户所有的设备
func (*Context) Schedule ¶
func (c *Context) Schedule(interval time.Duration, f func()) *timingwheel.Timer
Schedule 延迟任务
func (*Context) SendChannelUpdate ¶
func (c *Context) SendChannelUpdate(channel ChannelReq, updateChannel ChannelReq) error
SendChannelUpdate 发送频道更新命令
func (*Context) SendChannelUpdateToGroup ¶
func (*Context) SendChannelUpdateToUser ¶
func (c *Context) SendChannelUpdateToUser(uid string, channel ChannelReq) error
func (*Context) SendChannelUpdateWithFromUID ¶
func (c *Context) SendChannelUpdateWithFromUID(channel ChannelReq, updateChannel ChannelReq, fromUID string) error
func (*Context) SendFriendApply ¶
func (c *Context) SendFriendApply(req *MsgFriendApplyReq) error
SendFriendApply 发送好友申请请求
func (*Context) SendFriendDelete ¶
func (c *Context) SendFriendDelete(req *MsgFriendDeleteReq) error
func (*Context) SendFriendSure ¶
func (c *Context) SendFriendSure(req *MsgFriendSureReq) error
SendFriendSure 发送好友确认请求
func (*Context) SendGroupCreate ¶
func (c *Context) SendGroupCreate(req *MsgGroupCreateReq) error
SendGroupCreate 发送群创建的消息
func (*Context) SendGroupExit ¶
func (c *Context) SendGroupExit(groupNo string, uid string, name string, visibleUids []string) error
发送某个用户退出群聊的消息
func (*Context) SendGroupMemberAdd ¶
func (c *Context) SendGroupMemberAdd(req *MsgGroupMemberAddReq) error
SendGroupMemberAdd 发送群成员添加消息
func (*Context) SendGroupMemberBeRemove ¶
func (c *Context) SendGroupMemberBeRemove(req *MsgGroupMemberRemoveReq) error
SendGroupMemberBeRemove 发送群成员被移除的消息(发送给被踢的群成员)
func (*Context) SendGroupMemberInviteReq ¶
func (c *Context) SendGroupMemberInviteReq(req MsgGroupMemberInviteReq) error
SendGroupMemberInviteReq 邀请入群消息
func (*Context) SendGroupMemberRemove ¶
func (c *Context) SendGroupMemberRemove(req *MsgGroupMemberRemoveReq) error
SendGroupMemberRemove 发送群成员移除消息
func (*Context) SendGroupMemberScanJoin ¶
func (c *Context) SendGroupMemberScanJoin(req MsgGroupMemberScanJoin) error
SendGroupMemberScanJoin 发送群成员扫码加入消息
func (*Context) SendGroupMemberUpdate ¶
func (*Context) SendGroupTransferGrouper ¶
func (c *Context) SendGroupTransferGrouper(req MsgGroupTransferGrouper) error
SendGroupTransferGrouper 群主转让
func (*Context) SendGroupUpdate ¶
func (c *Context) SendGroupUpdate(req *MsgGroupUpdateReq) error
SendGroupUpdate 发送群更新消息
func (*Context) SendMessageBatch ¶
func (c *Context) SendMessageBatch(req *MsgSendBatch) error
SendMessageBatch 给一批用户发送消息
func (*Context) SendMessageWithResult ¶
func (c *Context) SendMessageWithResult(req *MsgSendReq) (*MsgSendResp, error)
SendMessage 发送消息
func (*Context) SendRTCCallResult ¶
func (c *Context) SendRTCCallResult(req P2pRtcMessageReq) error
rtc 挂断
func (*Context) SendRevoke ¶
func (c *Context) SendRevoke(req *MsgRevokeReq) error
SendRevoke 发送撤回消息
func (*Context) SendTyping ¶
func (*Context) SendUnableAddDestoryAccountInGroup ¶
func (c *Context) SendUnableAddDestoryAccountInGroup(req *MsgGroupCreateReq) error
SendGroupUnableAddDestoryAccount 发送无法添加注销账号到群聊
func (*Context) SetHttpRoute ¶
func (*Context) UpdateIMToken ¶
func (c *Context) UpdateIMToken(req UpdateIMTokenReq) (*UpdateIMTokenResp, error)
UpdateIMToken 更新IM的token
type ConversationResp ¶
type ConversationResp struct {
ChannelID string `json:"channel_id"` // 频道ID
ChannelType uint8 `json:"channel_type"` // 频道类型
Unread int64 `json:"unread"` // 未读数
Timestamp int64 `json:"timestamp"` // 最后一次会话时间戳
LastMessage *MessageResp `json:"last_message"` // 最后一条消息
}
ConversationResp 最近会话返回数据
type DeleteConversationReq ¶
type DeleteConversationReq struct {
UID string `json:"uid"`
ChannelID string `json:"channel_id"` // 频道ID
ChannelType uint8 `json:"channel_type"` // 频道类型
}
DeleteConversationReq DeleteConversationReq
type DeviceFlag ¶
type DeviceFlag uint8
DeviceFlag 设备类型
const ( // APP APP APP DeviceFlag = iota // Web Web Web // PC在线 PC )
func (DeviceFlag) Uint8 ¶
func (d DeviceFlag) Uint8() uint8
type DeviceLevel ¶
type DeviceLevel uint8
DeviceLevel 设备等级
const ( // DeviceLevelSlave 从设备 DeviceLevelSlave DeviceLevel = 0 // DeviceLevelMaster 主设备 DeviceLevelMaster DeviceLevel = 1 )
type EmptySpan ¶
type EmptySpan struct {
}
EmptySpan 空的span
func (*EmptySpan) BaggageItem ¶
BaggageItem BaggageItem
func (*EmptySpan) FinishWithOptions ¶
func (e *EmptySpan) FinishWithOptions(opts opentracing.FinishOptions)
FinishWithOptions FinishWithOptions
func (*EmptySpan) LogEventWithPayload ¶
LogEventWithPayload LogEventWithPayload
func (*EmptySpan) LogKV ¶
func (e *EmptySpan) LogKV(alternatingKeyValues ...interface{})
LogKV LogKV
func (*EmptySpan) SetBaggageItem ¶
func (e *EmptySpan) SetBaggageItem(restrictedKey, value string) opentracing.Span
SetBaggageItem SetBaggageItem
func (*EmptySpan) SetOperationName ¶
func (e *EmptySpan) SetOperationName(operationName string) opentracing.Span
SetOperationName SetOperationName
type EmptySpanContext ¶
type EmptySpanContext struct {
}
EmptySpanContext EmptySpanContext
func (*EmptySpanContext) ForeachBaggageItem ¶
func (e *EmptySpanContext) ForeachBaggageItem(handler func(k, v string) bool)
ForeachBaggageItem ForeachBaggageItem
type EventListener ¶
type EventListener func(data []byte, commit EventCommit)
EventListener EventListener
type FIREBASEPush ¶
type FileService ¶
type FileService string
FileService FileService
const ( // FileServiceAliyunOSS 阿里云oss上传服务 FileServiceAliyunOSS FileService = "aliyunOSS" // FileServiceSeaweedFS seaweedfs(https://github.com/chrislusf/seaweedfs) FileServiceSeaweedFS FileService = "seaweedFS" // FileServiceMinio minio FileServiceMinio FileService = "minio" // FileServiceQiniu 七牛云上传服务 FileServiceQiniu FileService = "qiniu" // FileServiceTencentCOS 腾讯云COS上传服务 FileServiceTencentCOS FileService = "tencentCOS" )
func (FileService) String ¶
func (u FileService) String() string
type MessageDeleteReq ¶
type MessageDeleteReq struct {
UID string `json:"uid"` // 频道ID
ChannelID string `json:"channel_id"` // 频道ID
ChannelType uint8 `json:"channel_type"` // 频道类型
MessageIDs []uint64 `json:"message_ids"` // 消息ID集合 (如果all=1 则此字段无效)
}
MessageDeleteReq 删除消息请求
type MessageResp ¶
type MessageResp struct {
Header MsgHeader `json:"header"` // 消息头
Setting uint8 `json:"setting"` // 设置
MessageIDStr string `json:"message_idstr"` // 消息字符串ID
MessageID int64 `json:"message_id"` // 服务端的消息ID(全局唯一)
MessageSeq uint32 `json:"message_seq"` // 消息序列号 (用户唯一,有序递增)
ClientMsgNo string `json:"client_msg_no"` // 客户端消息唯一编号
Expire uint32 `json:"expire"` // 消息过期时间
FromUID string `json:"from_uid"` // 发送者UID
ToUID string `json:"to_uid"` // 接受者uid
ChannelID string `json:"channel_id"` // 频道ID
ChannelType uint8 `json:"channel_type"` // 频道类型
Timestamp int32 `json:"timestamp"` // 服务器消息时间戳(10位,到秒)
Payload []byte `json:"payload"` // 消息内容
StreamNo string `json:"stream_no,omitempty"` // 流编号
Streams []*StreamItemResp `json:"streams,omitempty"` // 消息流
// ReplyCount int `json:"reply_count,omitempty"` // 回复集合
// ReplyCountSeq string `json:"reply_count_seq,omitempty"` // 回复数量seq
// ReplySeq string `json:"reply_seq,omitempty"` // 回复seq
// Reactions []ReactionResp `json:"reactions,omitempty"` // 回应数据
IsDeleted int `json:"is_deleted"` // 是否已删除
VoiceStatus int `json:"voice_status"` // 语音状态 0.未读 1.已读
// contains filtered or unexported fields
}
MessageResp 消息
func (*MessageResp) GetContentType ¶
func (m *MessageResp) GetContentType() int
GetContentType 消息正文类型
func (*MessageResp) GetPayloadMap ¶
func (m *MessageResp) GetPayloadMap() (map[string]interface{}, error)
GetPayloadMap GetPayloadMap
type MessageRevokeReq ¶
type MessageRevokeReq struct {
ChannelID string `json:"channel_id"` // 频道ID
ChannelType uint8 `json:"channel_type"` // 频道类型
MessageIDs []uint64 `json:"message_ids"` // 指定需要撤回的消息
}
MessageRevokeReq 消息撤回请求
type MessageStreamEndReq ¶
type MessageStreamStartReq ¶
type MessageStreamStartReq struct {
Header MsgHeader `json:"header"` // 消息头
ClientMsgNo string `json:"client_msg_no"` // 客户端消息编号(相同编号,客户端只会显示一条)
FromUID string `json:"from_uid"` // 发送者UID
ChannelID string `json:"channel_id"` // 频道ID
ChannelType uint8 `json:"channel_type"` // 频道类型
Payload []byte `json:"payload"` // 消息内容
}
type MinioConfig ¶
type MsgCMDReq ¶
type MsgCMDReq struct {
NoPersist bool `json:"-"` // 是否需要存储
FromUID string `json:"from_uid"` // 模拟发送者的UID
ChannelID string `json:"channel_id"` // 频道ID
ChannelType uint8 `json:"channel_type"` // 频道类型
Subscribers []string `json:"subscribers"` // 订阅者 如果此字段有值,表示消息只发给指定的订阅者
CMD string `json:"cmd"` // 操命令
Param map[string]interface{} `json:"param"` // 命令参数
}
MsgCMDReq CMD消息请求
type MsgFriendApplyReq ¶
type MsgFriendApplyReq struct {
ApplyUID string `json:"apply_uid"` // 发起申请人的uid
ApplyName string `json:"apply_name"` // 发起申请人的名字
ToUID string `json:"to_uid"` // 接收者
Remark string `json:"remark"` // 申请备注
Token string `json:"token"` // 凭证
}
MsgFriendApplyReq 好友申请
type MsgFriendDeleteReq ¶
type MsgFriendDeleteReq struct {
FromUID string `json:"from_uid"` // 删除人的uid
ToUID string `json:"to_uid"` // 被删除的好友uid
}
MsgFriendDeleteReq 好友删除
type MsgFriendSureReq ¶
type MsgFriendSureReq struct {
ToUID string `json:"to_uid"` // 接收好友申请的人uid
FromUID string `json:"from_uid"` // 发起申请人的uid
FromName string `json:"from_name"` // 发起申请人的名字
}
MsgFriendSureReq 确认好友申请
type MsgGroupCreateReq ¶
type MsgGroupCreateReq struct {
Creator string `json:"creator"` // 创建者
CreatorName string `json:"creator_name"` // 创建者名称
GroupNo string `json:"group_no"`
Version int64 `json:"version"` // 数据版本
Members []*UserBaseVo `json:"members"`
}
MsgGroupCreateReq 创建群请求
type MsgGroupDisband ¶
type MsgGroupDisband struct {
GroupNo string `json:"group_no"` // 群编号
Operator string `json:"operator"` // 操作者uid
OperatorName string `json:"operator_name"` // 操作者名称
}
MsgGroupDisband 群解散
type MsgGroupMemberAddReq ¶
type MsgGroupMemberAddReq struct {
Operator string `json:"operator"` // 操作者uid
OperatorName string `json:"operator_name"` // 操作者名称
GroupNo string `json:"group_no"` // 群编号
Members []*UserBaseVo `json:"members"` // 邀请成员
}
MsgGroupMemberAddReq 添加群成员
type MsgGroupMemberInviteReq ¶
type MsgGroupMemberInviteReq struct {
GroupNo string `json:"group_no"` // 群编号
InviteNo string `json:"invite_no"` // 邀请编号
Inviter string `json:"inviter"` // 邀请者
InviterName string `json:"inviter_name"` // 邀请者名称
Num int `json:"num"` // 邀请成员数量
Subscribers []string `json:"subscribers"` // 消息订阅者
}
MsgGroupMemberInviteReq 群成员邀请请求
type MsgGroupMemberRemoveReq ¶
type MsgGroupMemberRemoveReq struct {
Operator string `json:"operator"` // 操作者uid
OperatorName string `json:"operator_name"` // 操作者名称
GroupNo string `json:"group_no"` // 群编号
Members []*UserBaseVo `json:"members"` // 邀请成员
}
MsgGroupMemberRemoveReq 移除群成员
type MsgGroupMemberScanJoin ¶
type MsgGroupMemberScanJoin struct {
GroupNo string `json:"group_no"` // 群编号
Generator string `json:"generator"` // 二维码生成者uid
GeneratorName string `json:"generator_name"` // 二维码生成者名称
Scaner string `json:"scaner"` // 扫码者uid
ScanerName string `json:"scaner_name"` // 扫码者名称
}
MsgGroupMemberScanJoin 用户扫码加入群成员
type MsgGroupTransferGrouper ¶
type MsgGroupTransferGrouper struct {
GroupNo string `json:"group_no"`
OldGrouper string `json:"old_grouper"` // 老群主
OldGrouperName string `json:"old_grouper_name"` // 老群主名称
NewGrouper string `json:"new_grouper"` // 新群主
NewGrouperName string `json:"new_grouper_name"` // 新群主名称
}
MsgGroupTransferGrouper 群主转让
type MsgGroupUpdateReq ¶
type MsgGroupUpdateReq struct {
GroupNo string `json:"group_no"` // 群编号
Operator string `json:"operator"` // 操作者uid
OperatorName string `json:"operator_name"` // 操作者名称
Attr string `json:"attr"` // 修改群的属性
Data map[string]string `json:"data"` // 数据
}
MsgGroupUpdateReq 群更新请求
type MsgHeader ¶
type MsgHeader struct {
NoPersist int `json:"no_persist"` // 是否不持久化
RedDot int `json:"red_dot"` // 是否显示红点
SyncOnce int `json:"sync_once"` // 此消息只被同步或被消费一次(1表示消息将走写模式) ,特别注意:sync_once=1表示写扩散 sync_once=0表示读扩散 写扩散的messageSeq和读扩散messageSeq来源不一样
}
MsgHeader 消息头
type MsgOrgOrDeptCreateReq ¶
type MsgOrgOrDeptCreateReq struct {
GroupNo string `json:"group_no"` // 组织或部门ID
GroupCategory string `json:"group_category"` // 群分类
Name string `json:"name"` // 组织或部门名称
Operator string `json:"operator"` // 操作者uid
OperatorName string `json:"operator_name"` // 操作者名称
Members []*OrgOrDeptEmployeeVO `json:"members"` // 成员
}
MsgOrgOrDeptCreateReq 组织或部门创建
type MsgOrgOrDeptEmployeeAddReq ¶
type MsgOrgOrDeptEmployeeAddReq struct {
GroupNo string `json:"group_no"` // 组织或部门ID
Name string `json:"name"` // 组织或部门名称
Members []*UserBaseVo `json:"members"`
}
MsgOrgOrDeptEmployeeAddReq 组织或部门新增群成员消息
type MsgOrgOrDeptEmployeeUpdateReq ¶
type MsgOrgOrDeptEmployeeUpdateReq struct {
Members []*OrgOrDeptEmployeeVO `json:"members"`
}
type MsgRevokeReq ¶
type MsgRevokeReq struct {
FromUID string `json:"from_uid"`
Operator string `json:"operator"` // 操作者uid
OperatorName string `json:"operator_name"` // 操作者名称
ChannelID string `json:"channel_id"` // 频道ID
ChannelType uint8 `json:"channel_type"` // 频道类型
MessageID int64 `json:"message_id"` // 消息ID
}
MsgRevokeReq 撤回消息请求
type MsgSearchReq ¶
type MsgSearchReq struct {
LoginUID string `json:"login_uid"` // 登录者UID
ChannelID string `json:"channel_id"` // 频道ID
ChannelType uint8 `json:"channel_type"` // 频道类型
MessageSeqs []uint32 `json:"message_seqs"` // 消息序列号
MessageIds []int64 `json:"message_ids"` // 消息ids
ClientMsgNos []string `json:"client_msg_nos"` // 客户端消息唯一编号
}
MsgSearchReq 消息查询请求
type MsgSendBatch ¶
type MsgSendBatch struct {
Header MsgHeader `json:"header"` // 消息头
FromUID string `json:"from_uid"` // 模拟发送者的UID
Subscribers []string `json:"subscribers"` // 订阅者 如果此字段有值,表示消息只发给指定的订阅者
Payload []byte `json:"payload"` // 消息内容
}
MsgSendBatch 给一批用户发送消息请求
type MsgSendReq ¶
type MsgSendReq struct {
Header MsgHeader `json:"header"` // 消息头
Setting uint8 `json:"setting"` // setting
FromUID string `json:"from_uid"` // 模拟发送者的UID
ChannelID string `json:"channel_id"` // 频道ID
ChannelType uint8 `json:"channel_type"` // 频道类型
StreamNo string `json:"stream_no"` // 消息流号
Subscribers []string `json:"subscribers"` // 订阅者 如果此字段有值,表示消息只发给指定的订阅者
Payload []byte `json:"payload"` // 消息内容
}
MsgSendReq 发送消息请求
func NewPersonalMsgSendReq ¶
func NewPersonalMsgSendReq( channelID string, fromUID string, payload map[string]interface{}, senderSpaceID string, opts PersonalMsgOptions, ) *MsgSendReq
NewPersonalMsgSendReq returns a *MsgSendReq for a PERSONAL (channel_type=1) dispatch with authoritative payload.space_id semantics applied to payload before encoding.
Contract:
- senderSpaceID != "" → payload["space_id"] = senderSpaceID (server overrides any client-supplied value; this is the only authoritative source the receiver-side SpaceFilter can trust on PERSONAL channels because WuKongIM has no Space concept on channel_type=1).
- senderSpaceID == "" → payload["space_id"] is stripped (fail-closed). The empty case means the dispatcher has no Space context (orphan bot, non-Space deployment, missing X-Space-ID middleware); we MUST NOT trust a client-supplied value in that branch — see Mininglamp-OSS/octo-server PR#35 R3 review (YUJ-660 High-3) for the fail-open hole this closes.
Channel type is always set to ChannelTypePerson; callers MUST verify the channel is in fact PERSONAL before invoking this builder. Use the regular MsgSendReq literal for GROUP / COMMUNITY_TOPIC / RTC / etc.
payload may be nil; an empty map is materialised. The map is mutated in place (consistent with octo-server's enrichPayloadWithSpaceID helpers) and then JSON-encoded into MsgSendReq.Payload.
This builder is the defense-in-depth layer for Mininglamp-OSS/octo-server#37 (PR#35 follow-up Medium-1). New PERSONAL DM call sites added in either repository SHOULD use this builder so payload.space_id correctness becomes a property of construction rather than caller diligence.
func (*MsgSendReq) String ¶
func (m *MsgSendReq) String() string
type MsgSendResp ¶
type MsgSyncReq ¶
type MsgSyncReq struct {
UID string `json:"uid"` // 谁的消息
MessageSeq uint32 `json:"message_seq"` // 客户端最大消息序列号
Limit int `json:"limit"` // 消息数量限制
}
MsgSyncReq 消息同步请求
type OPPOPush ¶
type OPPOPush struct {
PackageName string
AppID string
AppKey string
AppSecret string
MasterSecret string
}
oppo推送
type OSSConfig ¶
type OSSConfig struct {
Endpoint string
BucketName string // Bucket名称 比如 tangsengdaodao
BucketURL string // 文件下载地址域名 对应aliyun的Bucket域名
AccessKeyID string
AccessKeySecret string
}
aliyun oss
type OnlineStatus ¶
type OnlineStatus struct {
UID string // 用户uid
DeviceFlag uint8 // 设备标记
Online bool // 是否在线
SocketID int64 // 当前设备在wukongim中的在线/离线的socketID
OnlineCount int //在线数量 当前DeviceFlag下的在线设备数量
TotalOnlineCount int // 当前用户所有在线设备数量
}
OnlineStatus 在线状态
type OnlineStatusListener ¶
type OnlineStatusListener func(onlineStatusList []OnlineStatus)
OnlineStatusListener 在线状态监听
type OnlinestatusResp ¶
type OnlinestatusResp struct {
UID string `json:"uid"` // 在线用户uid
DeviceFlag uint8 `json:"device_flag"` // 设备标记 0. APP 1.web
LastOffline int `json:"last_offline"` // 最后一次离线时间
Online int `json:"online"` // 是否在线
}
OnlinestatusResp 在线状态返回
type OrgEmployeeExitReq ¶
type OrgEmployeeExitReq struct {
Operator string `json:"operator"` // 操作者uid
GroupNos []string `json:"group_nos"` // 退出的群列表
}
OrgEmployeeExitReq 组织内成员退出
type OrgOrDeptEmployeeVO ¶
type OrgOrDeptEmployeeVO struct {
Operator string `json:"operator"` // 操作者uid
OperatorName string `json:"operator_name"` // 操作者名称
EmployeeUid string `json:"employee_uid"` // 员工uid
EmployeeName string `json:"employee_name"` // 员工名称
GroupNo string `json:"group_no"` // 组织或部门ID
Action string `json:"action"` // 操作类型 'add'|'delete'
}
OrgOrDeptEmployeeVO 组织或部门成员更新
type P2pRtcMessageReq ¶
type P2pRtcMessageReq struct {
FromUID string
ToUID string
CallType common.RTCCallType
ResultType common.RTCResultType
Second int
}
type PersonalMsgOptions ¶
type PersonalMsgOptions struct {
Header MsgHeader
Setting uint8
StreamNo string
Subscribers []string
}
PersonalMsgOptions carries the optional MsgSendReq fields beyond the mandatory authoritative-payload contract enforced by NewPersonalMsgSendReq.
Only fields a PERSONAL DM dispatcher legitimately controls are exposed. channel_type is set to ChannelTypePerson by the builder unconditionally; payload is encoded by the builder after authoritative space_id semantics have been applied.
type QiniuConfig ¶
type ReactionResp ¶
type ReactionResp struct {
Seq string `json:"seq"` // 回复序列号
Users []UserResp `json:"users"` // 回应用户集合
Emoji string `json:"emoji"` // 回应的emoji
Count int `json:"count"` // 回应数量
}
ReactionResp 回应返回
type S3Config ¶
type S3Config struct {
// Endpoint is the S3 API hostname, without scheme.
// Examples:
// AWS S3: s3.us-west-2.amazonaws.com
// Cloudflare R2: <accountid>.r2.cloudflarestorage.com
// MinIO: minio.example.com:9000
// REQUIRED — no default.
Endpoint string
// Region is the SigV4 signing region.
// Examples: us-west-2, ap-southeast-1, auto (R2).
// REQUIRED — must match the bucket's actual region for AWS; some
// providers accept any value (e.g. R2 uses "auto").
Region string
// Bucket is the single bucket all uploads target. Object keys carry
// their own logical prefix (chat/, moment/, ...), so a single bucket
// is the recommended deployment topology.
Bucket string
// AccessKeyID / SecretAccessKey are the long-lived IAM credentials
// for the bucket. See the security docs for the minimum IAM policy.
AccessKeyID string
SecretAccessKey string
// SessionToken is the AWS STS session token for temporary credentials.
// Empty for long-lived IAM user keys; populated by IRSA / IMDSv2 /
// EKS Pod Identity / AWS SSO workflows that issue rotating credentials.
//
// Lifecycle: the service layer does NOT refresh the token itself — the
// deployment pipeline is responsible for refreshing AWS_SESSION_TOKEN
// (and the paired key/secret) before STS expiry. Leave empty for
// static credentials.
//
// Override precedence: YAML s3.sessionToken → AWS_SESSION_TOKEN →
// TS_S3_SESSION_TOKEN (project-prefixed wins). Same pattern as the
// AccessKeyID / SecretAccessKey pair.
SessionToken string
// DownloadURL is the browser-facing base URL used for unsigned object
// access (e.g. preview redirects, upload-response `path` field). It
// does NOT participate in SigV4 signing — presigned PUT/GET URLs are
// always signed against Endpoint.
//
// Use cases:
// - Empty: callers fall back to the canonical hostname constructed
// from Endpoint + Bucket.
// - CloudFront / CDN front-door: set to the distribution URL, e.g.
// https://d123.cloudfront.net. The browser fetches reads via
// CloudFront (typically with OAC for private buckets); presigned
// PUT/GET still flow directly to S3.
// - Custom domain: set to a bucket-subdomain custom domain, e.g.
// https://my-bucket.cdn.example.com.
//
// Must be scheme://host[:port] with no path component (same contract
// as MinioConfig.DownloadURL).
DownloadURL string
// Prefix is an optional object-key prefix for multi-environment
// isolation (e.g. "staging/" or "prod/"). Mirrors COSConfig.Prefix.
Prefix string
// UsePathStyle forces path-style addressing
// (https://endpoint/bucket/key) instead of virtual-hosted style
// (https://bucket.endpoint/key). Required by some S3 gateways and
// by AWS for very old buckets or path-style-only endpoints; rarely
// needed for AWS S3 in 2026, default false.
UsePathStyle bool
}
S3Config configures any S3-compatible object storage backend. Use this for AWS S3 or third-party providers that speak the S3 protocol (Cloudflare R2, Backblaze B2, Wasabi, etc.). Tencent Cloud COS and MinIO continue to be configured via their existing dedicated blocks for backward compatibility.
type SMSProvider ¶
type SMSProvider string
SMSProvider 短信供应者
const ( // SMSProviderAliyun aliyun SMSProviderAliyun SMSProvider = "aliyun" SMSProviderUnisms SMSProvider = "unisms" // 联合短信(https://unisms.apistd.com/docs/api/send/) SMSProviderSmsbao SMSProvider = "smsbao" // 短信宝(https://www.smsbao.com/) )
type SearchUserMessageReq ¶
type SearchUserMessageReq struct {
UID string `json:"uid"` // 当前用户uid(限制搜索指定用户的消息)
Payload map[string]interface{} `json:"payload"` // 消息payload,支持搜索自定义字段
PayloadTypes []int `json:"payload_types"` // 消息类型搜索
FromUID string `json:"from_uid"` // 发送者uid
ChannelID string `json:"channel_id"` // 频道ID
ChannelType uint8 `json:"channel_type"` // 频道类型
Topic string `json:"topic"` // 根据topic搜索
Limit int `json:"limit"` // 查询限制数量
Page int `json:"page"` // 页码,分页使用,默认为1
StartTime int64 `json:"start_time"` // 消息时间(开始)
EndTime int64 `json:"end_time"` // 消息时间(结束,结果不包含end_time)
Highlights []string `json:"highlights"` // 搜索关键字是否高亮显示, 比如payload.content="你是北京大学的吗" 搜索关键字:"北京" 那么highlights设置为["payload.content"] 这样payload.content返回的内容为带上mark标签为:"你是<mark>北京</mark>大学的吗"
}
SearchUserMessageReq 用户消息搜索
type SearchUserMessageResp ¶
type SearchUserMessageResp struct {
Total int64 `json:"total"` // 消息总量
Limit int `json:"limit"` // 查询数量
Page int `json:"page"` // 当前页码
Messages []*MessageResp `json:"messages"` // 消息
}
SearchUserMessageResp 搜索用户消息结果
type SeaweedConfig ¶
type SeaweedConfig struct {
URL string // 文件下载上传基地址
}
type Setting ¶
type Setting struct {
Receipt bool // 消息已读回执,此标记表示,此消息需要已读回执
NoUpdateConversation bool // 不更新最近会话
Signal bool // 是否signal加密
}
Setting Setting
type SmsbaoConfig ¶
type StreamItemResp ¶
type SubscriberAddReq ¶
type SubscriberAddReq struct {
ChannelID string `json:"channel_id"`
ChannelType uint8 `json:"channel_type"`
Reset int `json:"reset"` // 是否重置订阅者 (0.不重置 1.重置),选择重置,将删除原来的所有成员
Subscribers []string `json:"subscribers"`
}
SubscriberAddReq 添加订阅请求
type SubscriberRemoveReq ¶
type SubscriberRemoveReq struct {
ChannelID string `json:"channel_id"`
ChannelType uint8 `json:"channel_type"`
Subscribers []string `json:"subscribers"`
}
SubscriberRemoveReq 移除订阅请求
type SyncChannelMessageReq ¶
type SyncChannelMessageReq struct {
LoginUID string `json:"login_uid"`
DeviceUUID string `json:"device_uuid"`
ChannelID string `json:"channel_id"`
ChannelType uint8 `json:"channel_type"`
StartMessageSeq uint32 `json:"start_message_seq"` // 开始序列号
EndMessageSeq uint32 `json:"end_message_seq"` // 结束序列号
Limit int `json:"limit"` // 每次同步数量限制
PullMode PullMode `json:"pull_mode"` // 拉取模式
}
SyncChannelMessageReq 同步频道消息请求
type SyncChannelMessageResp ¶
type SyncChannelMessageResp struct {
StartMessageSeq uint32 `json:"start_message_seq"` // 开始序列号
EndMessageSeq uint32 `json:"end_message_seq"` // 结束序列号
PullMode PullMode `json:"pull_mode"` // 拉取模式
Messages []*MessageResp `json:"messages"` // 消息数据
}
SyncChannelMessageResp 同步频道消息返回
type SyncUserConversationResp ¶
type SyncUserConversationResp struct {
ChannelID string `json:"channel_id"` // 频道ID
ChannelType uint8 `json:"channel_type"` // 频道类型
Unread int `json:"unread"` // 未读消息
Timestamp int64 `json:"timestamp"` // 最后一次会话时间
LastMsgSeq int64 `json:"last_msg_seq"` // 最后一条消息seq
LastClientMsgNo string `json:"last_client_msg_no"` // 最后一条客户端消息编号
OffsetMsgSeq int64 `json:"offset_msg_seq"` // 偏移位的消息seq
Version int64 `json:"version"` // 数据版本
Recents []*MessageResp `json:"recents"` // 最近N条消息
}
SyncUserConversationResp 最近会话离线返回
type SyncUserConversationRespWrap ¶
type SyncUserConversationRespWrap struct {
Conversations []*SyncUserConversationResp `json:"conversations"`
CMDVersion int64 `json:"cmd_version"` // 最新cmd版本号
CMDs []*CMDResp `json:"cmds"` // cmd集合
}
SyncUserConversationRespWrap SyncUserConversationRespWrap
type SyncackReq ¶
type SyncackReq struct {
// 用户uid
UID string `json:"uid"`
// 最后一次同步的message_seq
LastMessageSeq uint32 `json:"last_message_seq"`
}
SyncackReq 同步回执请求
func (SyncackReq) String ¶
func (s SyncackReq) String() string
type TablePartitionConfig ¶
type Tracer ¶
Tracer唐僧叨叨Tracer
func (*Tracer) ContextWithSpan ¶
ContextWithSpan ContextWithSpan
func (*Tracer) Extract ¶
func (t *Tracer) Extract(format interface{}, carrier interface{}) (opentracing.SpanContext, error)
Extract Extract
func (*Tracer) ExtractHTTPHeader ¶
func (t *Tracer) ExtractHTTPHeader(header http.Header) (opentracing.SpanContext, error)
ExtractHTTPHeader ExtractHTTPHeader
func (*Tracer) Inject ¶
func (t *Tracer) Inject(sm opentracing.SpanContext, format interface{}, carrier interface{}) error
Inject Inject
func (*Tracer) InjectHTTPHeader ¶
func (t *Tracer) InjectHTTPHeader(sm opentracing.SpanContext, header http.Header) error
InjectHTTPHeader InjectHTTPHeader
func (*Tracer) StartSpan ¶
func (t *Tracer) StartSpan(operationName string, opts ...opentracing.StartSpanOption) opentracing.Span
StartSpan StartSpan
func (*Tracer) StartSpanFromContext ¶
func (t *Tracer) StartSpanFromContext(ctx context.Context, operationName string, opts ...opentracing.StartSpanOption) (opentracing.Span, context.Context)
StartSpanFromContext StartSpanFromContext
type UnismsConfig ¶
type UnismsConfig struct {
Signature string
AccessKeyID string
AccessKeySecret string
TemplateId string
}
UnismsConfig unisms短信
type UpdateIMTokenReq ¶
type UpdateIMTokenReq struct {
UID string
Token string
DeviceFlag DeviceFlag
DeviceLevel DeviceLevel
}
UpdateIMTokenReq 更新IM token的请求
type UpdateIMTokenResp ¶
type UpdateIMTokenResp struct {
Status UpdateTokenStatus `json:"status"` // 状态
}
UpdateIMTokenResp 更新IM Token的返回参数
type UpdateSearchMessageReq ¶
type UpdateSearchMessageReq struct {
ChannelID string `json:"channel_id"`
MessageIDs []string `json:"message_ids"`
}
UpdateSearchMessageReq 修改搜索消息
type UpdateTokenStatus ¶
type UpdateTokenStatus int
const ( UpdateTokenStatusSuccess UpdateTokenStatus = 200 UpdateTokenStatusBan UpdateTokenStatus = 19 )
type UserBaseVo ¶
UserBaseVo 用户基础信息