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.
26 lines
606 B
26 lines
606 B
// Package proxyman defines applications for managing inbound and outbound proxies.
|
|
package proxyman
|
|
|
|
//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg proxyman -path App,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
|
|
}
|