package
0.0.0-20240619081448-a25b4f51b4f4
Repository: https://github.com/root-gg/plik.git
Documentation: pkg.go.dev

# Functions

AskConfirmation from process input.
CheckHTTPServer for HTTP Server to be UP and running HTTP Server should must respond 404 to URL/not_found to be considered ok.
CheckPasswordHash check password against bcrypt password hash.
CreateUserFromParams return a user object ready to be inserted in the metadata backend.
EncodeAuthBasicHeader return the base64 version of "login:password".
GenerateAuthenticationSignatureKey create a new random key.
GenerateRandomID generates a random string with specified length.
GetBuildInfo get build info.
GetUserID return user ID from provider and login.
HashPassword return bcrypt password hash ( with salt ).
HumanDuration displays duration with days and years.
IsFeatureAvailable return true is the feature is available.
IsFeatureDefault return true is the feature is enabled by default.
IsValidProvider return true if the provider string is valid.
LoadConfiguration creates a new empty configuration and try to load specified file with toml library to override default params.
Logout delete session cookies.
MarshalUpload unmarshal upload if version is (1) marshal using UploadV1 format.
NewConfiguration creates a new configuration object with default values.
NewErrorReader return a new ErrorReader.
NewErrorReaderString return a new ErrorReader from the provided string.
NewFile instantiate a new object and generate a random id.
NewHTTPError return a new HTTPError.
NewPagingQuery return a new paging query.
NewPagingResponse create a new PagingResponse from query results ( results must be a slice ).
NewPlikMetrics initialize Plik metrics.
NewToken create a new Token instance.
NewUpload creates a new upload object.
NewUser create a new user object.
ParseTTL string into a number of seconds.
RequireError is a helper to test the error and it's message.
StartAPIMockServer starts a new temporary API Server to be used in tests.
StartAPIMockServerCustomPort starts a new temporary API Server using a custom port Adds a middleware that handle the /not_found path called by the CheckHTTPServer function.
StripPrefix returns a handler that serves HTTP requests removing the given prefix from the request URL's Path It differs from http.StripPrefix by defaulting to "/" and not "".
TestTimeout execute a function and return an error if the defined timeout happen before.
UnmarshalUpload unmarshal upload, if that fails try again with UploadV1 format with files in a map instead of an array.
UpdateUser update a user object with the params - prevent to update provider, user ID or login - only update password if a new one is provided.
ValidateCustomFeatureFlag validates a feature flag string value against a list of possible values.
ValidateFeatureFlag validates a feature flag string value.
WriteJSONResponse serialize the response to json and write it to the HTTP response body.

# Constants

AuthenticationSignatureKeySettingKey setting key for authentication_signature_key.
FeatureDefault feature is opt-out.
FeatureDisabled feature is always off.
FeatureEnabled feature is opt-in.
FeatureForced feature is always on.
FileDeleted when a file has been deleted from the data backend.
FileMissing when a file is waiting to be uploaded.
FileRemoved when a file has been removed and can't be downloaded anymore but has not yet been deleted.
FileUploaded when a file has been uploaded and is ready to be downloaded.
FileUploading when a file is being uploaded.
ProviderGoogle for authentication.
ProviderLocal for authentication.
ProviderOVH for authentication.
SessionCookieName Cookie key.
XSRFCookieName Cookie key.

# Variables

APIMockServerDefaultPort is the default port to use for testing HTTP server.
DummyHandler is a dummy http.Handler.

# Structs

BuildInfo export build related variables.
CleaningStats cleaning statistics.
Client export client build related variables.
Configuration object.
ErrorReader impement io.Reader and return err for every read call attempted.
File object.
HTTPError allows to return an error and a HTTP status code.
PagingQuery for the paging system.
PagingResponse for the paging system.
PlikMetrics handles Prometheus metrics.
Release export releases related variables.
ServerStats server statistics.
SessionAuthenticator to generate and authenticate session cookies.
Setting is a config object meant to be shard by all Plik instances using the metadata backend.
Token provide a very basic authentication mechanism.
Upload object.
UploadV1 upload object compatible with Plik <1.3.
User is a Plik user.
UserStats user statistics.