For non-H2C traffic, we use DialContext and grab the configured dial info from ctx. We do this because the upstream to dial is chosen dynamically, using load balancing selection policies etc.
We use a special config string <network>/<addr> (for example tcp/127.0.0.1:8080 or unix//path/to/unix.sock) so we can embed the network type in a single string.
A user reported that they want to use H2C with a unix socket. The issue is that the network type isn't retained, because the network/address is parsed on each request, and that would require the context so that we can grab a ctx.Value() with the current request's dial info... so it defaults to tcp instead.
We could hack in a thing to make sure the right network is used if the upstream is not dynamic, but that's... hacky and limits usecases.
The better fix would be to actually have access to the context via a new DialTLSContext field on the http2.Transport.
I expect this would have similar semantics to http.Transport's DialContext where if DialContext is non-nil, then it's used, otherwise Dial is used.
At a glance, this looks like it would a trivial change to func (t *Transport) dialTLS(ctx context.Context) right at the top of that function: