mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-05 09:47:56 -05:00
26 lines
606 B
Go
26 lines
606 B
Go
// Package proxyman defines applications for manageing 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 ProtocoSniffersFromContext(ctx context.Context) []KnownProtocols {
|
|
if list, ok := ctx.Value(protocolsKey).([]KnownProtocols); ok {
|
|
return list
|
|
}
|
|
return nil
|
|
}
|