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"
|
2017-04-24 18:19:22 -04:00
|
|
|
|
2019-02-22 18:27:21 -05:00
|
|
|
"v2ray.com/core/common/session"
|
2017-04-24 18:19:22 -04:00
|
|
|
)
|
|
|
|
|
2019-02-22 18:27:21 -05:00
|
|
|
// ContextWithSniffingConfig is a wrapper of session.ContextWithContent.
|
|
|
|
// Deprecated. Use session.ContextWithContent directly.
|
2018-07-16 07:47:00 -04:00
|
|
|
func ContextWithSniffingConfig(ctx context.Context, c *SniffingConfig) context.Context {
|
2019-02-22 18:27:21 -05:00
|
|
|
content := session.ContentFromContext(ctx)
|
|
|
|
if content == nil {
|
|
|
|
content = new(session.Content)
|
|
|
|
ctx = session.ContextWithContent(ctx, content)
|
2017-04-24 18:19:22 -04:00
|
|
|
}
|
2019-02-22 18:27:21 -05:00
|
|
|
content.SniffingRequest.Enabled = c.Enabled
|
|
|
|
content.SniffingRequest.OverrideDestinationForProtocol = c.DestinationOverride
|
|
|
|
return ctx
|
2017-04-24 18:19:22 -04:00
|
|
|
}
|