Documentation ¶
Index ¶
Constants ¶
const FilePlaceholder = ".file_placeholder"
FilePlaceholder is the name of a prefixed empty object which is created when a user creates a folder in the satellite UI, so folders are visible without user objects. https://github.com/storj/storj/blob/4545aacea30a4ed9fd5dd5b978656590164d8ffc/web/satellite/src/store/modules/objectBrowserStore.ts#L646
Variables ¶
var ( // ErrInvalidListPageLimit is an error returned when list page limit is not greater than zero. ErrInvalidListPageLimit = errs.New("list page limit must be greater than zero") )
var UnsupportedRange = errs.Class("unsupported range")
UnsupportedRange is returned if a SimpleRanger is used in a way unsupported by a Reader.
Functions ¶
func EventHandler ¶
EventHandler collects event data to send to eventkit.
func SimpleRanger ¶
func SimpleRanger(readCloser io.ReadCloser, size int64) ranger.Ranger
SimpleRanger implements a Ranger using a ReadCloser, throwing an error for unsupported Range reads.
Types ¶
type Config ¶
type Config struct { // URLBases is the collection of potential base URLs of the link sharing // handler. The first one in the list is used to construct URLs returned // to clients. All should be a fully formed URL. URLBases []string // Templates location with html templates. Templates string // StaticSourcesPath is the path to where the web assets are located // on disk. StaticSourcesPath string // TXTRecordTTL is the duration for which an entry in the txtRecordCache is valid. TXTRecordTTL time.Duration // AuthServiceConfig contains configuration required to use the auth service to resolve // access key ids into access grants. AuthServiceConfig authclient.Config // DNS Server address, for TXT record lookup DNSServer string // RedirectHTTPS enables redirection to https://. RedirectHTTPS bool // LandingRedirectTarget is the url to redirect empty requests to. LandingRedirectTarget string // uplink Config settings Uplink *uplink.Config // SatelliteConnectionPool is configuration for satellite RPC connection pool options. SatelliteConnectionPool ConnectionPoolConfig // ConnectionPool is configuration for RPC connection pool options. ConnectionPool ConnectionPoolConfig // ClientTrustedIPsList is the list of client IPs which are trusted. These IPs // are usually from gateways, load balancers, etc., which expose the service // to the public internet. Trusting them implies that the service may use // information of the request (e.g. getting client, the originator of the // request, IP from headers). ClientTrustedIPsList []string // UseClientIPHeaders indicates that the HTTP headers `Forwarded`, // `X-Forwarded-Ip`, and `X-Real-Ip` (in this order) are used to get the // client IP before falling back of getting from the client request. // // When true it reads them only from the trusted IPs (ClientTrustedIPList) if // it isn't empty. UseClientIPHeaders bool // StandardRendersContent controls whether to enable standard (non-hosting) // requests to render content and not only download it. StandardRendersContent bool // StandardViewsHTML controls whether to serve HTML as text/html instead of // text/plain for standard (non-hosting) requests. StandardViewsHTML bool // Maximum number of paths to list on a single page. ListPageLimit int }
Config specifies the handler configuration.
type ConnectionPoolConfig ¶
type ConnectionPoolConfig struct { Capacity int KeyCapacity int IdleExpiration time.Duration MaxLifetime time.Duration }
ConnectionPoolConfig is a config struct for configuring RPC connection pool options.
type DNSClient ¶
type DNSClient struct {
// contains filtered or unexported fields
}
DNSClient is a wrapper utility around github.com/miekg/dns to make it a bit more palatable and client user friendly.
func NewDNSClient ¶
NewDNSClient creates a DNS Client that uses the given dnsServerAddr. Currently requires that the DNS Server speaks TCP.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler implements the link sharing HTTP handler.
architecture: Service
func NewHandler ¶
func NewHandler(log *zap.Logger, mapper *objectmap.IPDB, txtRecords *TXTRecords, authClient *authclient.AuthClient, tqs *TierQueryingService, inShutdown *int32, config Config) (*Handler, error)
NewHandler creates a new link sharing HTTP handler.
func (*Handler) CredentialsHandler ¶
CredentialsHandler retrieves and saves credentials as a context value.
type MutexGroup ¶
type MutexGroup struct {
// contains filtered or unexported fields
}
MutexGroup is a group of mutexes by name that attempts to only keep track of live mutexes. The zero value is okay to use.
func (*MutexGroup) Lock ¶
func (m *MutexGroup) Lock(name string) (unlock func())
Lock will lock the mutex named by name. It will return the appropriate function to call to unlock that lock.
type TXTRecordSet ¶
type TXTRecordSet struct {
// contains filtered or unexported fields
}
TXTRecordSet is somewhat like a url.Values wrapper type for key/value pairs defined across multiple TXT records.
TXT records can be defined in a number of ways:
- TXT sub.domain.tld "a value"
- TXT sub.domain.tld "field:value"
- TXT sub.domain.tld "another-field:value" "another-field-again:value"
This data structure ignores the first type (TXT records without a colon) but presents all of the key/value representations in a uniform manner.
func NewTXTRecordSet ¶
func NewTXTRecordSet() *TXTRecordSet
NewTXTRecordSet constructs an empty TXTRecordSet.
func ResponseToTXTRecordSet ¶
func ResponseToTXTRecordSet(resp *dns.Msg) *TXTRecordSet
ResponseToTXTRecordSet returns a TXTRecordSet from a dns Lookup response.
func (*TXTRecordSet) Add ¶
func (set *TXTRecordSet) Add(txt string, ttl time.Duration)
Add adds a new TXT record to the record set.
func (*TXTRecordSet) Finalize ¶
func (set *TXTRecordSet) Finalize()
Finalize makes all values in the TXTRecordSet deterministic, regardless of TXT record response order, by sorting the values.
func (*TXTRecordSet) Lookup ¶
func (set *TXTRecordSet) Lookup(field string) (value string)
Lookup will return the first value named by a given field in a TXT record set. Because TXT records have length limitations, if Lookup doesn't find the field directly, it will try to concatenate fields with ordered number suffixes. For instance:
- TXT sub.domain.tld "field-3:c"
- TXT sub.domain.tld "field-1:a" "field-2:b"
will be concatenated as when "field" is looked up as "abc".
func (*TXTRecordSet) TTL ¶
func (set *TXTRecordSet) TTL() time.Duration
TTL returns the minimum TTL seen in the reecord set.
type TXTRecords ¶
type TXTRecords struct {
// contains filtered or unexported fields
}
TXTRecords fetches and caches linksharing DNS txt records.
func NewTXTRecords ¶
func NewTXTRecords(maxTTL time.Duration, dns *DNSClient, auth *authclient.AuthClient) *TXTRecords
NewTXTRecords constructs a TXTRecords.
func (*TXTRecords) FetchAccessForHost ¶
func (records *TXTRecords) FetchAccessForHost(ctx context.Context, hostname, clientIP string) (_ Result, err error)
FetchAccessForHost fetches
- access/grant
- root/path
- tls
TXT records from cache or DNS when applicable.
Allows the use of Access Grants and Access Key IDs in storj-access.
clientIP is the IP of the client that originated the request.
func (*TXTRecords) FetchAccessForHostNoAccessGrant ¶
func (records *TXTRecords) FetchAccessForHostNoAccessGrant(ctx context.Context, hostname, clientIP string) (_ Result, err error)
FetchAccessForHostNoAccessGrant is like FetchAccessForHost, but it errors if storj-access contains an Access Grant.
type TierQueryingService ¶
type TierQueryingService struct {
// contains filtered or unexported fields
}
TierQueryingService asks satellite if a APIKey belongs to a paid account.
func NewTierQueryingService ¶
func NewTierQueryingService(identConfig identity.Config, expiration time.Duration, capacity int) (*TierQueryingService, error)
NewTierQueryingService constructs a TierQueryingService.