1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-20 03:16:24 -05:00
v2fly/app/proxyman/proxyman.go
2018-05-25 23:20:24 +02:00

24 lines
493 B
Go

// Package proxyman defines applications for managing inbound and outbound proxies.
package proxyman
import (
"context"
)
type key int
const (
protocolsKey key = iota
)
func ContextWithProtocolSniffers(ctx context.Context, list []KnownProtocols) context.Context {
return context.WithValue(ctx, protocolsKey, list)
}
func ProtocolSniffersFromContext(ctx context.Context) []KnownProtocols {
if list, ok := ctx.Value(protocolsKey).([]KnownProtocols); ok {
return list
}
return nil
}