cmd/uplinkng: add quic support

Change-Id: Ia7b4569ed39ef79ad085358e711f3f3fc0d8c398
This commit is contained in:
Jeff Wendling 2022-02-07 15:21:55 -05:00
parent b3e1be37ff
commit 4f4b67c6f6
3 changed files with 14 additions and 1 deletions

View File

@ -21,6 +21,7 @@ import (
type external struct {
interactive bool // controls if interactive input is allowed
quic bool // if set, use the quic transport
dirs struct {
loaded bool // true if Setup has been called
@ -56,6 +57,12 @@ func (ex *external) Setup(f clingy.Flags) {
clingy.Advanced,
).(bool)
ex.quic = f.Flag(
"quic", "If set, uses the quic transport", false,
clingy.Transform(strconv.ParseBool), clingy.Boolean,
clingy.Advanced,
).(bool)
ex.dirs.current = f.Flag(
"config-dir", "Directory that stores the configuration",
appDir(false, "storj", "uplink"),

View File

@ -6,10 +6,12 @@ package main
import (
"context"
"storj.io/common/rpc"
"storj.io/storj/cmd/uplinkng/ulext"
"storj.io/storj/cmd/uplinkng/ulfs"
"storj.io/uplink"
privateAccess "storj.io/uplink/private/access"
"storj.io/uplink/private/transport"
)
const uplinkCLIUserAgent = "uplink-cli"
@ -40,5 +42,9 @@ func (ex *external) OpenProject(ctx context.Context, accessName string, options
UserAgent: uplinkCLIUserAgent,
}
if ex.quic {
transport.SetConnector(&config, rpc.NewHybridConnector())
}
return config.OpenProject(ctx, access)
}

View File

@ -11,7 +11,7 @@ import (
"github.com/zeebo/clingy"
_ "storj.io/private/process"
_ "storj.io/common/rpc/quic" // include quic connector
"storj.io/storj/cmd/uplinkng/ulext"
)