go-http-dialer
go-http-dialer copied to clipboard
Not a drop in replacement
Okay, to be fair, I am pretty new at Go, so pardon my naiveté.
I am trying to use http_dialer#New
as a drop in replacement for a constructor that can accept a parameter of type *net.Dialer
. However, when I use it, I get:
cannot use http_dialer.New(forwarder.Proxy, nil) (type *http_dialer.HttpTunnel) as type *net.Dialer in field value
I tried casting it (net.Dialer(*http_dialer.New(forwarder.Proxy, nil))
), but I get:
cannot convert *http_dialer.New(forwarder.Proxy, nil) (type http_dialer.HttpTunnel) to type net.Dialer
Okay, I think I am getting closer. I tried setting Dial
of the client:
client.Dialer.Dial = http_dialer.New(
forwarder.Proxy,
http_dialer.WithDialer(client.Dialer),
).Dial
where client
is an instance of github.com/miekg/dns.Client
However, now I get:
cannot assign to client.Dialer.Dial