Hi All: I have a client which will establish TLS connection to backend service.
There are two kind of scenarios that I encounter. 1. Direct network: client--->server The client connect directly to server. var d tls.Dialer //... c1 := d.Dial("tcp", addr) It is ok, the network packet is expected. client use 3-way handshake to setup tcp connection, then start TLS handshake, client send "*Client Hello*", server return "*Server Hello*", and ... 2. Proxy network: client --> proxy --> server In this network, client need connect server via proxy, I use *golang.org/x/net/proxy *in client to connect proxy, as proxy is http proxy, client use net.Dialer to connect proxy via tcp. dailer, err := proxy.FromURL(proxy, &net.Dialer{ Timeout: TCP_CONNECT_TIMEOUT, KeepAlive: TCP_KEEPALIVE_TIMEOUT, }) c2 := dailer.Dial("tcp", addr) I setup a tcp connection to proxy, and send http *CONNECT* to proxy that proxy will start to setup a tcp connection to server, after connection ready, c2 is the net.Conn which is client connect to proxy, But I think client has Not sent *Client Hello *packet yet*.* As now, client need send TLS handshake to server via proxy, I think *"tls.Dialer Dial("tcp", addr)" *can do TLS handshake, but it will establish and return a new connection, I do not know how to ask tls.Dialer reuse *c2* net.Conn*? * Any comments is appreciated. -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/de3c5718-a671-49b7-90f2-b4d5359f4b6en%40googlegroups.com.