edge

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2021 License: MIT Imports: 10 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAuthDialFailed = errors.New("dail to auth service failed")

ErrAuthDialFailed is a network or protocol error.

View Source
var ErrRegisterAccessFailed = errors.New("register access for edge services failed")

ErrRegisterAccessFailed is an internal error in the auth service.

Functions

func JoinShareURL

func JoinShareURL(baseURL string, accessKeyID string, bucket string, key string, options *ShareURLOptions) (string, error)

JoinShareURL creates a linksharing URL from parts. The existence or accessibility of the target is not checked, it might not exist or be inaccessible.

Example result is https://link.us1.storjshare.io/s/l5pucy3dmvzxgs3fpfewix27l5pq/mybucket/myprefix/myobject

The baseURL is the url of the linksharing service, e.g. https://link.us1.storjshare.io. The accessKeyID can be obtained by calling RegisterAccess. It must be associated with public visibility. The bucket is optional, leave it blank to share the entire project. The object key is also optional, if empty shares the entire bucket. It can also be a prefix, in which case it must end with a "/".

Types

type Config

type Config struct {
	// AuthServiceAddress: set a fixed DRPC server including port.
	// valid is auth.[eu|ap|us]1.storjshare.io:443
	// or a thirdparty-hosted alternative.
	//
	// Theoretically we can select the address based on the region
	// of the satellite in the access grant but there is no consensus
	// on the choice of mechanism to achieve that.
	AuthServiceAddress string

	// Root certificate(s) or chain(s) against which Uplink checks
	// the auth service.
	// In PEM format.
	// Intended to test against a self-hosted auth service
	// or to improve security
	CertificatePEM []byte
}

Config contains configuration on how to access edge services.

func (*Config) RegisterAccess

func (config *Config) RegisterAccess(
	ctx context.Context,
	access *uplink.Access,
	options *RegisterAccessOptions,
) (*Credentials, error)

RegisterAccess gets credentials for the Storj-hosted Gateway and linkshare service. All files accessible under the Access are then also accessible via those services. If you call this function a lot, and the use case allows it, please limit the lifetime of the credentials by setting Permission.NotAfter when creating the Access.

type Credentials

type Credentials struct {
	// Base32
	// This is also used in the linkshare url path.
	AccessKeyID string
	// Base32
	SecretKey string
	// HTTP(S) URL to the gateway.
	Endpoint string
}

Credentials give access to the multi-tenant gateway. These work in S3 clients.

type RegisterAccessOptions

type RegisterAccessOptions struct {
	// Whether objects can be read without authentication.
	Public bool
}

RegisterAccessOptions contains optional parameters for RegisterAccess.

type ShareURLOptions

type ShareURLOptions struct {
	// If set it creates a link directly to the data instead of an to intermediate landing page.
	// This URL can then be passed to a download command or embedded on a webpage.
	Raw bool
}

ShareURLOptions contains options how to present the data data exposed through Linksharing.

Jump to

Keyboard shortcuts

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