models

package
v1.5.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiKey

type ApiKey struct {
	Id             string `json:"Id"`
	FriendlyName   string `json:"FriendlyName"`
	LastUsed       int64  `json:"LastUsed"`
	LastUsedString string `json:"LastUsedString"`
}

ApiKey contains data of a single api key

type AuthenticationConfig

type AuthenticationConfig struct {
	Method            int      `json:"Method"`
	SaltAdmin         string   `json:"SaltAdmin"`
	SaltFiles         string   `json:"SaltFiles"`
	Username          string   `json:"Username"`
	Password          string   `json:"Password"`
	HeaderKey         string   `json:"HeaderKey"`
	OauthProvider     string   `json:"OauthProvider"`
	OAuthClientId     string   `json:"OAuthClientId"`
	OAuthClientSecret string   `json:"OAuthClientSecret"`
	HeaderUsers       []string `json:"HeaderUsers"`
	OauthUsers        []string `json:"OauthUsers"`
}

AuthenticationConfig holds configuration on how to authenticate to Gokapi admin menu

type AwsConfig

type AwsConfig struct {
	Bucket    string `yaml:"Bucket"`
	Region    string `yaml:"Region"`
	KeyId     string `yaml:"KeyId"`
	KeySecret string `yaml:"KeySecret"`
	Endpoint  string `yaml:"Endpoint"`
}

AwsConfig contains all configuration values / credentials for AWS cloud storage

func (*AwsConfig) IsAllProvided

func (c *AwsConfig) IsAllProvided() bool

IsAllProvided returns true if all required variables have been set for using AWS S3 / Backblaze

type Configuration

type Configuration struct {
	Authentication AuthenticationConfig `json:"Authentication"`
	Port           string               `json:"Port"`
	ServerUrl      string               `json:"ServerUrl"`
	RedirectUrl    string               `json:"RedirectUrl"`
	ConfigVersion  int                  `json:"ConfigVersion"`
	LengthId       int                  `json:"LengthId"`
	DataDir        string               `json:"DataDir"`
	MaxMemory      int                  `json:"MaxMemory"`
	UseSsl         bool                 `json:"UseSsl"`
	MaxFileSizeMB  int                  `json:"MaxFileSizeMB"`
	Encryption     Encryption           `json:"Encryption"`
}

Configuration is a struct that contains the global configuration

func (Configuration) ToJson

func (c Configuration) ToJson() []byte

ToJson returns an idented JSon representation

func (Configuration) ToString

func (c Configuration) ToString() string

ToString returns the object as an unidented Json string used for test units

type DownloadStatus

type DownloadStatus struct {
	Id       string
	FileId   string
	ExpireAt int64
}

DownloadStatus contains current downloads, so they do not get removed during cleanup

type Encryption

type Encryption struct {
	Level        int
	Cipher       []byte
	Salt         string
	Checksum     string
	ChecksumSalt string
}

type EncryptionInfo

type EncryptionInfo struct {
	IsEncrypted   bool   `json:"IsEncrypted"`
	DecryptionKey []byte `json:"DecryptionKey"`
	Nonce         []byte `json:"Nonce"`
}

type File

type File struct {
	Id                 string         `json:"Id"`
	Name               string         `json:"Name"`
	Size               string         `json:"Size"`
	SHA256             string         `json:"SHA256"`
	ExpireAt           int64          `json:"ExpireAt"`
	ExpireAtString     string         `json:"ExpireAtString"`
	DownloadsRemaining int            `json:"DownloadsRemaining"`
	PasswordHash       string         `json:"PasswordHash"`
	HotlinkId          string         `json:"HotlinkId"`
	ContentType        string         `json:"ContentType"`
	AwsBucket          string         `json:"AwsBucket"`
	Encryption         EncryptionInfo `json:"Encryption"`
	UnlimitedDownloads bool           `json:"UnlimitedDownloads"`
	UnlimitedTime      bool           `json:"UnlimitedTime"`
}

File is a struct used for saving information about an uploaded file

func (*File) ToJsonResult

func (f *File) ToJsonResult(serverUrl string) string

ToJsonResult converts the file info to a json String used for returning a result for an upload

type LastUploadValues

type LastUploadValues struct {
	Downloads         int
	TimeExpiry        int
	Password          string
	UnlimitedDownload bool
	UnlimitedTime     bool
}

type Result

type Result struct {
	Result     string `json:"Result"`
	FileInfo   *File  `json:"FileInfo"`
	Url        string `json:"Url"`
	HotlinkUrl string `json:"HotlinkUrl"`
}

Result is the struct used for the result after an upload swagger:model UploadResult

type Session

type Session struct {
	RenewAt    int64
	ValidUntil int64
}

Session contains cookie parameter

type UploadRequest

type UploadRequest struct {
	AllowedDownloads  int
	Expiry            int
	ExpiryTimestamp   int64
	Password          string
	ExternalUrl       string
	MaxMemory         int
	DataDir           string
	UnlimitedDownload bool
	UnlimitedTime     bool
}

UploadRequest is used to set an upload request

Jump to

Keyboard shortcuts

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