Documentation
¶
Index ¶
- Variables
- type AuthConfig
- type Config
- type DBConfig
- type LimitsConfig
- type Server
- func (s *Server) AddFile(contents io.Reader, contentType string, maxUses uint, storeUntil time.Time) (string, error)
- func (s *Server) Close() error
- func (s *Server) GetFile(fileUUID string) (r io.Reader, contentType string, err error)
- func (s *Server) OpenFile(fileUUID string) (io.Reader, error)
- func (s *Server) RemoveFile(fileUUID string) error
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrFileDoesntExists = errors.New("file doesn't exists")
Functions ¶
This section is empty.
Types ¶
type AuthConfig ¶
type Config ¶
type Config struct {
Limits LimitsConfig
DB DBConfig
DownloadAuth AuthConfig
UploadAuth AuthConfig
StorageDir string
HTTPSDownstream bool
}
var Default Config
type LimitsConfig ¶
type Server ¶
type Server struct {
DB *db
Conf Config
Logger *log.Logger
DebugLogger *log.Logger
// contains filtered or unexported fields
}
filedrop server structure, implements http.Handler.
func (*Server) AddFile ¶
func (s *Server) AddFile(contents io.Reader, contentType string, maxUses uint, storeUntil time.Time) (string, error)
AddFile adds file to storage and returns assigned UUID which can be directly substituted into URL.
func (*Server) GetFile ¶
GetFile opens file for reading.
Note that access using this function is equivalent to access through HTTP API, so it will count against usage count, for example. To avoid this use OpenFile(fileUUID).
func (*Server) RemoveFile ¶
RemoveFile removes file from database and underlying storage.
Click to show internal directories.
Click to hide internal directories.