mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-10-20 16:24:25 +00:00
15 lines
320 B
Go
15 lines
320 B
Go
package adapter
|
|
|
|
import "context"
|
|
|
|
type keepSessionKey struct{}
|
|
|
|
func ContextWithKeepSession(ctx context.Context) context.Context {
|
|
return context.WithValue(ctx, (*keepSessionKey)(nil), true)
|
|
}
|
|
|
|
func KeepSessionFromContext(ctx context.Context) bool {
|
|
keep, _ := ctx.Value((*keepSessionKey)(nil)).(bool)
|
|
return keep
|
|
}
|