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

transport/http: use ipv4 explicitly for dialers if ipv6 is not supported #2549

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

Conversation

melinath
Copy link

This is a workaround for golang/go#25321, and is related to hashicorp/terraform-provider-google#6782

For additional context, see yaqs/5034757202074664960 and yaqs/47302089738551296.

@melinath melinath requested a review from a team as a code owner April 26, 2024 20:37
@melinath
Copy link
Author

The conventionalcommits linter conflicts with https://github.com/googleapis/google-api-go-client/blob/main/CONTRIBUTING.md - which should I follow?

@melinath
Copy link
Author

I'll assume conventionalcommits for now.

@enocom
Copy link
Member

enocom commented May 3, 2024

Related to hashicorp/terraform-provider-google#6782

Copy link
Contributor

@noahdietz noahdietz left a comment

Choose a reason for hiding this comment

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

I'd like @codyoss to weigh in here too

trans.DialContext = func(ctx context.Context, network string, addr string) (net.Conn, error) {
// Don't try IPv6 if it's not supported.
// https://github.com/golang/go/issues/25321
if !nettest.SupportsIPv6() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit hesitant to use a package meant for testing in a production context. Is this what the Go team recommends? Is there any other package we can use that is meant for critical path usage?

Copy link
Member

Choose a reason for hiding this comment

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

I think this package would be fine to use as it is meant to test the network and not necessary unit tests. This does feel like code that should happen in terraform though maybe and not here. I think the reason for putting it here is that our transport function is not handling some of the mTLS bits that our NewHTTPClient function does. Is that correct @melinath? If so maybe we can move that logic ad NewHTTPClient calls into NewTransport.

Copy link
Contributor

Choose a reason for hiding this comment

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

and not necessary unit tests.

Some of the APIs in that package take testing.T which gave me pause.

meant to test the network

The package description is Package nettest provides utilities for network testing. which is sufficiently vague..."testing aspects of the network setup" vs. "network testing" vs. "for us in tests relating to the network" are all reasonable interpretations of this.

Copy link
Member

Choose a reason for hiding this comment

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

Some of the APIs in that package take testing.T which gave me pause.

I had not noticed that at first glance. That does give me more pause.

@noahdietz noahdietz requested a review from codyoss May 3, 2024 19:04
@noahdietz
Copy link
Contributor

The conventionalcommits linter conflicts with https://github.com/googleapis/google-api-go-client/blob/main/CONTRIBUTING.md - which should I follow?

I'll fix this, thanks for the shout out.

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

4 participants