Documentation
¶
Overview ¶
Package store implements croc's anonymous, encrypted, download-limited temporary storage service. It stores only ciphertext and capability verifiers.
Index ¶
Constants ¶
const ( // DefaultExpiration preserves the historical stored-transfer lifetime. DefaultExpiration = 24 * time.Hour // MinExpiration is the shortest lifetime accepted by clients and servers. MinExpiration = time.Minute // MaxExpirationSeconds is the longest whole-second lifetime representable // by time.Duration. MaxExpirationSeconds = int64(math.MaxInt64 / int64(time.Second)) )
const ( DefaultMaxTransfer = int64(1 << 30) DefaultMaxTotal = int64(5 << 30) DefaultMinFree = int64(512 << 20) DefaultMaxFiles = 100 DefaultMaxDownloads = 1 DefaultCreatePerHour = 5 DefaultActiveUploads = 2 DefaultUploadTimeout = 5 * time.Minute MaxManifestBytes = int64(256 << 10) MaxChunkObjects = 512 )
Variables ¶
This section is empty.
Functions ¶
func ParseExpiration ¶
ParseExpiration parses the stored-transfer duration syntax used by the CLI. Values are whole minutes, hours, days, or weeks. When allowUnlimited is true, an empty value or the literal "0" represents no server policy ceiling.
Types ¶
type Config ¶
type Config struct {
Root string
MaxTransferBytes int64
MaxTotalBytes int64
MinFreeBytes int64
MaxFiles int
MaxDownloads int
MaxExpiration time.Duration
CreatePerHour int
MaxActiveUploads int
UploadTimeout time.Duration
TrustedProxies []netip.Prefix
Now func() time.Time
CleanupInterval time.Duration
DisableRootLock bool
}
Config configures a filesystem-backed stored-transfer service.
type PublicConfig ¶
type PublicConfig struct {
Enabled bool `json:"enabled"`
MaxTransferBytes int64 `json:"maxTransferBytes"`
MaxFiles int `json:"maxFiles"`
MaxDownloads int `json:"maxDownloads"`
ExpiresSeconds int64 `json:"expiresSeconds"`
MaxExpiresSeconds int64 `json:"maxExpiresSeconds"`
}
PublicConfig is safe to expose to web clients.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service owns a filesystem store and serves its versioned HTTP API.
func (*Service) PublicConfig ¶
func (s *Service) PublicConfig() PublicConfig
PublicConfig returns browser-safe limits.
func (*Service) RunCleanup ¶
RunCleanup sweeps expired data until the context is cancelled.