No need to initialize xTransport before we have all the parameters

This commit is contained in:
Frank Denis 2018-04-07 22:33:11 +02:00
parent dee7960be6
commit fbe91ee58b
3 changed files with 7 additions and 7 deletions

View File

@ -207,6 +207,8 @@ func ConfigLoad(proxy *Proxy, svcFlag *string) error {
proxy.logMaxSize = config.LogMaxSize
proxy.logMaxAge = config.LogMaxAge
proxy.logMaxBackups = config.LogMaxBackups
proxy.xTransport = NewXTransport()
proxy.xTransport.tlsDisableSessionTickets = config.TLSDisableSessionTickets
proxy.xTransport.tlsCipherSuite = config.TLSCipherSuite
proxy.xTransport.fallbackResolver = config.FallbackResolver

View File

@ -5,7 +5,6 @@ import (
"fmt"
"os"
"sync"
"time"
"github.com/facebookgo/pidfile"
"github.com/jedisct1/dlog"
@ -44,7 +43,6 @@ func main() {
dlog.Debug(err)
}
app.proxy = NewProxy()
app.proxy.xTransport = NewXTransport(30*time.Second, true, false)
if err := ConfigLoad(&app.proxy, svcFlag); err != nil {
dlog.Fatal(err)

View File

@ -43,20 +43,20 @@ type XTransport struct {
}
var DefaultKeepAlive = 5 * time.Second
var DefaultTimeout = 30 * time.Second
func NewXTransport(timeout time.Duration, useIPv4 bool, useIPv6 bool) *XTransport {
func NewXTransport() *XTransport {
xTransport := XTransport{
cachedIPs: CachedIPs{cache: make(map[string]string)},
keepAlive: DefaultKeepAlive,
timeout: timeout,
timeout: DefaultTimeout,
fallbackResolver: DefaultFallbackResolver,
ignoreSystemDNS: false,
useIPv4: useIPv4,
useIPv6: useIPv6,
useIPv4: true,
useIPv6: false,
tlsDisableSessionTickets: false,
tlsCipherSuite: nil,
}
xTransport.rebuildTransport()
return &xTransport
}