mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-12-01 14:18:36 +00:00
15 lines
411 B
Go
15 lines
411 B
Go
package interrupt
|
|
|
|
import "context"
|
|
|
|
type contextKeyIsExternalConnection struct{}
|
|
|
|
func ContextWithIsExternalConnection(ctx context.Context, isExternal bool) context.Context {
|
|
return context.WithValue(ctx, contextKeyIsExternalConnection{}, isExternal)
|
|
}
|
|
|
|
func IsExternalConnectionFromContext(ctx context.Context) bool {
|
|
isExternal, _ := ctx.Value(contextKeyIsExternalConnection{}).(bool)
|
|
return isExternal
|
|
}
|