docker / go-connections

Utility package to work with network connections
https://pkg.go.dev/github.com/docker/go-connections
Apache License 2.0
214 stars 101 forks source link

ConfigureTransport: make sure a clean DialContext is used for tcp #103

Closed akerouanton closed 10 months ago

akerouanton commented 10 months ago

Since #61, there's no more DialContext defined in the default switch case of ConfigureTransport. As a consequence, if ConfigureTransport was already called with a npipe or unix proto (ie. Docker client does that to initialize its HTTP client with the default DOCKER_HOST), the DialContext function defined by these protocols will be used.

As the DialContext functions defined by unix and npipe protos totally ignore DialContext's 2nd and 3rd argument (ie. network and addr) and instead use the equivalent arguments passed to configureUnixTransport and configureNpipeTransport when they were called, this results in ConfigureTransport being totally ineffective.

In addition, DisableCompression is also reset to false.

thaJeztah commented 10 months ago

Ci is doing funny things

Screenshot 2023-10-27 at 13 13 29
thaJeztah commented 10 months ago

DOH! And I'm guessing we have a cert as fixture somewhere, which has expired and must be regenerated;

 config_test.go:249: Unable to verify certificate 1: x509: certificate has expired or is not yet valid
akerouanton commented 10 months ago

golangci-lint errors should go away once #104 is merged.

akerouanton commented 10 months ago

Based on CI error seen in https://github.com/moby/moby/pull/46739, I added a commit reverting fcf9eb7.

thaJeztah commented 10 months ago

Thanks all! Let me bring this one in