Here's the solution. You generate a proxyUrl and then a dialer like so:
proxyURL, _ := url.Parse("http://proxy-ip:proxy-port") proxyURL.User = url.UserPassword("proxy-username", "proxy-password") dialer := websocket.Dialer{ Proxy: http.ProxyURL(proxyURL), } conn, _, _ := dialer.Dial(WEBSOCKET_URL, nil) On Thursday, March 7, 2019 at 4:51:47 PM UTC+5:30, Subramanian Sridharan wrote: > > Hello Gophers, > > I've been using Gorilla Websocket for a persistent connection and it has > been working as expected. > Now there is a need to achieve the same functionality over a Proxy. > After researching a bit, I came across > http.ProxyFromEnvironment > > But I need to connect to the Proxy using an URL, a proxy username and > password. > > It looks like I should use this function > func (hpd *httpProxyDialer) Dial(network string, addr string) (net.Conn, > error) > > Can someone explain how I should set the Username and Password for the > hpd, if possible, with an example? > > Reference: https://github.com/gorilla/websocket/blob/master/proxy.go > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.