Add interrupt support for outbound groups

This commit is contained in:
世界
2023-09-15 00:07:07 +08:00
parent bd7adcbb7e
commit c320be75a7
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
}