cmd

package
v0.34.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2020 License: AGPL-3.0 Imports: 35 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Error is the class of errors returned by this package
	Error = errs.Class("uplink")
	// ErrAccessFlag is used where the `--access` flag is registered but not supported.
	ErrAccessFlag = Error.New("--access flag not supported with `setup` and `import` subcommands")
)
View Source
var RootCmd = &cobra.Command{
	Use:                "uplink",
	Short:              "The Storj client-side CLI",
	Args:               cobra.OnlyValidArgs,
	PersistentPreRunE:  combineCobraFuncs(startCPUProfile, modifyFlagDefaults),
	PersistentPostRunE: stopAndWriteProfile,
}

RootCmd represents the base CLI command when called without any subcommands

Functions

func ApplyDefaultHostAndPortToAddr added in v0.10.0

func ApplyDefaultHostAndPortToAddr(address, defaultAddress string) (string, error)

ApplyDefaultHostAndPortToAddr applies the default host and/or port if either is missing in the specified address.

func IsSerializedAccess added in v0.31.0

func IsSerializedAccess(access string) bool

IsSerializedAccess returns whether the passed access is a serialized access string or not.

Types

type AccessConfig added in v0.30.0

type AccessConfig struct {
	Accesses map[string]string `internal:"true"`
	Access   string            `help:"the serialized access, or name of the access to use" default:"" basic-help:"true"`

	// used for backward compatibility
	Scopes map[string]string `internal:"true"` // deprecated
	Scope  string            `internal:"true"` // deprecated

	Legacy // Holds on to legacy configuration values
}

AccessConfig holds information about which accesses exist and are selected.

func (AccessConfig) GetAccess added in v0.30.0

func (a AccessConfig) GetAccess() (_ *libuplink.Scope, err error)

GetAccess returns the appropriate access for the config.

func (AccessConfig) GetNamedAccess added in v0.30.0

func (a AccessConfig) GetNamedAccess(name string) (_ *libuplink.Scope, err error)

GetNamedAccess returns named access if exists.

type ClientConfig added in v0.29.0

type ClientConfig struct {
	MaxInlineSize memory.Size   `help:"max inline segment size in bytes" default:"4KiB"`
	SegmentSize   memory.Size   `help:"the size of a segment in bytes" default:"64MiB"`
	DialTimeout   time.Duration `help:"timeout for dials" default:"0h2m00s"`
}

ClientConfig is a configuration struct for the uplink that controls how to talk to the rest of the network.

type Config added in v0.29.0

type Config struct {
	AccessConfig
	Client ClientConfig
	RS     RSConfig
	Enc    EncryptionConfig
	TLS    tlsopts.Config
}

Config uplink configuration

func (Config) GetEncryptionParameters added in v0.29.0

func (c Config) GetEncryptionParameters() storj.EncryptionParameters

GetEncryptionParameters returns the configured encryption scheme for new uploads Blocksize should align with the stripe size therefore multiples of stripes should fit in every encryption block. Instead of lettings users configure this multiple value, we hardcode stripesPerBlock as 2 for simplicity.

func (Config) GetPathCipherSuite added in v0.29.0

func (c Config) GetPathCipherSuite() storj.CipherSuite

GetPathCipherSuite returns the cipher suite used for path encryption for bucket objects

func (Config) GetRedundancyScheme added in v0.29.0

func (c Config) GetRedundancyScheme() storj.RedundancyScheme

GetRedundancyScheme returns the configured redundancy scheme for new uploads

func (Config) GetSegmentSize added in v0.29.0

func (c Config) GetSegmentSize() memory.Size

GetSegmentSize returns the segment size set in uplink config

type EncryptionConfig added in v0.29.0

type EncryptionConfig struct {
	DataType int `help:"Type of encryption to use for content and metadata (2=AES-GCM, 3=SecretBox)" default:"2"`
	PathType int `help:"Type of encryption to use for paths (1=Unencrypted, 2=AES-GCM, 3=SecretBox)" default:"2"`
}

EncryptionConfig is a configuration struct that keeps details about encrypting segments

type Legacy added in v0.29.0

type Legacy struct {
	Client struct {
		APIKey        string `default:"" help:"the api key to use for the satellite (deprecated)" noprefix:"true" deprecated:"true"`
		SatelliteAddr string `` /* 133-byte string literal not displayed */
	}
	Enc struct {
		EncryptionKey     string `help:"the root key for encrypting the data which will be stored in KeyFilePath (deprecated)" setup:"true" deprecated:"true"`
		KeyFilepath       string `help:"the path to the file which contains the root key for encrypting the data (deprecated)" deprecated:"true"`
		EncAccessFilepath string `help:"the path to a file containing a serialized encryption access (deprecated)" deprecated:"true"`
	}
}

Legacy holds deprecated configuration values

type RSConfig added in v0.29.0

type RSConfig struct {
	MaxBufferMem     memory.Size `help:"maximum buffer memory (in bytes) to be allocated for read buffers" default:"4MiB" hidden:"true"`
	ErasureShareSize memory.Size `help:"the size of each new erasure share in bytes" default:"256B" hidden:"true"`
	MinThreshold     int         `help:"the minimum pieces required to recover a segment. k." releaseDefault:"29" devDefault:"4" hidden:"true"`
	RepairThreshold  int         `help:"the minimum safe pieces before a repair is triggered. m." releaseDefault:"35" devDefault:"6" hidden:"true"`
	SuccessThreshold int         `help:"the desired total pieces for a segment. o." releaseDefault:"80" devDefault:"8" hidden:"true"`
	MaxThreshold     int         `help:"the largest amount of pieces to encode to. n." releaseDefault:"110" devDefault:"10" hidden:"true"`
}

RSConfig is a configuration struct that keeps details about default redundancy strategy information

type UplinkFlags

type UplinkFlags struct {
	Config

	Version checker.Config

	PBKDFConcurrency int `` /* 373-byte string literal not displayed */
}

UplinkFlags configuration flags

func (*UplinkFlags) GetProject added in v0.11.0

func (cliCfg *UplinkFlags) GetProject(ctx context.Context) (_ *libuplink.Project, err error)

GetProject returns a *libuplink.Project for interacting with a specific project

func (*UplinkFlags) GetProjectAndBucket added in v0.11.0

func (cliCfg *UplinkFlags) GetProjectAndBucket(ctx context.Context, bucketName string) (project *libuplink.Project, bucket *libuplink.Bucket, err error)

GetProjectAndBucket returns a *libuplink.Bucket for interacting with a specific project's bucket

func (cliCfg *UplinkFlags) NewUplink(ctx context.Context) (*libuplink.Uplink, error)

NewUplink returns a pointer to a new Client with a Config and Uplink pointer on it and an error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL