# What is the alternatives of &http.transport while converting it to Elastic go client?

**URL:** <https://discuss.elastic.co/t/what-is-the-alternatives-of-http-transport-while-converting-it-to-elastic-go-client/156630>\
**Category:** Elasticsearch\
**Created:** [November 14, 2018, 10:36am UTC](https://discuss.elastic.co/t/what-is-the-alternatives-of-http-transport-while-converting-it-to-elastic-go-client/156630 "2018-11-14T10:36:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohit\_kumar\_Jain](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@rohit\_kumar\_Jain](https://discuss.elastic.co/u/rohit_kumar_Jain)\
**Post date:** [November 14, 2018, 10:36am UTC](https://discuss.elastic.co/t/what-is-the-alternatives-of-http-transport-while-converting-it-to-elastic-go-client/156630/1 "2018-11-14T10:36:03Z")

</div>

Hi team,

how do we implement tcp proxy using elastic go client? Any lead would be appreciated..... I have written code using http in golang... but now I want it to convert it using elastic go client...

client := &http.Client{}  
ret := os.Getenv("SOCKS5\_PROXY")  
if (ret != "") {  
log.Println("Environment variable SOCKS5\_PROXY set to: " + os.Getenv("SOCKS5\_PROXY"))

```
	// create a socks5 dialer
	dialer, err := proxy.SOCKS5("tcp", ret, nil, proxy.Direct)
	if err != nil {
		fmt.Fprintln(os.Stderr, "can't connect to the proxy:", err)
		os.Exit(1)
	}

	// setup a http client
	httpTransport := &http.Transport{}

	// set our socks5 as the dialer
	httpTransport.Dial = dialer.Dial
	client = &http.Client{Transport: httpTransport}
}

```

I am not able to implement same by using elastic go client...(ex: client, err := elastic.NewClient() ).. Can somebody please help me.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 12, 2018, 10:36am UTC](https://discuss.elastic.co/t/what-is-the-alternatives-of-http-transport-while-converting-it-to-elastic-go-client/156630/2 "2018-12-12T10:36:10Z")

</div>

Closed on December 12, 2018, 10:36am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
