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 (
|
2018-07-16 07:47:00 -04:00
|
|
|
sniffing key = iota
|
2017-04-24 18:19:22 -04:00
|
|
|
)
|
|
|
|
|
2018-07-16 07:47:00 -04:00
|
|
|
func ContextWithSniffingConfig(ctx context.Context, c *SniffingConfig) context.Context {
|
|
|
|
return context.WithValue(ctx, sniffing, c)
|
2017-04-24 18:19:22 -04:00
|
|
|
}
|
|
|
|
|
2018-07-16 07:47:00 -04:00
|
|
|
func SniffingConfigFromContext(ctx context.Context) *SniffingConfig {
|
|
|
|
if c, ok := ctx.Value(sniffing).(*SniffingConfig); ok {
|
|
|
|
return c
|
2017-04-24 18:19:22 -04:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|