fix: 合并停用删除重置密码发 fatal 与 revoked
This commit is contained in:
@@ -146,6 +146,7 @@ func runServe(ctx context.Context, cfg config.Config) error {
|
||||
MaxScheduleSeconds: int64(cfg.Limits.MaxScheduleSeconds),
|
||||
Logger: slog.Default(),
|
||||
ConnControl: brk,
|
||||
Downlink: brk,
|
||||
ClientIP: func(r *http.Request) string {
|
||||
return httpx.ClientIP(r, trustedNets)
|
||||
},
|
||||
@@ -176,6 +177,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
|
||||
@@ -185,6 +187,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()
|
||||
|
||||
Reference in New Issue
Block a user