2017-01-03 14:21:59 +01:00
|
|
|
// Package proxyman defines applications for manageing inbound and outbound proxies.
|
2016-01-31 17:01:28 +01:00
|
|
|
package proxyman
|
|
|
|
|
2017-12-03 01:04:57 +01:00
|
|
|
//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg proxyman -path App,Proxyman
|
2017-04-09 01:43:25 +02:00
|
|
|
|
2016-01-31 17:01:28 +01:00
|
|
|
import (
|
2017-01-15 00:48:37 +01:00
|
|
|
"context"
|
2016-01-31 17:01:28 +01:00
|
|
|
)
|
|
|
|
|
2017-04-25 00:19:22 +02:00
|
|
|
type key int
|
|
|
|
|
|
|
|
const (
|
|
|
|
protocolsKey key = iota
|
|
|
|
)
|
|
|
|
|
|
|
|
func ContextWithProtocolSniffers(ctx context.Context, list []KnownProtocols) context.Context {
|
|
|
|
return context.WithValue(ctx, protocolsKey, list)
|
|
|
|
}
|
|
|
|
|
|
|
|
func ProtocoSniffersFromContext(ctx context.Context) []KnownProtocols {
|
|
|
|
if list, ok := ctx.Value(protocolsKey).([]KnownProtocols); ok {
|
|
|
|
return list
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|