MCPcopy Create free account

hub / github.com/chenxilol/gohub / functions

Functions347 in github.com/chenxilol/gohub

↓ 1 callersMethodAuthenticate
Authenticate 验证令牌并返回令牌声明
pkg/auth/auth.go:43
↓ 1 callersFunctionClientConnected
便捷方法,用于快速记录指标 ClientConnected 记录客户端连接
internal/metrics/metrics.go:168
↓ 1 callersFunctionClientDisconnected
ClientDisconnected 记录客户端断开连接
internal/metrics/metrics.go:175
↓ 1 callersMethodCreateRoom
以下是房间相关操作的便捷方法 CreateRoom 创建一个新房间
pkg/hub/hub.go:413
↓ 1 callersMethodDeleteRoom
DeleteRoom 删除一个房间
pkg/hub/hub.go:418
↓ 1 callersMethodGetAuthClaims
GetAuthClaims 获取客户端的认证声明
pkg/hub/client.go:197
↓ 1 callersMethodGetClient
(id string)
pkg/hub/hub.go:500
↓ 1 callersFunctionGetDispatcher
()
internal/dispatcher/dispatcher.go:32
↓ 1 callersMethodGetMembers
GetMembers 获取房间内所有客户端ID
pkg/hub/room.go:129
↓ 1 callersFunctionGetRegistry
GetRegistry 获取Prometheus注册表
internal/metrics/metrics.go:153
↓ 1 callersMethodGetRoomCount
()
pkg/sdk/sdk.go:54
↓ 1 callersMethodIsAuthenticated
IsAuthenticated 检查客户端是否已认证
pkg/hub/client.go:202
↓ 1 callersMethodIsAuthenticated
认证相关
pkg/sdk/sdk.go:61
↓ 1 callersMethodLeaveRoom
LeaveRoom 客户端离开房间
pkg/hub/hub.go:445
↓ 1 callersFunctionNew
(cfg Config)
pkg/bus/redis/redis.go:121
↓ 1 callersFunctionNewDispatcher
()
internal/dispatcher/dispatcher.go:39
↓ 1 callersFunctionNewJWTService
(secretKey, issuer string)
pkg/auth/jwt.go:25
↓ 1 callersFunctionNewMessageDeduplicator
NewMessageDeduplicator 消息去重器
pkg/hub/dedup.go:43
↓ 1 callersFunctionNewMetrics
NewMetrics 创建新的Metrics实例
internal/metrics/metrics.go:50
↓ 1 callersFunctionNewRoom
NewRoom 创建一个新房间
pkg/hub/room.go:47
↓ 1 callersFunctionNewRoomManager
NewRoomManager 创建一个新的房间管理器
pkg/hub/room.go:150
↓ 1 callersFunctionNewSDK
NewSDK 创建新的SDK实例
pkg/sdk/sdk.go:84
↓ 1 callersMethodObservePublishLatency
ObservePublishLatency 观察发布延迟
pkg/bus/nats/metrics.go:107
↓ 1 callersMethodObserveSubscribeLatency
ObserveSubscribeLatency 观察订阅延迟
pkg/bus/redis/metrics.go:71
↓ 1 callersMethodOn
事件订阅
pkg/sdk/sdk.go:66
↓ 1 callersFunctionParseLogLevel
ParseLogLevel parses a string log level to slog.Level
configs/config.go:138
↓ 1 callersMethodReadMessage
()
internal/websocket/conn_iface.go:6
↓ 1 callersFunctionRecordAuthSuccess
RecordAuthSuccess 记录认证成功
internal/metrics/metrics.go:238
↓ 1 callersFunctionRecordError
RecordError 记录错误
internal/metrics/metrics.go:232
↓ 1 callersFunctionRecordLatency
RecordLatency 记录延迟
internal/metrics/metrics.go:226
↓ 1 callersFunctionRegisterHandlers
RegisterHandlers 注册所有消息处理函数到分发器
internal/handlers/handlers.go:26
↓ 1 callersMethodRegisterMessageHandler
消息分发注册
pkg/sdk/sdk.go:70
↓ 1 callersMethodRemoveClient
RemoveClient 从房间移除客户端
pkg/hub/room.go:74
↓ 1 callersFunctionRoomCreated
RoomCreated 记录创建房间
internal/metrics/metrics.go:196
↓ 1 callersFunctionRoomDeleted
RoomDeleted 记录删除房间
internal/metrics/metrics.go:202
↓ 1 callersFunctionRoomJoined
RoomJoined 记录加入房间
internal/metrics/metrics.go:208
↓ 1 callersFunctionRoomLeft
RoomLeft 记录离开房间
internal/metrics/metrics.go:214
↓ 1 callersMethodSetReadLimit
(int64)
internal/websocket/conn_iface.go:9
↓ 1 callersMethodSetWriteDeadline
(time.Time)
internal/websocket/conn_iface.go:11
↓ 1 callersFunctionSetupConfigHotReload
SetupConfigHotReload sets up hot reload for the configuration file
configs/config.go:122
↓ 1 callersMethodUpdateAckPending
UpdateAckPending 更新等待确认的消息数量
pkg/bus/nats/metrics.go:102
↓ 1 callersFunctionZeroFields
func main() { // 定义命令行参数 port := flag.Int("port", 8080, "WebSocket服务端口") id := flag.String("id", "client", "客户端ID,用于在输出中区分") flag.Parse() // 构建
test_client.go:81
↓ 1 callersMethodauthenticateWebSocket
authenticateWebSocket 对WebSocket连接进行认证。
server/server.go:237
↓ 1 callersFunctionbuildConfig
(opts *Options)
server/server.go:368
↓ 1 callersMethodcleanExpired
cleanExpired 清理过期的消息缓存
pkg/hub/dedup.go:84
↓ 1 callersFunctioncreateMessageBus
(cluster configs.Cluster)
server/server.go:405
↓ 1 callersFunctiondefaultOptions
()
server/server.go:323
↓ 1 callersFunctionextractToken
(r *http.Request)
server/server.go:418
↓ 1 callersFunctionfillDefaults
(opts *Options)
server/server.go:338
↓ 1 callersFunctiongenerateClientID
(r *http.Request, claims *auth.TokenClaims)
server/server.go:434
↓ 1 callersFunctiongenerateNodeID
()
pkg/hub/hub.go:75
↓ 1 callersFunctiongetRandomPort
获取随机可用端口
pkg/bus/nats/core_test.go:60
↓ 1 callersFunctiongetUsername
(claims *auth.TokenClaims)
server/server.go:450
↓ 1 callersMethodinitComponents
initComponents 初始化内部组件
server/server.go:197
↓ 1 callersFunctionnatsExample
natsExample 演示使用NATS的集群模式
examples/cluster/main.go:29
↓ 1 callersFunctionprepareJsonPayload
prepareJsonPayload 准备消息的JSON载荷
pkg/hub/hub.go:366
↓ 1 callersMethodprocessBroadcastMessages
processBroadcastMessages 处理从给定的广播通道接收消息,直到上下文完成或通道关闭。
pkg/hub/hub.go:122
↓ 1 callersMethodprocessBusMessage
(data []byte)
pkg/hub/hub.go:137
↓ 1 callersMethodprocessRoomMessage
processRoomMessage 处理从bus接收的房间消息
pkg/hub/room.go:227
↓ 1 callersMethodprocessRoomMessagesLoop
processRoomMessagesLoop 处理房间消息循环
pkg/hub/room.go:212
↓ 1 callersMethodprocessUnicastMessages
processUnicastMessages 处理从给定的单播通道接收消息,直到上下文完成、通道关闭或客户端断开连接。
pkg/hub/hub.go:213
↓ 1 callersMethodreadLoop
()
pkg/hub/client.go:100
↓ 1 callersMethodsetupBusSubscriptions
(ctx context.Context)
pkg/hub/hub.go:83
↓ 1 callersMethodsetupClient
setupClient 创建、配置并注册新客户端。
server/server.go:266
↓ 1 callersMethodsetupJetStream
setupJetStream 设置JetStream
pkg/bus/nats/nats.go:141
↓ 1 callersFunctionsetupLogging
(level string)
server/server.go:399
↓ 1 callersMethodsetupRoomSubscriptions
setupRoomSubscriptions 设置房间消息订阅
pkg/hub/room.go:169
↓ 1 callersMethodsubscribeClientUnicast
subscribeClientUnicast 为客户端订阅单播消息
pkg/hub/hub.go:248
↓ 1 callersMethodsubscribeJetStream
subscribeJetStream 使用JetStream订阅
pkg/bus/nats/core_pubsub.go:264
↓ 1 callersMethodsubscribeJetStreamWithTimestamp
subscribeJetStreamWithTimestamp 使用JetStream订阅并解析时间戳
pkg/bus/nats/core_pubsub.go:608
↓ 1 callersMethodsubscribeRoutine
subscribeRoutine 订阅Redis频道
pkg/bus/redis/subscribe.go:13
↓ 1 callersMethodsubscribeRoutineWithTimestamp
subscribeRoutineWithTimestamp 订阅Redis频道并解析时间戳
pkg/bus/redis/subscribe.go:70
↓ 1 callersMethodsubscribeStandard
subscribeStandard 使用标准NATS订阅
pkg/bus/nats/core_pubsub.go:214
↓ 1 callersMethodsubscribeStandardWithTimestamp
subscribeStandardWithTimestamp 使用标准NATS订阅并解析时间戳
pkg/bus/nats/core_pubsub.go:546
↓ 1 callersMethodtriggerEvent
触发事件(内部使用)
pkg/sdk/sdk.go:239
↓ 1 callersMethodwriteLoop
()
pkg/hub/client.go:125
MethodAuthenticate
Authenticate 实现Authenticator接口,验证JWT令牌
pkg/auth/jwt.go:65
MethodBroadcastAll
(message []byte)
pkg/sdk/sdk.go:46
MethodBroadcastAll
(message []byte)
pkg/sdk/sdk.go:119
MethodBroadcastToRoom
BroadcastToRoom 向房间内所有客户端广播消息
pkg/hub/room.go:333
MethodBroadcastToRoom
(roomID string, message []byte, excludeClientID string)
pkg/sdk/sdk.go:165
MethodCheckClientPermission
(clientID string, permission auth.Permission)
pkg/sdk/sdk.go:63
MethodCheckClientPermission
(clientID string, permission auth.Permission)
pkg/sdk/sdk.go:206
MethodCheckPermission
CheckPermission 实现Authorizer接口,检查权限
pkg/auth/jwt.go:125
MethodCheckPermission
CheckPermission 检查令牌是否有特定权限
pkg/auth/auth.go:52
MethodClientInRoom
ClientInRoom 检查客户端是否在指定房间内
pkg/hub/room.go:369
MethodClose
Close 关闭房间管理器
pkg/hub/room.go:391
MethodClose
()
pkg/hub/integration_test.go:100
MethodClose
()
pkg/hub/hub_test.go:54
MethodClose
()
pkg/hub/hub_test.go:181
MethodClose
()
pkg/hub/client.go:42
MethodClose
Close 实现SDK接口的关闭方法
pkg/sdk/sdk.go:259
MethodClose
Close 实现MessageBus.Close,标记为已关闭
pkg/bus/noop/noop.go:90
MethodClose
Close 实现MessageBus.Close,关闭Redis连接
pkg/bus/redis/redis.go:179
MethodClose
Close 实现MessageBus.Close,关闭NATS连接
pkg/bus/nats/nats.go:267
MethodClose
()
internal/integration/mocks.go:52
MethodClose
()
internal/websocket/conn_iface.go:12
MethodCreateRoom
CreateRoom 创建一个新房间
pkg/hub/room.go:265
MethodCreateRoom
实现SDK接口的房间管理方法
pkg/sdk/sdk.go:136
MethodDecodeAndRoute
DecodeAndRoute 实现了 MessageDispatcher 接口
pkg/hub/hub_test.go:198
← previousnext →101–200 of 347, ranked by callers