cleanup: xtransport: group all consts and alike

This is mainly for case where more consts are added.

Also I think those vars were not variables but treated as
const.
This commit is contained in:
Markus Linnala 2019-10-20 17:24:02 +03:00 committed by Frank Denis
parent 92e632daf1
commit ac4843b460
1 changed files with 5 additions and 4 deletions

View File

@ -25,7 +25,11 @@ import (
netproxy "golang.org/x/net/proxy" netproxy "golang.org/x/net/proxy"
) )
const DefaultFallbackResolver = "9.9.9.9:53" const (
DefaultFallbackResolver = "9.9.9.9:53"
DefaultKeepAlive = 5 * time.Second
DefaultTimeout = 30 * time.Second
)
type CachedIPs struct { type CachedIPs struct {
sync.RWMutex sync.RWMutex
@ -48,9 +52,6 @@ type XTransport struct {
httpProxyFunction func(*http.Request) (*url.URL, error) httpProxyFunction func(*http.Request) (*url.URL, error)
} }
var DefaultKeepAlive = 5 * time.Second
var DefaultTimeout = 30 * time.Second
func NewXTransport() *XTransport { func NewXTransport() *XTransport {
xTransport := XTransport{ xTransport := XTransport{
cachedIPs: CachedIPs{cache: make(map[string]string)}, cachedIPs: CachedIPs{cache: make(map[string]string)},