Add interrupt support for outbound groups

This commit is contained in:
世界
2023-09-16 00:09:41 +08:00
parent bd7adcbb7e
commit c320be75a7
10 changed files with 282 additions and 55 deletions
+13
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
}