cmd/uplink: add --client.enable-quic flag

Change-Id: I19e81ecb98688fd0a36174fd06c363e9c40b3866
This commit is contained in:
Yingrong Zhao 2021-03-15 15:09:20 -04:00 committed by Yingrong Zhao
parent a04495713d
commit bf4fdc7717
2 changed files with 6 additions and 0 deletions

View File

@ -18,6 +18,7 @@ var mon = monkit.Package()
type ClientConfig struct {
UserAgent string `help:"User-Agent used for connecting to the satellite" default:""`
DialTimeout time.Duration `help:"timeout for dials" default:"0h2m00s"`
EnableQUIC bool `help:"Use QUIC as the transport protocol when it's available, otherwise, fallback to TCP" default:"false"`
}
// Config uplink configuration.

View File

@ -24,9 +24,11 @@ import (
"storj.io/common/storj"
"storj.io/private/cfgstruct"
"storj.io/private/process"
"storj.io/storj/pkg/server"
"storj.io/storj/private/version/checker"
"storj.io/uplink"
privateAccess "storj.io/uplink/private/access"
"storj.io/uplink/private/transport"
)
const advancedFlagName = "advanced"
@ -92,6 +94,9 @@ func (cliCfg *UplinkFlags) getProject(ctx context.Context, encryptionBypass bool
uplinkCfg := uplink.Config{}
uplinkCfg.UserAgent = cliCfg.Client.UserAgent
uplinkCfg.DialTimeout = cliCfg.Client.DialTimeout
if cliCfg.Client.EnableQUIC {
transport.SetConnector(&uplinkCfg, server.NewDefaultHybridConnector(nil, nil))
}
if encryptionBypass {
err = privateAccess.EnablePathEncryptionBypass(access)