1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-30 05:56:54 -05:00
This commit is contained in:
Darien Raymond 2018-04-01 09:58:45 +02:00
parent 90f2480037
commit 053d03349a
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -38,7 +38,7 @@ func NewClient(ctx context.Context, config *ClientConfig) (*Client, error) {
}
// Process implements OutboundHandler.Process().
func (v *Client) Process(ctx context.Context, outboundRay ray.OutboundRay, dialer proxy.Dialer) error {
func (c *Client) Process(ctx context.Context, outboundRay ray.OutboundRay, dialer proxy.Dialer) error {
destination, ok := proxy.TargetFromContext(ctx)
if !ok {
return newError("target not specified")
@ -49,7 +49,7 @@ func (v *Client) Process(ctx context.Context, outboundRay ray.OutboundRay, diale
var conn internet.Connection
err := retry.ExponentialBackoff(5, 100).On(func() error {
server = v.serverPicker.PickServer()
server = c.serverPicker.PickServer()
dest := server.Destination()
dest.Network = network
rawConn, err := dialer.Dial(ctx, dest)
@ -90,7 +90,7 @@ func (v *Client) Process(ctx context.Context, outboundRay ray.OutboundRay, diale
request.Option |= RequestOptionOneTimeAuth
}
sessionPolicy := v.v.PolicyManager().ForLevel(user.Level)
sessionPolicy := c.v.PolicyManager().ForLevel(user.Level)
ctx, cancel := context.WithCancel(ctx)
timer := signal.CancelAfterInactivity(ctx, cancel, sessionPolicy.Timeouts.ConnectionIdle)