Files
SingboxForPanel/common/interrupt/context.go
CN-JS-HuiBai 9f867b19da First Commmit
2026-04-14 22:41:14 +08:00

14 lines
359 B
Go

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
}