1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-08-31 00:34:14 -04:00
v2fly/app/proxyman/proxyman.go

26 lines
606 B
Go
Raw Normal View History

2018-03-19 04:40:47 -04:00
// Package proxyman defines applications for managing inbound and outbound proxies.
2016-01-31 11:01:28 -05:00
package proxyman
2017-12-02 19:04:57 -05:00
//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg proxyman -path App,Proxyman
2017-04-08 19:43:25 -04:00
2016-01-31 11:01:28 -05:00
import (
2017-01-14 18:48:37 -05:00
"context"
2016-01-31 11:01:28 -05:00
)
type key int
const (
protocolsKey key = iota
)
func ContextWithProtocolSniffers(ctx context.Context, list []KnownProtocols) context.Context {
return context.WithValue(ctx, protocolsKey, list)
}
2018-03-14 22:32:10 -04:00
func ProtocolSniffersFromContext(ctx context.Context) []KnownProtocols {
if list, ok := ctx.Value(protocolsKey).([]KnownProtocols); ok {
return list
}
return nil
}