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
|
|
|
|
|
|
|
|
import (
|
2017-01-14 18:48:37 -05:00
|
|
|
"context"
|
2016-01-31 11:01:28 -05:00
|
|
|
)
|
|
|
|
|
2017-04-24 18:19:22 -04: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 {
|
2017-04-24 18:19:22 -04:00
|
|
|
if list, ok := ctx.Value(protocolsKey).([]KnownProtocols); ok {
|
|
|
|
return list
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|