Add interrupt support for outbound groups

This commit is contained in:
世界
2023-09-15 00:07:07 +08:00
parent 274a147e89
commit 09cf71cc2d
10 changed files with 282 additions and 55 deletions

View File

@@ -0,0 +1,13 @@
package interrupt
import "context"
type contextKeyIsExternalConnection struct{}
func ContextWithIsExternalConnection(ctx context.Context) context.Context {
return context.WithValue(ctx, contextKeyIsExternalConnection{}, true)
}
func IsExternalConnectionFromContext(ctx context.Context) bool {
return ctx.Value(contextKeyIsExternalConnection{}) != nil
}