Files
sing-box-extended-mirror/common/interrupt/context.go
T

14 lines
359 B
Go
Raw Normal View History

2023-09-15 00:07:07 +08:00
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
}