1 Star 0 Fork 0

h79/goim

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
interceptor.go 1.33 KB
一键复制 编辑 原始数据 按行查看 历史
huqiuyun 提交于 2026-02-03 12:16 +08:00 . 0.5.16 & MQ消息指定点发送
package im
import (
"context"
"gitee.com/h79/goim/session"
)
type Alarm interface {
Alarm(ctx context.Context, code int32, level int32, title, detail string, err error)
}
type AlarmFunc func(ctx context.Context, code int32, level int32, title, detail string, err error)
func (f AlarmFunc) Alarm(ctx context.Context, code int32, level int32, title, detail string, err error) {
f(ctx, code, level, title, detail, err)
}
const (
MQMsg = iota + 1
EVMsg
)
type MsgInterceptor interface {
MsgInterceptor(ctx context.Context, from *session.Session, to *Connect, payloadType int, payload any) error
}
type MsgInterceptorFunc func(ctx context.Context, from *session.Session, to *Connect, payloadType int, payload any) error
func (f MsgInterceptorFunc) MsgInterceptor(ctx context.Context, from *session.Session, to *Connect, payloadType int, payload any) error {
return f(ctx, from, to, payloadType, payload)
}
// RespInterceptor 回复拦截器
type RespInterceptor interface {
RespInterceptor(req *EventReq) bool
}
type RespInterceptorFunc func(req *EventReq) bool
func (f RespInterceptorFunc) RespInterceptor(req *EventReq) bool {
return f(req)
}
type DisposeInterceptor func(conn *Connect, req *EventReq) (interface{}, error)
type UnaryDisposeInterceptor func(conn *Connect, req *EventReq, handler DisposeInterceptor) (resp any, err error)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/h79/goim.git
git@gitee.com:h79/goim.git
h79
goim
goim
v0.5.16

搜索帮助