fix: 停用删除重置密码发 fatal 并注入 Downlink 发 revoked

This commit is contained in:
Nixevol
2026-09-30 10:55:25 +08:00
parent 479a08ee11
commit 1d6be59652
7 changed files with 396 additions and 36 deletions
+30
View File
@@ -145,6 +145,7 @@ func runServe(ctx context.Context, cfg config.Config) error {
MaxScheduleSeconds: int64(cfg.Limits.MaxScheduleSeconds),
Logger: slog.Default(),
ConnControl: brk,
Downlink: brk,
})
uplink.identity = idApp
@@ -173,6 +174,7 @@ func runServe(ctx context.Context, cfg config.Config) error {
Groups: groupApp,
Config: cfg,
Version: Version,
// Kick:只断开,令牌不变,SDK 重连(PRD 踢下线)。
KickEndpoint: func(kickCtx context.Context, endpointID string) (bool, error) {
if _, found := brk.ConnInfoOf(endpointID); !found {
return false, nil
@@ -182,6 +184,34 @@ func runServe(ctx context.Context, cfg config.Config) error {
}
return true, nil
},
// 停用/删除/重置:先 fatal 再断开(DEVELOPMENT 6.8)。
DisableKick: func(kickCtx context.Context, endpointID string) (bool, error) {
if _, found := brk.ConnInfoOf(endpointID); !found {
return false, nil
}
if err := sess.Disable(kickCtx, endpointID); err != nil {
return false, err
}
return true, nil
},
DeleteKick: func(kickCtx context.Context, endpointID string) (bool, error) {
if _, found := brk.ConnInfoOf(endpointID); !found {
return false, nil
}
if err := sess.Deleted(kickCtx, endpointID); err != nil {
return false, err
}
return true, nil
},
PasswordResetKick: func(kickCtx context.Context, endpointID string) (bool, error) {
if _, found := brk.ConnInfoOf(endpointID); !found {
return false, nil
}
if resetErr := sess.ResetPassword(kickCtx, endpointID); resetErr != nil {
return false, resetErr
}
return true, nil
},
})
metricsReg := metrics.New()