mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
408 B
25 lines
408 B
// +build !confonly
|
|
|
|
package dispatcher
|
|
|
|
import "context"
|
|
|
|
//go:generate errorgen
|
|
|
|
type key int
|
|
|
|
const (
|
|
sniffing key = iota
|
|
)
|
|
|
|
func ContextWithSniffingResult(ctx context.Context, r SniffResult) context.Context {
|
|
return context.WithValue(ctx, sniffing, r)
|
|
}
|
|
|
|
func SniffingResultFromContext(ctx context.Context) SniffResult {
|
|
if c, ok := ctx.Value(sniffing).(SniffResult); ok {
|
|
return c
|
|
}
|
|
return nil
|
|
}
|