Documentation ¶
Index ¶
- Constants
- Variables
- func EventHandler(h http.Handler) http.Handler
- func SimpleRanger(readCloser io.ReadCloser, size int64) ranger.Ranger
- type Config
- type ConnectionPoolConfig
- type DNSClient
- type Handler
- type MutexGroup
- type Result
- type StaticDNSClient
- type TXTRecordSet
- type TXTRecords
- type Templates
- type TierQueryingService
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 { // Assets should contain two folders one for static assets and the other for templates. Assets fs.FS // DynamicAssets determines whether the assets may change during linksharing operation. DynamicAssets bool // 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 // 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 // ConcurrentRequestLimit is the number of total concurrent requests a handler will serve. If <= 0, no limit. ConcurrentRequestLimit int // ConcurrentRequestWait if true will make requests wait for a free slot instead of returning 429 (the default, false). ConcurrentRequestWait bool // BlockedPaths are requests that will return unauthorized errors. Each entry in this slice // is of the host and the URI on that host concatenated. N.B.: if the special // path "debug" is added, then allowed paths will be logged to debug level // output. Paths that start with "r:" are treated as regular expressions. BlockedPaths []string }
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.
func (*DNSClient) LookupTXTRecordSet ¶ added in v1.77.0
func (cli *DNSClient) LookupTXTRecordSet(ctx context.Context, host string) (_ *TXTRecordSet, err error)
LookupTXTRecordSet fetches record set from the specified host.
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, 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 Result ¶
type Result struct { SerializedAccess string Access *uplink.Access PublicProjectID string Root string TLS bool }
Result is the result of a query on TXTRecords.
type StaticDNSClient ¶ added in v1.77.0
type StaticDNSClient struct {
// contains filtered or unexported fields
}
StaticDNSClient provides static responses to dns queries.
func ParseStaticDNSClientFromZoneFile ¶ added in v1.77.0
func ParseStaticDNSClientFromZoneFile(data []byte) (*StaticDNSClient, error)
ParseStaticDNSClientFromZoneFile parses zone file for txt records.
func (*StaticDNSClient) LookupTXTRecordSet ¶ added in v1.77.0
func (cli *StaticDNSClient) LookupTXTRecordSet(ctx context.Context, host string) (_ *TXTRecordSet, err error)
LookupTXTRecordSet fetches record set from the specified host.
func (*StaticDNSClient) ValidateCNAME ¶ added in v1.77.0
func (cli *StaticDNSClient) ValidateCNAME(ctx context.Context, host string, bases []*url.URL) (err error)
ValidateCNAME checks host has a CNAME record with a value of one of the public URL bases.
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 Templates ¶ added in v1.79.1
type Templates struct {
// contains filtered or unexported fields
}
Templates implements cached or dynamic rendering of templates.
func NewDynamicTemplates ¶ added in v1.79.1
NewDynamicTemplates creates a templates handler that always reparses the templates on every query.
func NewStaticTemplates ¶ added in v1.79.1
NewStaticTemplates creates a templates handler that parses the templates on creation and reuses the result.
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.