client: add proxy option (#1885)
* client: add proxy option * client: add WithProxy CallOption * use address option * ProxyAddress => Proxy
This commit is contained in:
		
							
								
								
									
										10
									
								
								grpc.go
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								grpc.go
									
									
									
									
									
								
							| @@ -411,6 +411,11 @@ func (g *grpcClient) Call(ctx context.Context, req client.Request, rsp interface | ||||
| 			callOpts.Selector = g.opts.Selector | ||||
| 		} | ||||
|  | ||||
| 		// inject proxy address | ||||
| 		if len(callOpts.Address) == 0 && len(g.opts.Proxy) > 0 { | ||||
| 			callOpts.Address = []string{g.opts.Proxy} | ||||
| 		} | ||||
|  | ||||
| 		// lookup the route to send the reques to | ||||
| 		route, err := client.LookupRoute(req, callOpts) | ||||
| 		if err != nil { | ||||
| @@ -514,6 +519,11 @@ func (g *grpcClient) Stream(ctx context.Context, req client.Request, opts ...cli | ||||
| 			callOpts.Selector = g.opts.Selector | ||||
| 		} | ||||
|  | ||||
| 		// inject proxy address | ||||
| 		if len(callOpts.Address) == 0 && len(g.opts.Proxy) > 0 { | ||||
| 			callOpts.Address = []string{g.opts.Proxy} | ||||
| 		} | ||||
|  | ||||
| 		// lookup the route to send the reques to | ||||
| 		route, err := client.LookupRoute(req, callOpts) | ||||
| 		if err != nil { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user