blinkfile

package module
v0.1.29 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 3 Imported by: 0

README

Docker Image CI Hugo Docs CI Go Report Card

Blinkfile

Send files quickly and securely.

Blinkfile

Features

  • Upload a file and generate sharable links
  • Single admin user authentication
  • File expiration time can be set by duration or date
  • Password-protect file access

Self-host

Easy docker compose setup for your home lab

Documentation

Read the docs for setup instructions, to learn about the project and how to contribute.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFilePasswordRequired = fmt.Errorf("file access requires password")
	ErrFilePasswordInvalid  = fmt.Errorf("invalid file password")
	ErrFileExpired          = fmt.Errorf("file has expired")
	ErrDownloadLimitReached = fmt.Errorf("file download limit reached")
	ErrExpirationInPast     = fmt.Errorf("expiration cannot be set in the past")
)
View Source
var (
	ErrEmptyUserID     = fmt.Errorf("user ID cannot be empty")
	ErrEmptyUsername   = fmt.Errorf("user name cannot be empty")
	ErrEmptyNowService = fmt.Errorf("now() service cannot be empty")
)

Functions

This section is empty.

Types

type File

type File struct {
	FileHeader
	Data io.ReadCloser
}

func UploadFile

func UploadFile(args UploadFileArgs) (file File, err error)

type FileHeader

type FileHeader struct {
	ID            FileID
	Name          string
	Location      string
	Owner         UserID
	Created       time.Time
	Expires       time.Time
	Downloads     int64
	DownloadLimit int64
	Size          int64
	PasswordHash  string
}

func (*FileHeader) Download

func (f *FileHeader) Download(user UserID, password string, matchFunc PasswordMatchFunc, nowFunc NowFunc) (err error)

type FileID

type FileID string

type NowFunc

type NowFunc func() time.Time

type PasswordHashFunc

type PasswordHashFunc func(password string) (hash string)

type PasswordMatchFunc

type PasswordMatchFunc func(hashedPassword string, checkPassword string) (matched bool, err error)

type UploadFileArgs

type UploadFileArgs struct {
	ID            FileID
	Name          string
	Owner         UserID
	Reader        io.ReadCloser
	Size          int64
	Now           NowFunc
	Password      string
	HashFunc      PasswordHashFunc
	Expires       time.Time
	DownloadLimit int64
}

type User

type User struct {
	ID UserID
	Username
	Created time.Time
}

func CreateUser

func CreateUser(id UserID, name Username, now func() time.Time) (User, error)

type UserID

type UserID string

type Username

type Username string

Directories

Path Synopsis
app
web

Jump to

Keyboard shortcuts

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