tls-client
tls-client copied to clipboard
[Feature Request]: Setting custom Dial function
Describe the feature / enhancement and how it would improve things
Inspiration is from imroc/req: https://pkg.go.dev/github.com/imroc/req/v3#Client.SetDial
Describe how your proposal will work, with code and/or pseudo-code
package main
import (
"context"
"net"
"github.com/imroc/req/v3"
)
func main() {
reqC := req.C()
reqC.SetDial(func(ctx context.Context, network string, addr string) (net.Conn, error) {
return net.Dial(network, addr)
})
}
This could be used for custom proxy handling, or other advanced options before establshing the connections.
@l10r There is the WithDialer Option:
https://github.com/bogdanfinn/tls-client/blob/master/client_options.go#L124
It would be nice if it came with more control, like an actual way to return the net.Conn, like imroc/req api, because to be honest I have no clue how to set a net.Dialer that does something like that. Couldn't get it done with LLMs aswell