sing-box/adapter/session.go
2026-10-02 18:00:09 +08:00

14 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
}