cmd/{uplink,uplinkng}: set user agent for uplink binaries
We want to monitor traffic and tools that are used to interact with our network so we need to append its user agent. The same user agent is appended for current uplink and uplinkng as eventually we will remove first. Change-Id: I116080d6c2c6c85d591771facf01356de02a9392
This commit is contained in:
parent
f83a801eff
commit
75acd6109d
@ -31,7 +31,11 @@ import (
|
||||
"storj.io/uplink/private/transport"
|
||||
)
|
||||
|
||||
const advancedFlagName = "advanced"
|
||||
const (
|
||||
advancedFlagName = "advanced"
|
||||
|
||||
uplinkCLIUserAgent = "uplink-cli"
|
||||
)
|
||||
|
||||
// UplinkFlags configuration flags.
|
||||
type UplinkFlags struct {
|
||||
@ -92,7 +96,10 @@ func (cliCfg *UplinkFlags) getProject(ctx context.Context, encryptionBypass bool
|
||||
}
|
||||
|
||||
uplinkCfg := uplink.Config{}
|
||||
uplinkCfg.UserAgent = cliCfg.Client.UserAgent
|
||||
uplinkCfg.UserAgent = uplinkCLIUserAgent
|
||||
if cliCfg.Client.UserAgent != "" {
|
||||
uplinkCfg.UserAgent = cliCfg.Client.UserAgent + " " + uplinkCfg.UserAgent
|
||||
}
|
||||
uplinkCfg.DialTimeout = cliCfg.Client.DialTimeout
|
||||
if cliCfg.Client.EnableQUIC {
|
||||
transport.SetConnector(&uplinkCfg, rpc.NewHybridConnector())
|
||||
|
@ -12,6 +12,8 @@ import (
|
||||
privateAccess "storj.io/uplink/private/access"
|
||||
)
|
||||
|
||||
const uplinkCLIUserAgent = "uplink-cli"
|
||||
|
||||
func (ex *external) OpenFilesystem(ctx context.Context, accessName string, options ...ulext.Option) (ulfs.Filesystem, error) {
|
||||
project, err := ex.OpenProject(ctx, accessName, options...)
|
||||
if err != nil {
|
||||
@ -34,5 +36,9 @@ func (ex *external) OpenProject(ctx context.Context, accessName string, options
|
||||
}
|
||||
}
|
||||
|
||||
return uplink.OpenProject(ctx, access)
|
||||
config := uplink.Config{
|
||||
UserAgent: uplinkCLIUserAgent,
|
||||
}
|
||||
|
||||
return config.OpenProject(ctx, access)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user