@@ -51,6 +51,37 @@ func NewClient(netConn net.Conn, u *url.URL, requestHeader http.Header, readBufS
51
51
//
52
52
// It is safe to call Dialer's methods concurrently.
53
53
type Dialer struct {
54
+ // Custom dial functions can be set on the Dialer to create the TCP connection
55
+ // to the backend server. Multiple dial functions can be set simultaneously,
56
+ // with the priority of the dial function as follows:
57
+ // 1) NetDialTLSContext (only if backend server scheme is HTTPS)
58
+ // 2) NetDialContext
59
+ // 3) NetDial
60
+ // IMPORTANT CAVEAT: If the "proxy" function field is also set, and it returns
61
+ // a valid proxy URL, then the custom dial functions INSTEAD create the TCP
62
+ // connection to the proxy. The matrix of proxy/backend schemes with custom dial
63
+ // functions looks like:
64
+ // 1) Proxy: HTTP, Backend: HTTP
65
+ // a) NetDialContext, then NetDial functions used to connect to proxy
66
+ // if set.
67
+ // 2) Proxy: HTTP, Backend: HTTPS
68
+ // a) NetDialContext, then NetDial functions used for proxy connection
69
+ // if set.
70
+ // b) TLSClientConfig used for backend server TLS handshake over previously
71
+ // created proxy connection. (NetDialTLSContext ignored if set).
72
+ // 3) Proxy: HTTPS, Backend: HTTP
73
+ // a) NetDialTLSContext used to dial/TLS handshake proxy if set.
74
+ // b) Otherwise if NetDialContext or NetDial are set, the are used
75
+ // to create TCP connection to proxy, while TLSClientConfig is
76
+ // used to perform proxy TLS handshake.
77
+ // 4) Proxy: HTTPS, Backend: HTTPS
78
+ // a) NetDialTLSContext used to dial/TLS handshake proxy if set.
79
+ // b) Otherwise if NetDialContext or NetDial are set, the are used
80
+ // to create TCP connection to proxy, while TLSClientConfig is
81
+ // used to perform proxy TLS handshake.
82
+ // c) TLSClientConfig is also used for backend server TLS handshake
83
+ // over previously created proxy connection.
84
+ //
54
85
// NetDial specifies the dial function for creating TCP connections. If
55
86
// NetDial is nil, net.Dialer DialContext is used.
56
87
// If "Proxy" field is also set, this function dials the proxy.
0 commit comments