mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-12-05 04:46:40 +00:00
14 lines
359 B
Go
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
|
||
|
}
|