2018-03-19 08:40:47 +00:00
|
|
|
// Package proxyman defines applications for managing inbound and outbound proxies.
|
2016-01-31 16:01:28 +00:00
|
|
|
package proxyman
|
|
|
|
|
|
|
|
import (
|
2017-01-14 23:48:37 +00:00
|
|
|
"context"
|
2017-04-24 22:19:22 +00:00
|
|
|
|
2019-02-22 23:27:21 +00:00
|
|
|
"v2ray.com/core/common/session"
|
2017-04-24 22:19:22 +00:00
|
|
|
)
|
|
|
|
|
2019-02-22 23:27:21 +00:00
|
|
|
// ContextWithSniffingConfig is a wrapper of session.ContextWithContent.
|
|
|
|
// Deprecated. Use session.ContextWithContent directly.
|
2018-07-16 11:47:00 +00:00
|
|
|
func ContextWithSniffingConfig(ctx context.Context, c *SniffingConfig) context.Context {
|
2019-02-22 23:27:21 +00:00
|
|
|
content := session.ContentFromContext(ctx)
|
|
|
|
if content == nil {
|
|
|
|
content = new(session.Content)
|
|
|
|
ctx = session.ContextWithContent(ctx, content)
|
2017-04-24 22:19:22 +00:00
|
|
|
}
|
2019-02-22 23:27:21 +00:00
|
|
|
content.SniffingRequest.Enabled = c.Enabled
|
|
|
|
content.SniffingRequest.OverrideDestinationForProtocol = c.DestinationOverride
|
|
|
|
return ctx
|
2017-04-24 22:19:22 +00:00
|
|
|
}
|