1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-09 09:20:45 +00:00
v2fly/app/dispatcher/dispatcher.go
2019-02-01 20:08:21 +01:00

25 lines
408 B
Go

// +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
}