Skip to content

Commit

Permalink
fix for golang 1.23
Browse files Browse the repository at this point in the history
Replace KeepAlive with KeepAliveConfig
Fixes
```
• [FAILED] [0.001 seconds]
Linux-specific tests [It] enables TCP (socket) keepalive with an appropriate interval
/tmp/build/1944c6a2/gopath/src/github.com/cloudfoundry/bosh-utils/httpclient/keepalive_syscall_linux_test.go:17

  [FAILED] Expected
      <int>: 15
  to equal
      <int>: 30
  In [It] at: /tmp/build/1944c6a2/gopath/src/github.com/cloudfoundry/bosh-utils/httpclient/keepalive_syscall_linux_test.go:58 @ 09/03/24 14:42:33.858

  Full Stack Trace
    github.com/cloudfoundry/bosh-utils/httpclient_test.init.func3.1()
    	/tmp/build/1944c6a2/gopath/src/github.com/cloudfoundry/bosh-utils/httpclient/keepalive_syscall_linux_test.go:58 +0x81a
```
  • Loading branch information
xtreme-nitin-ravindran committed Sep 3, 2024
1 parent 95a094e commit a2df4cc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/cloudfoundry/bosh-utils

go 1.21.0
go 1.23.0

require (
code.cloudfoundry.org/clock v1.0.0
Expand Down
14 changes: 10 additions & 4 deletions httpclient/default_http_clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ import (
var (
DefaultClient = CreateDefaultClientInsecureSkipVerify()
defaultDialerContextFunc = SOCKS5DialContextFuncFromEnvironment((&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
Timeout: 30 * time.Second,
KeepAliveConfig: net.KeepAliveConfig{
Enable: true,
Interval: 30 * time.Second,
},
}), proxy.NewSocks5Proxy(proxy.NewHostKey(), log.New(io.Discard, "", log.LstdFlags), 1*time.Minute))
)

Expand Down Expand Up @@ -56,8 +59,11 @@ func CreateDefaultClientInsecureSkipVerify() *http.Client {

func ResetDialerContext() {
defaultDialerContextFunc = SOCKS5DialContextFuncFromEnvironment((&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
Timeout: 30 * time.Second,
KeepAliveConfig: net.KeepAliveConfig{
Enable: true,
Interval: 30 * time.Second,
},
}), proxy.NewSocks5Proxy(proxy.NewHostKey(), log.New(io.Discard, "", log.LstdFlags), 1*time.Minute))
}

Expand Down

0 comments on commit a2df4cc

Please sign in to comment.