mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-16 01:17:30 -05:00
24 lines
462 B
Go
24 lines
462 B
Go
// Package proxyman defines applications for managing inbound and outbound proxies.
|
|
package proxyman
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
type key int
|
|
|
|
const (
|
|
sniffing key = iota
|
|
)
|
|
|
|
func ContextWithSniffingConfig(ctx context.Context, c *SniffingConfig) context.Context {
|
|
return context.WithValue(ctx, sniffing, c)
|
|
}
|
|
|
|
func SniffingConfigFromContext(ctx context.Context) *SniffingConfig {
|
|
if c, ok := ctx.Value(sniffing).(*SniffingConfig); ok {
|
|
return c
|
|
}
|
|
return nil
|
|
}
|