mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-12-04 07:38:37 +00:00
merge: Merge upstream v1.14.6
This commit is contained in:
@@ -4,12 +4,13 @@ import "context"
|
||||
|
||||
type contextKeyIsExternalConnection struct{}
|
||||
|
||||
func ContextWithIsExternalConnection(ctx context.Context) context.Context {
|
||||
return context.WithValue(ctx, contextKeyIsExternalConnection{}, true)
|
||||
func ContextWithIsExternalConnection(ctx context.Context, isExternal bool) context.Context {
|
||||
return context.WithValue(ctx, contextKeyIsExternalConnection{}, isExternal)
|
||||
}
|
||||
|
||||
func IsExternalConnectionFromContext(ctx context.Context) bool {
|
||||
return ctx.Value(contextKeyIsExternalConnection{}) != nil
|
||||
isExternal, _ := ctx.Value(contextKeyIsExternalConnection{}).(bool)
|
||||
return isExternal
|
||||
}
|
||||
|
||||
type contextKeyIsProviderConnection struct{}
|
||||
|
||||
Reference in New Issue
Block a user