DialProxy implements Target by dialing a new connection to Addr and then proxying data back and forth. The To func is a shorthand way of creating a DialProxy.
| 306 | // |
| 307 | // The To func is a shorthand way of creating a DialProxy. |
| 308 | type DialProxy struct { |
| 309 | // Addr is the TCP address to proxy to. |
| 310 | Addr string |
| 311 | |
| 312 | // KeepAlivePeriod sets the period between TCP keep alives. |
| 313 | // If zero, a default is used. To disable, use a negative number. |
| 314 | // The keep-alive is used for both the client connection and |
| 315 | KeepAlivePeriod time.Duration |
| 316 | |
| 317 | // DialTimeout optionally specifies a dial timeout. |
| 318 | // If zero, a default is used. |
| 319 | // If negative, the timeout is disabled. |
| 320 | DialTimeout time.Duration |
| 321 | |
| 322 | // DialContext optionally specifies an alternate dial function |
| 323 | // for TCP targets. If nil, the standard |
| 324 | // net.Dialer.DialContext method is used. |
| 325 | DialContext func(ctx context.Context, network, address string) (net.Conn, error) |
| 326 | |
| 327 | // OnDialError optionally specifies an alternate way to handle errors dialing Addr. |
| 328 | // If nil, the error is logged and src is closed. |
| 329 | // If non-nil, src is not closed automatically. |
| 330 | OnDialError func(src net.Conn, dstDialErr error) |
| 331 | |
| 332 | // ProxyProtocolVersion optionally specifies the version of |
| 333 | // HAProxy's PROXY protocol to use. The PROXY protocol provides |
| 334 | // connection metadata to the DialProxy target, via a header |
| 335 | // inserted ahead of the client's traffic. The DialProxy target |
| 336 | // must explicitly support and expect the PROXY header; there is |
| 337 | // no graceful downgrade. |
| 338 | // If zero, no PROXY header is sent. Currently, version 1 is supported. |
| 339 | ProxyProtocolVersion int |
| 340 | } |
| 341 | |
| 342 | // UnderlyingConn returns c.Conn if c of type *Conn, |
| 343 | // otherwise it returns c. |
nothing calls this directly
no outgoing calls
no test coverage detected