-
Notifications
You must be signed in to change notification settings - Fork 716
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #340 from go-resty/dev-iteration
Dev iteration
- Loading branch information
Showing
11 changed files
with
127 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// +build go1.13 | ||
|
||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
package resty | ||
|
||
import ( | ||
"net" | ||
"net/http" | ||
"runtime" | ||
"time" | ||
) | ||
|
||
func createTransport(localAddr net.Addr) *http.Transport { | ||
dialer := &net.Dialer{ | ||
Timeout: 30 * time.Second, | ||
KeepAlive: 30 * time.Second, | ||
DualStack: true, | ||
} | ||
if localAddr != nil { | ||
dialer.LocalAddr = localAddr | ||
} | ||
return &http.Transport{ | ||
Proxy: http.ProxyFromEnvironment, | ||
DialContext: dialer.DialContext, | ||
ForceAttemptHTTP2: true, | ||
MaxIdleConns: 100, | ||
IdleConnTimeout: 90 * time.Second, | ||
TLSHandshakeTimeout: 10 * time.Second, | ||
ExpectContinueTimeout: 1 * time.Second, | ||
MaxIdleConnsPerHost: runtime.GOMAXPROCS(0) + 1, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// +build !go1.13 | ||
|
||
// Copyright (c) 2015-2020 Jeevanandam M ([email protected]), All rights reserved. | ||
// resty source code and usage is governed by a MIT style | ||
// license that can be found in the LICENSE file. | ||
|
||
package resty | ||
|
||
import ( | ||
"net" | ||
"net/http" | ||
"runtime" | ||
"time" | ||
) | ||
|
||
func createTransport(localAddr net.Addr) *http.Transport { | ||
dialer := &net.Dialer{ | ||
Timeout: 30 * time.Second, | ||
KeepAlive: 30 * time.Second, | ||
DualStack: true, | ||
} | ||
if localAddr != nil { | ||
dialer.LocalAddr = localAddr | ||
} | ||
return &http.Transport{ | ||
Proxy: http.ProxyFromEnvironment, | ||
DialContext: dialer.DialContext, | ||
MaxIdleConns: 100, | ||
IdleConnTimeout: 90 * time.Second, | ||
TLSHandshakeTimeout: 10 * time.Second, | ||
ExpectContinueTimeout: 1 * time.Second, | ||
MaxIdleConnsPerHost: runtime.GOMAXPROCS(0) + 1, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters