Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the round tripper use the dialer's context #4353

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

deweerdt
Copy link

@deweerdt deweerdt commented Mar 6, 2024

this is useful in getting https://pkg.go.dev/net/http/httptrace events related to DNS when using the round tripper to make a request. Other events related to the connection continue not to work.

@deweerdt
Copy link
Author

deweerdt commented Mar 6, 2024

this addresses the DNS part of #3342

Copy link
Member

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any precedent for moving address resolution into the HTTP layer? Does HTTP/2 do that?

if host, port, err = net.SplitHostPort(addr); err != nil {
return nil, err
}
if portnum, err = net.DefaultResolver.LookupPort(ctx, netstr, port); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? Why not just use the port? Does it cause a potential DNS roundtrip?

if host == "" {
return &net.UDPAddr{IP: net.IPAddr{}.IP, Port: portnum, Zone: net.IPAddr{}.Zone}, nil
}
ips, err := net.DefaultResolver.LookupIPAddr(ctx, host)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine that this will soon invite a request to use a different resolver here. How shall we deal with that?

@marten-seemann
Copy link
Member

@deweerdt Are you still planning to work on this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants